To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 05-27-2004, 12:57 AM   #1
maydays
Member
 
Join Date: Jan 2004
Posts: 87
preloader script not working in MC

Hi
I have made the next script an put it in the first frame of the stage
it's works fine but if i put it in a MC the progressBar will not work.
Here is the text:
code:
stop();
myInterval = setInterval(preloader,10);
function preloader() {
if (getBytesLoaded() >= getBytesTotal()) {
play();
clearInterval(myInterval);
}
progressBar._xscale = (getBytesLoaded()/getBytesTotal())*100;
}


I have tryed many variation change the play(); with "_root.play",or with "with _root.play..","_root.getbytes..." and so on but i cant make the progressBar work , can someone help me here

Thank you very much..

Last edited by maydays; 05-27-2004 at 01:00 AM.
maydays is offline   Reply With Quote
Old 05-27-2004, 01:01 AM   #2
Adam14
Senior Member
 
Adam14's Avatar
 
Join Date: Feb 2004
Location: Ontario Canada
Posts: 1,116
is the progress bar in the MC or on the stage?

**edit..also, why does it need to be in a MC?
__________________
Adam14 is offline   Reply With Quote
Old 05-28-2004, 02:14 AM   #3
maydays
Member
 
Join Date: Jan 2004
Posts: 87
The progresBar is a MC with 1 frame were the loading line is.
I just wanted to put progressBar mc, the loading text mc and the animation mc in one Mc(preloader) and if i will need a preloading again in another fla i will just copy the preloader mc into the new fla.

Thanks
maydays is offline   Reply With Quote
Old 05-28-2004, 02:22 AM   #4
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
Well, assuming the script is inside an MC, and that_root is the thing you need the preloader for, then:

you'll need to put a stop(); in frame 1 of _root or add this line:

_root.stop();

(the stop() in your script isn't going to stop the main timeline).

you'll need to use _root.play();

and you'll need to use

_root.getBytesLoaded() instead of getBytesLoaded()

and _root.getBytesTotal() instead of getBytesTotal()

in your current example, you have essentially written a preloader for your little preloader MC - anything that needs to refer to _root (or the parent clip) needs to be adjusted.
__________________
jbum is offline   Reply With Quote
Old 05-30-2004, 11:23 PM   #5
maydays
Member
 
Join Date: Jan 2004
Posts: 87
I tryed with _root.play();but not with _root.stop();
Thank you very much for the help, now its working
maydays is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:36 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.