Saturday, March 27, 2010

Loaded .swf comunication with loader...

Hi, everyone!

I have a big problem...

I`ve loaded a .swf file using a 'flash.display.Loader'. The
.swf contains a button. When the user clicks the button, I want the
loader .swf to execute a certain function that I defined within it.

In AS2, I would have accomplished this by means of
'_level0.functionName();'. In AS3, however, I can`t fiind a way to
comunicate with the parent .swf....

Please help me!

Thank you!Loaded .swf comunication with loader...
you can reference the main timeline from any display object
(probably your loaded swf's parent loader) by using the display
object's root property. to reference a function on the main
timeline, cast that root property as a movieclip and use dot
notation just like as2.Loaded .swf comunication with loader...
Thanks, kglad!

I`ve already tryed just that, but my application is a little
bit more complicated than I mentioned above and when I got errors I
thought it wasn`t the way to go. Now at least I know where to start
from.

Thanks again!
Ok, so I`ve actually made some progress! I`m getting new
errors.

The error says: ''TypeError: Error #1006: initPasswordInput is
not a function.

at intro6_fla::KnockArtLogoAnimation6_7/onRollOver2()'',
where
initPasswordInput() is the function on the loader .swf

What`s that supposed to mean? I`ve defenetly defined the
function.

PS: I`m using a document class for the loader swf, but I`ve
tryed a simpler example and it tells me the same thing...
you're welcome.



your code in the external swf must be on some movieclip's
timeline. and that movieclip must be in the display list (ie,
on-stage) for its code to execute.



so, from any timeline in your external swf, you can use
this.root to get to the external swf's main timeline. then the
parent of that external swf main timeline will be your loader (in
the loading swf). and the root property of that loader will be the
loading swf's main timeline. so, you can always use:




Thanks a milion, kglad!


you're welcome.

No comments:

Post a Comment