A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: need a help!

  1. #1
    Junior Member
    Join Date
    May 2004
    Posts
    8

    need a help!

    This is a preloader.

    And I get this error:

    ERROR: Cannot find variable or function "percent" in statement:
    Preloader:: onFrame (5) {
    :: percent -= (percent-((loading/total)*100))*.25
    Referenced from: "_root"

    What is wrong? or is it just that it isnt on the web?

    thanks!

  2. #2
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    hi,

    if a variable isn't found, it most likely hasn't been defined. although in this case i'm having trouble following the script. please post the swi so someone can check what's wrong.

    btw. regardless of the invalid sytax of your script, preloaders will never show up when the file hasn't been uploaded, bacause the file loads instantly off your hd. always check the swf online and clear the browser cache to view the preloader in action again.

  3. #3
    Junior Member
    Join Date
    May 2004
    Posts
    8
    onFrame (5) {
    loading = _root.getBytesLoaded();
    total = _root.getBytesTotal();
    percent -= (percent-((loading/total)*100))*.25;
    per = int(percent);
    percentage = per add "%";
    loaderbar._xscale = per;
    if (percent > 99) {
    nextSceneAndPlay();
    }
    }
    onFrame (6) {
    prevFrameAndPlay();
    }

    that is the script! Hope it help

  4. #4
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    percent -= ?

    shouldn't that be
    percent =

  5. #5
    Junior Member
    Join Date
    May 2004
    Posts
    8
    no, then % dosnt loade right in to the loading bar...

  6. #6
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    if you have a dynamic textbox for percentage
    Is it checked as a target...
    and if so have you associated the variable percentage
    with the text box?

  7. #7
    Junior Member
    Join Date
    May 2004
    Posts
    8
    HMm. Maybe it work to uploade the file then you can look at it
    Attached Files Attached Files

  8. #8
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    this won't work:

    precent = (precent-((loading/total)*100))*.25

    you'll have to define the variable first before you can use it in this context.

    assuming that "percentage" is the name of your text object (which is missing in your example), this will work fine:

    percentage = per add "%";

    in the example you posted, it's
    percent = per add "%";

    which is likely to cause problems.

  9. #9
    Junior Member
    Join Date
    May 2004
    Posts
    8
    What about this one then? Or is it the same problem here?
    if it is can you maybe fix it??
    Attached Files Attached Files

  10. #10
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    here's a fixed version:
    Attached Files Attached Files

  11. #11
    Junior Member
    Join Date
    May 2004
    Posts
    8
    Ok.. Now I see it 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