A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Preloader script returns error

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    9

    Preloader script returns error

    I followed a video tutorial to the letter and watched as his code worked and mine returns errors. They are identical and yet.......FAIL. Here is the code. Can some one help me?
    Actionscript Code:
    stop();

    var percentage:Number;

    onEnterFrame = function()
    {
        if(getBytesLoaded() >= getBytesTotal())
        {
            gotoAndStop(2);
            delete onEnterFrame;
        }
       
        percentage = Math.round((getBytesLoaded() / getBytesTotal() )*100);
        bar._xscale = percentage;
        //trace(percentage);
    }

    here is the link to the video if it helps you help me.
    http://www.viddler.com/explore/dorklessons/videos/12/

    And here are the errors that I receive.
    **Error** Scene 1, Layer 'actions', Frame 1, Line 5: 1120: Access of undefined property onEnterFrame.
    onEnterFrame = function()

    **Error** Scene 1, Layer 'actions', Frame 1, Line 7: 1180: Call to a possibly undefined method getBytesLoaded.
    if(getBytesLoaded() >= getBytesTotal())

    **Error** Scene 1, Layer 'actions', Frame 1, Line 7: 1180: Call to a possibly undefined method getBytesTotal.
    if(getBytesLoaded() >= getBytesTotal())

    **Error** Scene 1, Layer 'actions', Frame 1, Line 10: 1120: Access of undefined property onEnterFrame.
    delete onEnterFrame;

    **Error** Scene 1, Layer 'actions', Frame 1, Line 13: 1180: Call to a possibly undefined method getBytesLoaded.
    percentage = Math.round((getBytesLoaded() / getBytesTotal() )*100);

    **Error** Scene 1, Layer 'actions', Frame 1, Line 13: 1180: Call to a possibly undefined method getBytesTotal.
    percentage = Math.round((getBytesLoaded() / getBytesTotal() )*100);

    Total ActionScript Errors: 6, Reported Errors: 6
    Last edited by andorosfire; 10-07-2010 at 09:26 AM.

  2. #2
    Junior Member
    Join Date
    Sep 2010
    Posts
    9
    I just realized this is AS2 code. Why would someone teaching a CS3 course use AS2? Does anyone know how to write the AS3 version of this code?
    Thanks

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