Skip to main content
Participant
May 22, 2008
Question

Cannot access button instance

  • May 22, 2008
  • 4 replies
  • 315 views
I am new to flash. I created a movie clip symbol. I instantiated the movie clip and placed a "play" button on it. I have instantiated the button as playBtn but I cannot access it from AS3. I get the error "Access of undefined property playBtn". Can someone help me?
This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
May 23, 2008
stopping the timeline isn't likely to stop the sound unless you have they sync property assigned correctly and your sound is attached to the timeline.
kglad
Community Expert
Community Expert
May 22, 2008
are you seeing your trace output?
oloskoAuthor
Participant
May 22, 2008
Yes, I see my trace output. I uploaded a sound file in a different layer and I want to use the movie clip's button to stop the sound.
oloskoAuthor
Participant
May 22, 2008
Thanks, that got rid of the error message but I cannot the stop the movie clip.My code is below

myMovieClip.playBtn.addEventListener(MouseEvent.CLICK,stopPlayer);
function stopPlayer(event:MouseEvent):void{
trace("Function was called");
myMovieClip.stop();
}
kglad
Community Expert
Community Expert
May 22, 2008
if you did all that in the authoring environment and your movieclip's instance name is mc and you're coding on the same timeline as mc, try:

mc.playBtn

to reference your button.