A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: gotoandplay the % loaded?

  1. #1
    Senior Member
    Join Date
    Oct 2001
    Posts
    1,053

    gotoandplay the % loaded?

    ok... i have a preloader and all that, and i have it so it creates a number 1-50 to show the progress of the load.

    now, i have an mc with 50 frames, and i want it to go to the frame that coincides with the number 1-50 as its being loaded... does this make sense?

    the variable for the number is tearprogress, and the mc is called tear

    i've tried the code _root.tear.gotoandStop(tearprogress); but that doesent work...

    anyone know what to do?

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Location
    Copenhagen, Denmark
    Posts
    228
    could it be that _root.tear isn't actually fully loaded when you try to reference it?

    idi

  3. #3
    Senior Member
    Join Date
    Oct 2001
    Posts
    1,053
    no thats what the point of the animation is...
    the animation is supposed to play along according to the speed of the loading...

    when the loading is at 20% the animation will be on frame 10, at 50% the animation will be on frame 25, etc.

  4. #4
    Senior Member
    Join Date
    Oct 2001
    Posts
    1,053
    here is an example of whats happening

    http://www.seeminglyawake.net/kyle/main3.html

    after the main site loads (may take a bit) click on the blue box
    that will load an external jpg into the left frame

    in the left frame, you will see a number appear... thats the 1-50 number i am talking about... inside the frame, there is an animation of the background tearing away... thats the animation that i want to represent loading. i want it to begin at 1 and be fully torn off at 50... now it just loops over and over...

    can anyone help?
    it would be very much appreciated

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Location
    Copenhagen, Denmark
    Posts
    228
    two quick questions:
    are you using Math.round on the loaded percentage before using it as a reference for the framenumber?
    have you placed a stop() action on frame 50 of the tearaway?

    idi

  6. #6
    Senior Member
    Join Date
    Oct 2001
    Posts
    1,053
    not using math.round

    i figured that since the numbers were sometimes decimals it might not work, but dont know how to do it...

    no stop action yet, because i wanted to see if it would keep looping or if it would play the frames like its supposed to

  7. #7
    Senior Member pelegku's Avatar
    Join Date
    Nov 2002
    Posts
    116

    u cna use

    Math.round() to get a number so that u can acces the frames

  8. #8
    Senior Member
    Join Date
    Oct 2001
    Posts
    1,053
    ok... where in this code would i put the math.round?
    (i have no idea how to use math.round)

    tearprogress = ((_root.holder.getBytesLoaded()/_root.holder.getBytesTotal())*50);
    _root.tear.gotoAndStop(tearprogress);

  9. #9
    Senior Member
    Join Date
    Sep 2000
    Location
    Copenhagen, Denmark
    Posts
    228
    tearprogress = Math.round(((_root.holder.getBytesLoaded()/_root.holder.getBytesTotal())*50));
    _root.tear.gotoAndStop(tearprogress);

    idi

  10. #10
    Senior Member
    Join Date
    Oct 2001
    Posts
    1,053
    thanks a ton!
    works like a charm now

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