I'm hoping for some help on an issue that I can't resolve.
I have a swf load up when the user clicks on a nav item and the section plays. What I'm trying to achieve is when the user clicks on a button within the section, the original swf is then replaced but whats happening is that I have two swfs loaded on stage. The original swf that loads up stays and I can't get rid of it. Any other swf controlled by the buttons will work fine and will disapear when another section is clicked or replaced by another button click.
This all worked fine and dandy but when I incorporated TimeLineMax in the script, the above is what happened.
Please, could I get some help?
var mytl:TimelineMax = new TimelineMax();
var loader:SWFLoader;
function LoadMySwf():void {
loader =new SWFLoader("swfs/pic1.swf" ,{container:holder,x:170,y:300})
loader.load();
}
function resetProjects():void {
TweenLite.to(loader.content, 0.5, {alpha:0,onComplete:disposeLoader});
}
function disposeLoader() {
loader.unload();
}
mytl.addLabel("projects_in", mytl.duration);
mytl.appendMultiple(TweenMax.allTo([projects_mc,btn_arrowLeft,btn_arrowRight], 0, {alpha:1, immediateRender:false, onStart:setSection, onStartParams:["projects"]}));
mytl.appendMultiple(TweenMax.allTo(mcs, 0.8,{currentProgress:1,y:100, ease:Back.easeOut, onComplete:LoadMySwf},-0.1));
mytl.addLabel("projects_complete", mytl.duration);
mytl.append(TweenMax.to(projects_mc, 0.25, {alpha:0,onComplete:resetProjects}));
mytl.appendMultiple(TweenMax.allTo([btn_arrowLeft,btn_arrowRight],0.8, {scaleX:0.5, scaleY:0.5, alpha:0, ease:Back.easeOut}, 0.4))
function btnClick1(e:MouseEvent) {
if(loader){
loader.dispose(true);
}
loader =new SWFLoader("swfs/pic1.swf" ,{container:holder,x:170,y:-100,alpha:0,onComplete:completeHandler})
loader.load();
}
function btnClick2(e:MouseEvent) {
if(loader){
loader.dispose(true);
}
loader =new SWFLoader("swfs/pic2.swf" ,{container:this,x:170,y:-100,alpha:0,onComplete:completeHandler})
loader.load();
}
function completeHandler(e:LoaderEvent):void {
TweenLite.to(e.target.content, 0.75, {alpha:1});
}