A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [RESOLVED] Preloader Actionscript help.

Hybrid View

  1. #1
    Member
    Join Date
    May 2006
    Location
    UK
    Posts
    92

    [RESOLVED] Preloader Actionscript help.



    Hey guys, I need a little bit of help with this preloader, it's more advanced than the ones I usually do and this is why I need a wee bit help. Let me talk you through it, Section 1, is an area for the percentage loaded, section 2 is for the main animation, this is a water jet animation, it starts right at the start of the section on the left hand site and there is a mask. The thrid section I want to display KB loaded, or anything to do with data would be nice. The red line in the middle I added and this is to show the preloader half loaded. So hopefully I explained how it works okay. So this is what I need someone to give me help with.

    1)the code needed for the percentage to be displayed in section 1 (I have already placed a dynamic text field there.

    2)The code needed for the water animation to graphicly represent how much of the movie has been loaded. The start of section 2 obviously being 0% and when the animation touches the other side...100%.

    3)The code needed to display KB loaded or KB/s or something like that in section 3

    I dont really want to release my .FLA incase the animation gets ripped, but here is the timeline which will probably aid you in trying to help me out.

    Thanks a lot for any help you can give me guys. These forums are great for help so im hoping someone can aid me this time. Thanks for reading!

    -Nick.





  2. #2
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    how long is the water animation...is it something that plays left to right, or are you setting a mask? Is it a video that plays smoothly or was it created in flash?

  3. #3
    Member
    Join Date
    May 2006
    Location
    UK
    Posts
    92
    It runs continuously, it has a mask so that it doesnt come put of the required area and is embeded as a video...it runs smoothly.

    thanks.

  4. #4
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    Have your preloader movie go 100 frames (animating the water going from left to right from frame 1) and put a stop() action on the first frame. On the main timeline action layer put this action:
    Code:
    stop();
    this.onEnterFrame = function() {
         var loadedB = this.getBytesLoaded();
         var totalB = this.getBytesTotal();
         var percent = Math.round((loadedB/totalB)*100);
         percent_txt.text = percent+"%";
         waterBar_mc.gotoAndStop(percent);
         bytes_txt.text = loadedB+"/"+totalB;
         if (percent >= 100) {
              gotoAndPlay("mainMovie_frame");
              delete this.onEnterFrame;
         }
    }
    You'll have to change the names to match your MC's and textFields but this should give you a start.

    Let me know if this is what you are looking for.

  5. #5
    Member
    Join Date
    May 2006
    Location
    UK
    Posts
    92
    Hey man, thanks a lot for helping me out, any chance you could repost the code with the highlighted areas that I need to change?

    thanks!

    Nick.

  6. #6
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    the only things you need to change is the "percent_txt" name, "waterBar_mc" name, and "bytes_txt" name. Your dynamic text boxes should have instance names as well as your water animation movieClip. Just change these names to match whatever you called them.

  7. #7
    Member
    Join Date
    May 2006
    Location
    UK
    Posts
    92
    Ok thanks, it seems to be working a little bit. It seems to preload a bit and the data and percentage bits work a bit, but the preloader shows, then goes and then the rest of the flash movie is loaded. Shall I PM you the fla and you could meybe take a little look for me? thanks for the help so far

    peace.

  8. #8
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    I'll take a look at it if you want me to...I'm not sure I know exactly what is happening from your description. How large is the swf at this point...is it loading a lot of data? Also, what version of Flash are you using?

  9. #9
    Member
    Join Date
    May 2006
    Location
    UK
    Posts
    92
    Ok thanks I will PM you. Well I am making a preloader to be put onto an swf but the swf hasnt been created yet, I am making the preloader first. I am using Flash 8 Professional.

  10. #10
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    I've replied to your PM...let me know when you get it.

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