dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: help with preloader

  1. #1
    Junior Member
    Join Date
    Jul 2001
    Posts
    14

    help with preloader

    I made a simple bar preloader but it gives me a: 'Target not found: Target="undefined" Base="_level0"' error. here's my actionscript:

    loadedbytes=getBytesLoaded();
    totalbytes=getBytesTotal();
    loadedkbytes=Math.ceil (loadedbytes/1000);
    totalkbytes=Math.ceil(totalbytes/1000);
    if (loadedbytes == totalbytes) {
    nextScene ();
    }
    frame = int(loadedbytes/(totalbytes/100));
    tellTarget (_root.loader) {
    gotoAndStop (_root.frame);
    }

    Can anyone tell me why????

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The code is checking the current timeline ( wherever that is, you dont mention where the code is located ).

    Using... _root


    loadedbytes=_root .getBytesLoaded();
    totalbytes=_root .getBytesTotal();

    ..it will check the whole movie, which is probably what you want.

    If the code is NOT on the main timeline you can not target scenes. Framelabels are safer to use than scenes or framenumbers...

    if (loadedbytes == totalbytes) {
    _root.gotoAndStop("myFrameLabelName");
    }

    Tell Target is old Flash 4 code and is not needed anymore.

    _root.loader.gotoAndStop (_root.frame);

    You are referring to _root frame which will be undefined if your preloader code isnt on the main timeline. For that you need.......

    _root.frame = math.round((loadedbytes/totalbytes)*100);

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Junior Member
    Join Date
    Jul 2001
    Posts
    14
    Targeting the rame label rather than the scene worked... I have the preloader in a different scene and didn;t kow you could target a frame label in another scene! and yes I updated the code too. Thanks again for the help!

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Good to hear it works now.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

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