Skip to main content
Participant
April 3, 2009
Question

General Preloader Question

  • April 3, 2009
  • 1 reply
  • 319 views
Would someone be able to give me a basic example of using a preloader with the UILoader? Basically, I have a movieclip of a rotating circle that I would like to use as a preloader for the UILoader. Thanks in advance for any help!
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 5, 2009

if uiL is your UILoader instance, you can use:

uiL.addEventListener(ProgressEvent.PROGRESS, progressF);

uiL.addEventListener(Event.COMPLETE, completeF);

uiL.load(new URLRequest("whatever.jpg"));

function progressF(event:ProgressEvent):void {   

// do whatever    

var uiLdr:UILoader = UILoader(event.currentTarget);   

trace(Math.round(uiLdr.percentLoaded) + "% Loaded");

}

function completeF(event:Event):void {   

// remove your loading display   

uiL.removeEventListener(ProgressEvent.PROGRESS, progressF);   

uiL.removeEventListener(Event.COMPLETE, completeF);

}