I have several swf's in a folder.
For the first swf I have the following:
ActionScript Code:
myProgressBarListener = new Object();
/* Create a listener object event function. When the Progress Bar is complete and has preloaded this Movie, the listener will call and run this code below: */
myProgressBarListener = function (eventObject) {
// Hide the Progress Bar - we dont need it any more as the Movie has now loaded
myProgressBar._visible = false;
// Remove the listener
myProgressBar.removeEventL
istener("c
omplete", myProgressBarListener);
// Ends the function
};
// Declares a listener. This detects when the Progress Component has loaded the Movie. Then when the preloading is complete it calls the function myProgressBarListener
myProgressBar.addEventList
ener("comp
lete", myProgressBarListener);
// Set up the Progress Bar Component to polled when loading the Movie. This will give a polled look to the Progress Bar as it loads. It has to be set to polled to work
myProgressBar.mode = "polled";
// Set the location to load as this Movie.
myProgressBar.source = "_root";
very next frame I have
ActionScript Code:
// Create a Movie Clip to load the swf Movie into
this.createEmptyMovieClip(
"myExterna
llyLoadedS
WFMovieHol
der", 0);
// A variable to hold the name and location of where the external swf Movie is located
var myVariable = "Quiz_02.swf";
// Set the Movie's location on the Stage
myExternallyLoadedSWFMovie
Holder._x = 0;
myExternallyLoadedSWFMovie
Holder._y = 0;
/* Set the Progress Bar to manual mode so that we can reset its value back to 0. We don't want it staring from 100 ! */
myProgressBar.mode = "manual";
// Reset the Progress Bar back to zero
myProgressBar.setProgress(
0, 100);
// Show the Progress Bar
myProgressBar._visible = true;
// Create a listener object event.
myProgressBarListener = new Object();
// When the Progress Bar is complete and has preloaded the Movie, the listener will call and run this code below:
myProgressBarListener = function (eventObject) {
// Hide the Progress Bar now the Movie is loaded
myProgressBar._visible = false;
// This next section is optional.
// If you wish to remain on Frame 2 and view the External Movie do nothing
// Otherwise un-comment any of the options bellow:
// Plays the Movie from Frame 2 onwards:
// play();
// Go to the next Frame:
// nextFrame();
// Go to the next scene but may not automatically play beyond the Frame 1 in the next scene:
// nextScene();
// Goes to a Frame Label or Frame number and Play:
// gotoAndPlay("myFrameLabel"
);
// gotoAndPlay(10);
// Go to and stop at the Frame Label or Frame number:
// gotoAndStop("myFrameLabel"
);
// gotoAndStop(10);
// closes the function
};
// Declares a listener that detects when the Progress Component has loaded the external Movie and is complete.
// It will call the function myProgressBarListener when the external swf Movie has loaded
myProgressBar.addEventList
ener("comp
lete", myProgressBarListener);
// Set up the Progress Bar Component variables
// Set up the Progress Bar Component to polled when loading the Movie. It has to be set to polled to work
myProgressBar.mode = "polled";
// Set the preloader source to show the progress of the loader Component as it loads the external swf Movie
myProgressBar.source = "myExternallyLoadedSWFMovi
eHolder";
/* This is how we automatically load the external swf Movie. We call the load Movie Clip event and load the external swf Movie into the Movie Clip we created through ActionScript */
stop();
Same frame but layer under I have
ActionScript Code:
unloadMovieNum(53);
loadMovie(_root.myVariable
, _root.myExternallyLoadedSW
FMovieHold
er);
stop();
Then a user clicks a button and this code runs:
ActionScript Code:
_root.myExternallyLoadedSW
FMovieHold
er.gotoAnd
Play(2);
unloadMovieNum(53);
stop();
That works great.
Problem is on the next SWF I have pretty much the same code:
1st frame:
ActionScript Code:
myProgressBarListener = new Object();
myProgressBarListener = function (eventObject) {
myProgressBar._visible = false;
myProgressBar.removeEventL
istener("c
omplete", myProgressBarListener);
};
myProgressBar.addEventList
ener("comp
lete", myProgressBarListener);
myProgressBar.mode = "polled";
myProgressBar.source = "_root";
2nd frame:
ActionScript Code:
var myVariable2 = "Quiz_03.swf";
this.createEmptyMovieClip(
"quiz3hold
er", 0);
quiz3holder._x = 0;
quiz3holder._y = 0;
myProgressBar.mode = "manual";
myProgressBar.setProgress(
0, 100);
myProgressBar._visible = true;
myProgressBarListener = new Object();
myProgressBarListener = function (eventObject) {
myProgressBar._visible = false;
};
myProgressBar.addEventList
ener("comp
lete", myProgressBarListener);
myProgressBar.mode = "polled";
myProgressBar.source = "quiz3holder";
stop();
same frame bottom layer I have:
ActionScript Code:
unloadMovieNum(53); l
oadMovie(_root.myVariable2
, _root.quiz3holder);
stop();
Last frame I have:
ActionScript Code:
_root.quiz3holder.gotoAndP
lay(2); //unloadMovieNum(53); //unloadMovieNum(54); stop();
This works great when I test the SWF's on my hard drive, when I upload them to the web server, the first swf works and loads the 2nd swf, then when the user clicks the button in the 2nd swf is restarts from the beginning....
Any ideas?
Start Free Trial