Problem: Can't access movieclip in a button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chromis
    New Member
    • Jan 2008
    • 113

    #1

    Problem: Can't access movieclip in a button

    Hi,

    This should be really simple to do and has really got me stumped. I have a movieclip inside a button, the button is called my_btn and the movieclip is called my_movie. What i want to happen is the movieclip goes to frame two when the button is rolled over, so i added this code to test the reference to the button:
    Code:
    my_button.onRollOver = function() {
      
        trace(this.my_movie);
    
    }
    It comes back as undefined, even tho the movieclip instance is correctly named on all frames of the button.

    I have decided to create a movieclip that behaves like a button instead, but would like to know why this happens?

    Thanks,

    Chromis
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Have you tried taking away the this reference? A movie clip inside a button doesn't sound right to me..

    When you say this, it is trying to reference part of the my_button instance, and if it's returning undefined, the property, method or whatever isn't set.

    Comment

    Working...