Skip navigation
piggysmile
Currently Being Moderated

How do you access a child element in Actionscript 2?

Jul 18, 2012 6:38 AM

Tags: #movieclip #actionscript_2

I have the following Flash structure.

 

Main Timeline

---test_menu (Movie Clip)

------test_menu_sub (Movie Clip)

---------submenu_item (Button)

 

On Main Timeline (2nd frame), I added this code:

 

 

test_menu.test_menu_sub.submenu_item.onPress = function () {

      trace("clicked");

}

 

 

However, this doesn't work. Please see the following files for reference. Any help will be appreciated.

 

 
Replies
  • kglad
    63,058 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 18, 2012 7:03 AM   in reply to piggysmile

    if that code doesn't work, you probably have an incorrect path/name.  to test if that is the issue, use:

     

    trace(test_menu.test_menu_sub.submenu_item)

     

    to see is the movieclip is found.  if not, you have an incorrect path/name.  if it is, you are not clicking that button.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 7:08 AM   in reply to piggysmile

    Change your textfields to be non-selectable and see if that helps.  HAving them selectable can block interaction.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 3:22 PM   in reply to piggysmile

    No, non-selectable means setting it to be non-selectable in the Properties panel.  If you see the i-beam when you hover over the textfield, its text is selectable

     
    |
    Mark as:
  • kglad
    63,058 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 18, 2012 3:39 PM   in reply to piggysmile

    then you're not clicking that button.  there are a number of ways that can happen some of which are subtle like when you use timeline tweens.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points