-
[CS3] Load multiple external swf files
I built a loader with three buttons, each of which loads a different external swf. The code works, and all three buttons load the correct swf, but when I click the second button before the first swf is finished playing, the two movies overlap. If I click all three buttons in succession, all three swfs play, one over the other.
How do I code the buttons so they first stop the swf that is already playing, and then play the swf they are meant to load? Here is my code:
var imageRequest:URLRequest = new URLRequest("scene1.swf");
var imageLoader:Loader = new Loader();
welcomeBtn.addEventListener(MouseEvent.CLICK, loader);
function loader(event:MouseEvent){
imageLoader.load(imageRequest);
marker.addChild(imageLoader);
}
var imageRequest2:URLRequest = new URLRequest("scene2.swf");
var imageLoader2:Loader = new Loader();
designBtn.addEventListener(MouseEvent.CLICK, loader2);
function loader2(event:MouseEvent){
imageLoader2.load(imageRequest2);
marker.addChild(imageLoader2);
}
var imageRequest3:URLRequest = new URLRequest("scene3.swf");
var imageLoader3:Loader = new Loader();
sponsorBtn.addEventListener(MouseEvent.CLICK, loader3);
function loader3(event:MouseEvent){
imageLoader3.load(imageRequest3);
marker.addChild(imageLoader3);
}
Thanks!
-
never done it that way before - have you tried just having one loader?
The three buttons would change var currentScene to 1, 2, or 3 and the one loader would load "scene[currentScene].swf" or something like that...
Alternatively you could load them all into the same specified level/layer.
In either case, the idea would be that any previous occupant would be kidked out for the new one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|