Skip to main content
March 6, 2009
Question

Problem communicating to nested clips

  • March 6, 2009
  • 2 replies
  • 269 views
I am an occasional flash user trying to segue from ActionScript 2 to AS3. I am still using AS2, but am trying to keep all my scripts in one place to prepare myself for AS3. I am having a struggle figuring out how to communicate to nested movie clips from the root timeline.

The root timeline has only one frame. There is a movieclip on the root frame that has a button that doesn't appear (instantiate) until frame 20 of the movieclip.

On the root timeline I have a function call to the nested button (see code below). It doesn't work. I've given the button instance the name "print_btn". Since the button doesn't appear until later in the timeline, I've given the button a Linkage Identifier of "print_btn", and exported it for ActionScript in the first frame. I've also tried changing the function path to _root.btnPortfolio_mc.print_btn.onPress. The only way I can get it to work is to move the function to the the frame on the nested clip's timeline where the button is instantiated.

I thought that setting the linkage to export for ActionScript would enable me to communicate to an instance on a nested clip that isn't instantiated until later. What am I doing wrong?
This topic has been closed for replies.

2 replies

Inspiring
March 7, 2009
You could simply instantiate the button clip in frame 1 and have it sit off
stage until frame 20. FWIW I think onRelease makes more a more pleasant
button as well.

--
Dave -
www.offroadfire.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Ned Murphy
Legend
March 6, 2009
You pretty much answered this for yourself... "The only way I can get it to work is to move the function to the the frame on the nested clip's timeline where the button is instantiated."

You might be able to create a special class for this button that has its function specifically defined for it, and instantiate it at frame 20, but you'll probably save time just assigning the code where the button exists.