A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: help with loader and preloader class

  1. #1
    Member
    Join Date
    Mar 2009
    Posts
    82

    Question help with loader and preloader class

    I have a loader which loads on a MouseEvent.Click

    It uses this for multiple swfs
    Actionscript Code:
    myLoader.load(new URLRequest(event.target.name + ".swf"));

    How can I add a custom preloader to this?

  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    PHP Code:
    myLoader.addEventListener (ProgressEvent.PROGESSonProgessfalse0true);
    myLoader.load (...);

    function 
    onProgress (e:ProgressEvent) {
        var 
    perc:Number e.bytesLoaded e.bytesTotal;

    There you have the percent loaded so you can update some graphic everytime that event happens.

  3. #3
    Member
    Join Date
    Mar 2009
    Posts
    82
    PROGRESS and onProgress are undefined properties?
    Thats what it gives me when I tried it

  4. #4
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    Try this instead.
    PHP Code:
    myLoader.contentLoaderInfo.addEventListener (.....) 

  5. #5
    Member
    Join Date
    Mar 2009
    Posts
    82
    Again, running it prompts error access of undefined property for both PROGRESS and onProgress.

    Would I need to call them from the library or something?

  6. #6
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    Hi,

    Events should be added to the contentLoaderInfo property.
    And make sure you import the ProgressEvent Class?

    So, you should have
    Actionscript Code:
    myLoader.contentLoaderInfo.addEventListener (ProgressEvent.PROGESS, onProgess, false, 0, true);

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