Just go through your code again and identified the problem. You should
get "undefined" in the 2nd lot of traces. Because your "l2Product_mc" is
created ONLY when l1_mc.product_btn is pressed. However,
"this.l2Product_mc.mens_btn.onPress = function():Void " established
before  "l2Product_mc" is created.  "l2Product_mc" will never be
registered to that onPress event.

You should establish the event right after attaching it.

[...]   Sam Liu
Flash Developer - Languages Online
Office of Learning and Teaching
Department of Education and Training
 

T:  (03) 9637 2102    F:  (03) 9637 2060

 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of lists
Sent: Wednesday, 26 October 2005 9:10 AM
To: Flashcoders mailing list
Subject: [Flashcoders] targets driving me insane


Hi there - I am about to go crazy here.... I am trying to target a
button in a dynamic MC (attached from the Library). Each movie clip in
the library already has the required buttons with an instance name.

I have a MC on my main timeline called "menu_mc".
Now in the timeline of "menu_mc" I have the following code:

//l2
this.l1_mc.product_btn.onPress = function():Void  {
        _parent.menu_mc.attachMovie("level2McProduct", "l2Product_mc",
12);
        _parent.menu_mc.l2Product_mc._x = 73.7;
        new Tween(_parent.menu_mc.l2Product_mc, "_alpha",
Strong.easeOut, 0, 100, 3, true);
        new Tween(_parent.menu_mc.l2Product_mc, "_y", Strong.easeOut,
106, 0, 1, true); }; //l3 this.l2Product_mc.mens_btn.onPress =
function():Void  {
        trace(_parent);
        _parent.menu_mc.attachMovie("level3McMens", "l3Mens_mc", 13);
        _parent.menu_mc.l3Mens_mc._x = 189.5;
        new Tween(_parent.menu_mc.l3Mens_mc, "_alpha", Strong.easeOut,
0, 100, 3, true);
        new Tween(_parent.menu_mc.l3Mens_mc, "_y", Strong.easeOut, 106,
0, 1, true); };

the "l1_mc" was created with attachMovie earlier in the code, but is
trimmed from here to save room (it functions as it should). The
following:

this.l1_mc.product_btn.onPress = function():Void

also works as it should. Now the results of that are another MC attached
to the timeline of the "menu_mc" instance. This all works, and my
tweens, etc all work as expected. Now for some reason when I drill down
one level deeper:

this.l2Product_mc.mens_btn.onPress = function():Void

the code stops working. I stuck a "trace" in there to see if the button
event was even responding. Which it is not! I double, triple checked the
button instance name and the so on... but it just never works. As you
can see I had modified my path to use the previously attached MC. I even
tried putting in the moviclip by hand and browsed to find the path (to
make sure I had no mistakes)- and it appears I do not.

I am at wits end here and going insane. Does anyone have any
suggestions? Am I missing something? Is there a limitation in flash that
I do not know about?

::::::::::::::::::::::
 Dustin
::::::::::::::::::::::

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Important - 
This email and any attachments may be confidential. If received in error, 
please contact us and delete all copies. Before opening or using attachments 
check them for viruses and defects. Regardless of any loss, damage or 
consequence, whether caused by the negligence of the sender or not, resulting 
directly or indirectly from the use of any attached files our liability is 
limited to resupplying any affected attachments. Any representations or 
opinions expressed are those of the individual sender, and not necessarily 
those of the Department of Education & Training.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to