A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: (AS3)Load library item with UIloader and Progrees Bar components

Hybrid View

  1. #1
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439

    (AS3)Load library item with UIloader and Progrees Bar components

    Hi Everyone,

    I have a set up that loads an external image using the Progress Bar and UILoader components. How may I adapt this code to load library item instead?

    Code:
    //LOADER
    
    var imageURL:String = "content1";
    
    var imageURLRequest = new URLRequest(imageURL);
    
    uiLoader.scaleContent = false;
    uiLoader.load(imageURLRequest);
    
    progressBar.source = uiLoader;
    progressBar.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    progressBar.addEventListener(Event.COMPLETE, completeHandler);
    
    function progressHandler(event:ProgressEvent):void
    {
    
    	status_txt.text = int(event.currentTarget.percentComplete) + "%";
    
    }
    
    function completeHandler(event:Event):void
    {
    
    	progressBar.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
    	progressBar.removeEventListener(Event.COMPLETE, completeHandler);
    	removeChild(progressBar);
    	status_txt.text = "";
    
    }
    //LOADER
    Any help is much appreciated

  2. #2
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Anyone, is this even possible.

  3. #3
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Ok I managed to load the movie clip into my UILoader but I can't get the Progress Bar to kick in. Can someone point me into the right direction, please and thanks:-)

    Code:
    //LOADER
    
    var imageLoad:MovieClip = new content1();
    
    uiLoader.addChild(imageLoad);
    uiLoader.scaleContent = false;
    
    progressBar.source = uiLoader;
    progressBar.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    progressBar.addEventListener(Event.COMPLETE, completeHandler);
    
    function progressHandler(event:ProgressEvent):void
    {
    
    	//status_txt.text = int(event.currentTarget.percentComplete) + "%";
    
    }
    
    function completeHandler(event:Event):void
    {
    
    	progressBar.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
    	progressBar.removeEventListener(Event.COMPLETE, completeHandler);
    	removeChild(progressBar);
    	//status_txt.text = "";
    
    }
    
    //LOADER
    Last edited by freshly; 05-18-2011 at 09:38 AM.

  4. #4
    Senior Member freshly's Avatar
    Join Date
    Dec 2003
    Location
    Toronto, Canada
    Posts
    439
    Can anyone help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center