-
UILoader with preloader
Hi guys please help if you can.
I have a movieclip with a UILoader that loads an external .swf file and a preloader as it loads.
I need the UILoader to swap the .swf file when a buttoon is clicked this works fine with the code below and when I click the button the .swf will load but the preloader will not it just loads the first time i open the movieclip.
What do i need to add to refresh the preloader for each .swf file I want to load?
Cheers guys this is probably very simple but i`m very new to actionscript.
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var request:URLRequest = new URLRequest("photoGallery.swf");
myLoader.load(request);
bensTattoos_mc.addEventListener(MouseEvent.CLICK, bensBtn);
function bensBtn(event:MouseEvent):void{
// Play video Behavior
var request:URLRequest = new URLRequest("photoGallery.swf");
myLoader.load(request);
}
stop();
// preloader code
myLoader.addEventListener(Event.COMPLETE, fadeIn);
function fadeIn(e:Event):void
{
preloader_mc.alpha=0;
new Tween(myLoader,"alpha",Strong.easeOut,0,1,1,true);
}
-
myLoader.addEventListener(Event.COMPLETE, fadeIn);
change:
myLoader.contentLoaderInfo.addEventListener(Event. COMPLETE, fadeIn);
-
Thanks for the help but I get the following error.
1119: Access of possibly undefined property contentLoaderInfo through a reference with static type fl.containers:UILoader.
-
i'm sorry.
i make a mistake.
All you need to add "preloader_mc.alpha=1;" to "bensBtn" function.