all groups > flash actionscript > september 2004 >
You're in the

flash actionscript

group:

check if SWF is loaded


check if SWF is loaded modino
9/22/2004 9:42:42 PM
flash actionscript:
Does anyone know the actionscript "if" statement to see if a SWF is loaded so
when you press the button it doesn't load again from the begining if it's
loaded, but just plays ?

And can you "park" an SWF ? thanks, dean
Re: check if SWF is loaded VisionaryStudios
9/22/2004 11:19:37 PM
where are you loading the swf? If you load it into a movieClip you can check
if it exists by doing

if(movieClip == undefined){ < this is not loaded > } else { < this is >
}

Originally posted by: modino
Does anyone know the actionscript "if" statement to see if a SWF is loaded so
when you press the button it doesn't load again from the begining if it's
loaded, but just plays ?



stop();

And can you "park" an SWF ? thanks, dean


Re: check if SWF is loaded Patrick Bay
9/23/2004 2:13:36 PM
Hi,

Actually, even attachMovie requires time for instantiation. I've run
into a number of instances where I had to allow a frame to elapse before
I was able to work with the attached movie. It's better practice to check.

Regards,
Patrick

-----------------------------------------------------
www.baynewmedia.com

IRC (www.dal.net) -> #baynewmedia
-----------------------------------------------------



[quoted text, click to view]
Re: check if SWF is loaded modino
9/23/2004 3:26:16 PM
Re: check if SWF is loaded VisionaryStudios
9/23/2004 3:43:41 PM
Re: check if SWF is loaded kglad
9/23/2004 4:12:23 PM
how can that code work? you're checking to see if the target exists, you're
not checking to see if anything is loading or has loaded into the target.

you'll need to use preloader code of some type to check if loading is
completed no matter where the swf is being retrieved.
Re: check if SWF is loaded VisionaryStudios
9/23/2004 5:25:32 PM
Yes kglad,

You are exactly right. That works on an "attached" movie not a loadMovie. If
you use attachMovie(); then test for undefined that will tell you if you have
attached the movie.

For loadMovie you do need to test the bytesLoaded() of the movieClip.
Re: check if SWF is loaded kglad
9/23/2004 6:09:54 PM
yes, that would work to test to see if any movieclip has been instantiated. i
can't think of any situations where you need to check if an attachMovie() has
been instantitated, though. every situation i can think of has a more direct
way of determing what's been attached.
Re: check if SWF is loaded VisionaryStudios
9/23/2004 6:27:23 PM
Re: check if SWF is loaded kglad
9/24/2004 2:09:41 AM
Re: check if SWF is loaded VisionaryStudios
9/24/2004 2:18:12 AM
Are you talking to me?

a movieclip will instantiate when an attachMovie() is used.....

if(mc.attachedMC == undefined) { // then the movie has not yet been
attached
mc.attachMovie("attachedMC",aDepth);
} else { // has been attached
// ignore the call to attachMovie
}

Does that answer any questions as to what I was talking about?
AddThis Social Bookmark Button