Hi
I’m creating a flash site, navigation is simple, or so I thought. Buttons along the top load external swf’s to the stage. As they are loaded and unloaded the swf’s animate in and out again on button clicks so the next one can come in.
I have suceeded in controlling the loaded swf’s to get them to animate onto the stage, but what I have added to animate them off again does not work. I don’t even get error messages, it is just ignored.
I have indicated below what I have added to try and ‘animate out’
Actionscript:
stop();
//////// HOMEPAGE CONTENT LOADS ON PAGELOAD ///////////
addChild(loader);
var swfloader:URLRequest=new URLRequest(‘contentboxhome.swf’);
loader.load(swfloader);
/////////// BUTTONS //////////
////////////// HOME BTN ////////////////
homebtn.addEventListener(MouseEvent.MOUSE_OVER, mouseoverhome);
homebtn.addEventListener(MouseEvent.MOUSE_OUT, mouseouthome);
homebtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseclickhome);
function mouseoverhome(event:MouseEvent):void {
homebtn.gotoAndStop(2);
}
function mouseouthome(event:MouseEvent):void {
homebtn.gotoAndStop(1);
}
function mouseclickhome(event:MouseEvent):void{
homebtn.gotoAndPlay(3);
gotoAndStop(2); //background change
var loadedswf:Object=loader.content;
___from here is ignored
loadedswf.gotoAndPlay(16);
if (loadedswf.currentFrame == 30){
loader.unload();
} ___to here (tried an ‘if’ statement)
}
//////////////// ABOUT BTN /////////////////
aboutbtn.addEventListener(MouseEvent.MOUSE_OVER, mouseoverabout);
aboutbtn.addEventListener(MouseEvent.MOUSE_OUT, mouseoutabout);
aboutbtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseclickabout);
function mouseoverabout(event:MouseEvent):void {
aboutbtn.gotoAndStop(2);
}
function mouseoutabout(event:MouseEvent):void {
aboutbtn.gotoAndStop(1);
}
function mouseclickabout(event:MouseEvent):void{
aboutbtn.gotoAndPlay(3);
homebtn.mouseEnabled=true;
gotoAndStop(4);
var loadedswf:Object=loader.content;
____from here is ignored
loadedswf.gotoAndPlay(16);
loadedswf.addEventListener(Event.COMPLETE, animateout);
function animateout(e:Event):void {
loader.unload();
} ___to here (this is the completelistener I mentioned)
addChild(loader);
var swfloader:URLRequest=new URLRequest(‘contentboxabout.swf’);
loader.load(swfloader); }
End of Actionscript
This is a sample of two of the 5 buttons, I have tried using both the ‘if’ function on all buttons and the ‘event complete’ function on all of them, and both are just ignored. No error messages, no unusual occurrences at all. The code is just skipped over and the swf I have requested to load, just animates in and replaces the one there currently. Only funny thing is that, despite the ‘loader.unload();’ being WITHIN the ‘complete’ function, it still seems to be fired. The swf’s never overlap each other.
Any help appreciated