Groups | Blog | Home
all groups > flash actionscript > march 2006 >

flash actionscript : How to Access an Instance on a Loaded Movie Clip (SWF)?


E11
3/18/2006 10:00:52 PM
Hi all,

- I have one movie clip, "flashMovie2.swf", and on this movie clip
(stage), i have an instance of a button called "btnOK".

- My main movie clip is "flashMovie1.swf", and in its library, i have a
movie clip called "FlashMovie2". The linkages properties have been
appropriately set.

In the actionscript for flashMovie1.swf, i have the following:

[code]
attachMovie("FlashMovie2", "mcFlashMovie2", 5);
_root["mcFlashMovie2"].loadMovie("flashMovie2.swf");

_root.mcFlashMovie2.btnOK.onPress = function()
{
trace("OK pressed"); // Only for testing purpose
}
[/code]

When i tested the main flash movie (flashMovie1.swf), i can see the
second flash movie "flashMovie2.swf" playing inside. But when i click
on the button ("btnOK") inside the second flash movie, nothing happens
(i didn't get the intended trace message).

What step(s) might i be missing here?



TIA and Regards,
Edwin
E11
3/19/2006 8:02:12 AM
Any suggestion anyone? Or am i doing this the wrong way?



Thanks and Regards,
Edwin
AddThis Social Bookmark Button