Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem: Can't access movieclip in a button

Member
 
Join Date: Jan 2008
Posts: 113
#1: Feb 2 '09
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:
Expand|Select|Wrap|Line Numbers
  1. my_button.onRollOver = function() {
  2.  
  3.     trace(this.my_movie);
  4.  
  5. }
  6.  
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's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#2: Feb 14 '09

re: Problem: Can't access movieclip in a button


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.
Reply


Similar Flash / Actionscript bytes