PDA

View Full Version : whats wrong with this code


cablecharlz
07-03-2002, 05:53 AM
on (release) {
unloadMovieNum (2);
loadMovieNum ("movies/3d4.swf", 3);
_framesloaded15;
unloadMovieNum (3);
loadMovieNum ("movies/3dstill.swf", 2);
}

i want to press the button
unload one of my movie clips
then load a new clip ..just for the duration of that clip
then unload it again
and then reload my original clip back

Ricod
07-03-2002, 09:06 AM
Never tried it, but I don't think its gonna work. U see, its suppossed to do all that while u release the button. Which means the instant u release it, any incomplete tasks will be ignored.

What u should do is let a mc handle the loading and unloading of your mcs in a loop. (3 frames, the first a stop and the last with a goToAndPlay(2)) In it u should have it unload the first swf, mark it as such (and look for it, since its looping. Use a variable and if statements) Then load in the 2nd mc and within another if statement that checks wether or not it has completely played, unload it, and then load in the first again. Then let it goToAndStop(1);

Just let the button tell the mc to goToAndPlay(2);

cablecharlz
07-04-2002, 04:39 AM
how would i code that?
i'm still not too use how to use variables and if statements

Ricod
07-04-2002, 09:33 AM
Normally I don't do this ... but I guess u caugt me at a very rare moment ... I'm in a good mood ...

the mc "LoadHandler" (3 frames) :
----------------------------------------------------------
frame 1 : stop();

frame 2 :
if (_root.MovieState == 1) {
unloadMovieNum (2);
_root.MovieState = 0;
loadMovieNum ("movies/3d4.swf", 3);
}
if (_root.MovieState == 2) {
unloadMovieNum (3);
loadMovieNum ("movies/3dstill.swf", 2);
_root.MovieState = 3;
gotoAndStop(1);
}
frame 3:
if (_root.MovieState == 1) {
unloadMovieNum (2);
_root.MovieState = 0;
loadMovieNum ("movies/3d4.swf", 3);
}
if (_root.MovieState == 2) {
unloadMovieNum (3);
loadMovieNum ("movies/3dstill.swf", 2);
_root.MovieState = 3;
gotoAndStop(1);
} else {
gotoAndPlay(2);
}
----------------------------------------------------------
the button :
on (release) {
_root.LoadHandler.gotoAndPlay(2);
}
----------------------------------------------------------
Now, on the last frame of 3dstill.swf :
_level0.MovieState = 1;

and on the last frame of 3d4.swf :
_level0.MovieState = 2;
----------------------------------------------------------
So, what's going on here ?
The actual loading and unloading is handled by a looping mc. I'm guessing there are more efficient ways in MX, but I wouldn't know ... :( Anyway, this'll get the job done, if everything is going correctly (like in my head, unfortunately reality is usually different ... :mad: )
This mc will look for the variable MovieState, which will be set by the swfs and the handler self.

If its not working, u could try putting the LoadMovieNum in its own if statement, checking if _root.MovieState == 0;

cablecharlz
07-04-2002, 11:56 PM
thx for that

for the the mc "LoadHandler"
can i just put it anywhere
and it wouldn't matter?
the movie can be nth rite?

Ricod
07-05-2002, 07:55 AM
Sure ! U could call it "ThisIsProbablyOneOfTheLargestInstanceNamesIveEverU sedInAnSWFSinceIWasBorn" and place it on _level42 inside 3 other mcs and it'll still work, as long as the button has the right path :) !