Jump to content


Photo

button inside movieclip / actionscript 3.0


  • Please log in to reply
1 reply to this topic

#1 crea

crea

    Young Padawan

  • Members
  • Pip
  • 2 posts
  • Location:Australia

Posted 23 April 2009 - 11:09 PM

(Adobe Flash CS3, Actionscript 3.0)

Hi,

I am a pretty new to AS3 so I'm sorry if this seems like a simple question...

In the process of converting from AS2 to AS3, I am stuck on a problem with buttons that are inside a movieclip. They just don't seem to be 'listening':

I have a movie clip on the stage, and inside the movie clip are some buttons.
The reason I put the buttons inside the movie clip is that I am zoom in and out the movie clip from the main timeline (and this worked fine with as2).

Now, on the main stage, if I had this piece of code, I get the button and it works,

//-------- Testing button -----\\
var testbtn0:testSquareBtn = new testSquareBtn();
addChild(testbtn0);
testbtn0.buttonMode = true;
testbtn0.addEventListener(MouseEvent.CLICK, sayHi);
function sayHi(event:MouseEvent):void{
trace ("HI");
}

But if I copy this to an action layer inside the movieclip on stage, something is wrong because the button doesn't react and the cursor doesn't change...

What am I missing ??? :angrylooking:

Any help appreciated !

#2 crea

crea

    Young Padawan

  • Members
  • Pip
  • 2 posts
  • Location:Australia

Posted 26 April 2009 - 09:16 PM

Well the problem seems to be solved actually...
Though I'm not really understanding why, reordering my layers did the job...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users