Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-17-2004, 04:40 AM   PM User | #1
Hawkmoon
Regular Coder

 
Join Date: Apr 2004
Location: Los Angeles
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Hawkmoon is an unknown quantity at this point
Flash - Problem with external .swf loader

I have a "loader" movieclip that works great at the beginning of a flash file (see code below) but when I import the published .swf into a parent flash file it only shows up as a blank screen while it loads. Then, once the external .swf is fully loaded, the "loader" appears for a brief second and then the movieclip plays.

I need to get it so the loader inside the external .swf shows up while the .swf is being loaded into the parent file.

Any help is GREATLY appreciated!


Code:
lBytes = _root.getBytesLoaded();
tBytes = _root.getBytesTotal();
percentLoaded = Math.floor((lBytes/tBytes)*100);
loader.bar._xscale = percentLoaded;
loader.percent.text = percentLoaded + "% of " + Math.floor(tBytes/1024) + "K loaded.";
if (lBytes>=tBytes && tBytes>0) {
	if (count>=12) {
		gotoAndStop("intro");
	} else {
		count++;
		gotoAndPlay("preload");
	}
} else {
	gotoAndPlay("preload");
}
Hawkmoon is offline   Reply With Quote
Old 08-17-2004, 04:57 AM   PM User | #2
jamescover
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
jamescover is an unknown quantity at this point
Just a few questions for clarification:

Quote:
lBytes = _root.getBytesLoaded();
I take it, you're trying to preload the main movie???

Quote:
loader.bar._xscale = percentLoaded;
Shouldn't this be:

_root.loader.bar._xscale = etc.

Quote:
if (count>=12)
where is the initial value of count set? In frame 1 of loader MC?

Quote:
gotoAndStop("intro");
gotoAndPlay("preload");
Are these frame labels on the main timeline. If so, this should read:

_root.gotoAndStop("intro"), etc.


-james
__________________
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

Last edited by jamescover; 08-17-2004 at 08:17 AM..
jamescover is offline   Reply With Quote
Old 08-17-2004, 05:11 AM   PM User | #3
Hawkmoon
Regular Coder

 
Join Date: Apr 2004
Location: Los Angeles
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Hawkmoon is an unknown quantity at this point
Thanks James for the quick response! Here are the answers to your questions:

1. Correct
2. "Loader" is a movieclip in the main movie, so it still works, but good point.
3. Count is obsolete...that's legacy code so the following could be reduced to gotoAndStop("intro");
Code:
	if (count>=12) {
		gotoAndStop("intro");
	} else {
		count++;
		gotoAndPlay("preload");
	}
4. Again, because they are labels in the main movie, it still works, but you're right - that's better coding.

This code works fine as a loader for a single .swf. The bigger issue is that it doesn't work as a loader when the publised .swf is imported into a parent .swf

Basically I just need code (this code or anything else) that shows a "loading..." screen for an imported .swf. Right now flash loads the external .swf and then runs the "loading..." screen for half a second. But that doesn't help because the user has had to wait 10-20 seconds for the external .swf to load.

Thanks again for the help!

PS. I like the footnote below your name
Hawkmoon is offline   Reply With Quote
Old 08-18-2004, 07:55 AM   PM User | #4
jamescover
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
jamescover is an unknown quantity at this point
Quote:
Thanks James for the quick response! Here are the answers to your questions:
Sorry, for taking so long to respond. I'm busy with a db project, and I thought/hoped someone else would chime in after you clarified a few things.

Unfortunately, I'm afraid I'm still not following what you are trying to accomplish, or the hierarchy of your movie. I thought you were preloading the main movie, but I don't understand why you would (apparently) load the preloader movie as an external swf. If this is, in fact, what you are doing, I suggest recreating it as an MC or Scene (if you prefer) in the main movie.

Quote:
PS. I like the footnote below your name
That's good news, indeed!



-james
__________________
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

Last edited by jamescover; 08-18-2004 at 08:03 AM..
jamescover is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 +1. The time now is 01:31 PM.


Advertisement
Log in to turn off these ads.