Tuesday, December 6, 2011

Controlling loaded movie clip

Hi all,



I have a movie that loads other movies into it, one of which
is effectively a page footer. As some of my movies are different
heights (all pages conform to one of 2 heights), I want the footer
to animate it's y position to sit at the bottom of the content.



I am currently loading the footer into _level0, the content
into _level1 and the navigation into _level100.



One of the pages (loaded into _level1) requiring the footer
to change positon has the following AS on the first frame:



_global.isTall = true; // (For pages where the footer should
be at the normal height, this is false)

trace(''This ''+_global.isTall);

if(_global.isTall = true and _global.wasTall == false){

_level0.gotoAndPlay(''TallPage''); // (The animation for the
footer to its new position)

_level101.gotoAndPlay(''out'');

}



The button (at _level100) relating to this page has the
following AS attached:



on(release){

_global.wasTall = _global.isTall;

trace(''Last ''+_global.wasTall);

loadMovie(''cars.swf'', 1);

}



This works as expected once, but if I press the button twice,
while already on the page, the trace tells me that _global.wasTall
is false, when previously on the same page it traced true.



Am going about this in a completely backwards way?



TIA,

PaulControlling loaded movie clip
copy and paste your code. the code you showed has more
problems than you're describing.Controlling loaded movie clip
Hi kglad,



Code pasted below. I amusing Flash 8, but haven't done any
Flash scripting for a while.



Thanks,

Paul





Default.fla - frame 1:



loadMovie(''navigation.swf'', 100);

loadMovie(''sub navigation.swf'', 101);

loadMovie(''index.swf'', 1);

stop();



Default.fla - frame 2 (label ''TallPage'') to frame 15

animation of footer moving down with stop action on frame 15



Default.fla - frame 16 (label ''ShortPage'') to frame 30

animation of footer moving back up with stop action on frame
30



-------------------------------------------------------------------------------- ---------



Index.fla (Not a tall page) - frame 1:



_global.isTall = false;

trace(''This ''+_global.isTall);

if(_global.wasTall == true and _global.isTall == false){

_level0.gotoAndPlay(''ShortPage'');

_level101.gotoAndPlay(''in'');

}



-------------------------------------------------------------------------------- ---------



Navigation.fla - attached to cars button (cars is a larger
page)



on(rollOver) {

cursorIsOver = true;

play();

}



on(rollOut) {

cursorIsOver = false;

play();

}



on(release){

_global.wasTall = _global.isTall;

trace(''Last ''+_global.wasTall);

loadMovie(''cars.swf'', 1);

}



-------------------------------------------------------------------------------- ---------



Cars.fla (a tall page) - frame 1:



_global.isTall = true;

trace(''This ''+_global.isTall);

if(_global.isTall = true and _global.wasTall == false){

_level0.gotoAndPlay(''TallPage'');

_level101.gotoAndPlay(''out'');

}
Aha!



I have fixed my problem by replacing the = with ==, but if
you can suggest a way to improve / streamline this, then please
hook me up.



Thanks,

Paul
if it works, i wouldn't change it.
Thanks kglad

No comments:

Post a Comment