SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Oakley CA, USA
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I need to make a preloader in mx?

    Can anyone help me make a preloader in Flash Mx. even a tutorial would be good but i cannot find one for flash 6. Please help or tell me just so i could get my foot in the door.

    Thanks in advance to everyone

  2. #2
    SitePoint Wizard aaron.martone's Avatar
    Join Date
    Feb 2003
    Location
    Florida, USA
    Posts
    2,322
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I can give you the basics, if you have the knowledge of Flash MX AS and its GUI.

    Basically, there are 2 main system variables you want to mess with getBytesLoaded() and getBytesTotal(). You can reference them by _root. when needed.

    Also, you want to scale an image (x-axis) depending on the percent complete, right? As well as place dynamic textbox on the stage that shows the percent loaded.

    textbox - instance name of txtPercentLoaded
    loading bar - intance name opf imgLoadBar

    on Frame 1 add a keyframe with the following AS

    Code:
    infoLoaded = _root.getBytesLoaded();
    infoTotal = _root.getBytesTotal();
     
    percentLoaded = Math.round(infoLoaded / infoTotal);
     
    _root.imgLoadBar._xscale = percentLoaded;
    _root.txtPercentLoaded.text = percentLoaded + " %";
     
    if (percentLoaded >= 100) {
       _root.gotoAndPlay(10);
    else {
       _root.gotoAndPlay(1);
    }
    BTW, frame 10 is where you start the movie (ie, fade your image load bar and textbox away and get with the program, cause everything is loaded

    So basically, we

    1. Create variables to hold the bytesLoaded and totalBytes of the movie.

    2. Find the actual percent loaded and place it into a variable by divinding bytesLoaded by totalBytes

    3. Scale the image bar via the percent loaded (note that xscale = 0 is nothing, xscale = 100 is the image and xscale = -100 is the image, inverted horizontally.

    4. Make the text box say what percent is loaded and then tack on a "%" on the end so it says "4%", "23%" "100%"

    5. Check to see if percentloaded is 100, if so, goto starting movie, if not goto the frame that rechecks all this again (frame 1)

    Hope that helps

  3. #3
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Oakley CA, USA
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright thanks man I'll check this out tonight


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •