View Full Version : Why won't the second part of my code execute (Flash5)
ericinho
September 25th, 2003, 08:28 AM
on (release) {
container.loadMovie("images.swf");
if (container.getBytesLoaded() == container.getBytesTotal()) {
FadeIn(0);
}
else {
container.loadMovie("images.swf");
}
}
it loads the SWF fine, but the FadeIn function is not being applied... The FadeIn function needs the SWF to be loaded... is that maybe the problem... to put this all in one script on a button???
senocular
September 25th, 2003, 08:31 AM
yes thats the problem. It will take time for your movie to be loaded. The button action only happens at one presice instance. In fact its that very instance that the movie is told to be loaded so at that point its far from being loaded. because of that, your if check is pretty much point less... that will need to be done over a onClipEvent(enterFrame) (beign sure to stop it after it becomes true so it doesnt repeatedly call fade over and over again) or the Fade will have to be handled on an onClipEvent(onLoad) in the container movie.
ericinho
September 25th, 2003, 09:13 AM
hmmm, yeah, thought so...
it's for a photo portfolio and when I click a thumbnail, the pic has to fade in (swapDepth + the MC in which the pic is put has a alpha fade in script).
on the root 4 buttons, in the container MC the SWF containing the pics (put on 1 frame into MC called window1,2,3
when I click one of the buttons, it should loadMovie the SWF, but at the same time set the right pic as highest (swapDepth) MC in that external SWF loaded into the container...
would it be feasible to:
with each one of the buttonclicks (no way predicting which one comes first) to first loadMovie the PICTURE.swf and then set a VAR... so when the frame1 of that loadedMovie is being played, the right PICTURE-mc is being swapDepth' till top... but also when the next button is being clicked, the new pictureMC goes indeed over the previous clicked picture.
(so basically, can my current script be adapted to work without the loadMovie having to be put on the main timeline action?
======================
current script:
* On FRAME1 of the MAIN timeline
container.loadMovie("images.swf"); // THIS LOADMOVIE CAN"T STAY HERE :) //
lastWindow = 5;
FadeIn = function (windowNum) {
var currWindow = container["window"+windowNum];
if (lastWindow != windowNum) {
container["window"+lastWindow].gotoAndStop(container["window"+lastWindow]._totalframes);
currWindow.swapDepths(++depth);
currWindow.gotoAndPlay(2);
lastWindow = windowNum;
}
};
* Script on Button(s)
on (press) {
FadeIn(1); // change 1 into 0, 2, 3 depending on which pic //
}
* in external SWF:
4 MC containing a pic and a alpha fade in script (instance name: window0,1,2,3 plus an empty MC called window5 (is the starting swapDepth layer AKA lastWindow var)
Thanks for your time :)
ericinho
September 26th, 2003, 04:13 AM
so far I can get it to work that when I use the buttons to load the SWF, and I put the script (now on frame 1 of the main movie) inside the external SWF + the buttons inside that external SWF as well, it works (but obviously I cannot put those buttons there).
I am trying to set a var with clicking the buttons on the main, and to have inside the external SWF an IF statement telling to FadeIn(0,1,2,3) when the var is for example 1... but that doesn't work.
Even more, only buy clicking this FadeIn function seems to be activated... if for example I use the FadeIn() in a onClipEvent(load)... it doesn't work anymore?????
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.