SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Apr 10, 2003, 22:18 #1
- 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
-
Apr 11, 2003, 07:45 #2
- 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); }
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
-
Apr 11, 2003, 08:27 #3
- 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