I set up a very basic fla with 3 bts and 3 dummy swfs. Each bt loads an swf into a mc called 'loadmc' an empty container on the stage and fades it in using greensock's TweenLite.
But i ran into a roadblock here. i want it to function like this:
a) load 1st swf
b) on click fade out 1st swf and load 2nd swf.. and so on..
here's the code:
i did not use an array because the loading swfs are totally upon the user.Code:import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; TweenPlugin.activate([AutoAlphaPlugin]); import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.MouseEvent; var loader:Loader = new Loader(); addChild(loader); bt1.addEventListener(MouseEvent.CLICK,onLoadClick); function onLoadClick(evt:MouseEvent):void { loadmc.alpha = 0; loader.load(new URLRequest("loadtest1.swf")); loadmc.addChild(loader); TweenLite.to(loadmc, 0.8, {autoAlpha:1, ease:Sine.easeIn}); } bt2.addEventListener(MouseEvent.CLICK, onLoadClick2); function onLoadClick2(evt:MouseEvent):void { loadmc.alpha = 0; loader.load(new URLRequest("loadtest2.swf")); loadmc.addChild(loader); TweenLite.to(loadmc, 0.8, {autoAlpha:1, ease:Sine.easeIn}); } bt3.addEventListener(MouseEvent.CLICK, onLoadClick3); function onLoadClick3(evt:MouseEvent):void { loadmc.alpha = 0; loader.load(new URLRequest("loadtest3.swf")); loadmc.addChild(loader); TweenLite.to(loadmc, 0.8, {autoAlpha:1, ease:Sine.easeIn}); }
i am thinking, i need a second empty container (loadmc2?) and fade the 2 with each other while loading, but my as3 knowledge is basic as i am still learning.
any help would be appreciated, thanks.


Reply With Quote
