The following example shows how you can detect when a Flash/ActionScript 3.0 UILoader control has completed loading it’s contents by listening for the complete event (using the Event.COMPLETE constant).

Full code after the jump.

// ActionScript 3.0
/* Requires:
 * - UILoader control in Library
 */
 
import fl.containers.UILoader;
 
var urlReq:URLRequest = new URLRequest();
urlReq.url = "http://helpexamples.com/flash/images/image1.jpg";
 
var uiLoader:UILoader = new UILoader();
uiLoader.addEventListener(Event.COMPLETE, uiLoader_complete);
uiLoader.load(urlReq);
uiLoader.move(10, 10);
addChild(uiLoader);
 
var tf:TextField;
 
function uiLoader_complete(evt:Event):void {
    tf = new TextField();
    tf.text = evt.type;
    addChild(tf)
}
Tagged with:
 

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Spam Protection by WP-SpamFree