目前我有 3 个名为start_btn、about_btn和stats_btn的按钮,它们是movieClips。它们都在一个名为group_btn的容器(也是一个movieClip)中。所以我的问题是我如何告诉确切的元素来改变它的ScaleX和 ScaleY,当我为所有 3 个只使用一个 MouseEventListener 时。我确实认为我必须检测到哪个被点击了,但是之后我不知道该怎么做。所以到目前为止我有这个代码:
private function onAddedToStage(eve:Event):void {
trace("we are good to go");
this.group_btn.start_btn.addEventListener(MouseEvent.MOUSE_OVER, makeButtonBigger)
this.group_btn.start_btn.addEventListener(MouseEvent.MOUSE_OUT, makeButtonSmaller)
this.group_btn.about_btn.addEventListener(MouseEvent.MOUSE_OVER, makeButtonBigger)
this.group_btn.about_btn.addEventListener(MouseEvent.MOUSE_OUT, makeButtonSmaller)
this.group_btn.stats_btn.addEventListener(MouseEvent.MOUSE_OVER, makeButtonBigger)
this.group_btn.start_btn.addEventListener(MouseEvent.MOUSE_OUT, makeButtonSmaller)
}
private function makeButtonBigger(ev:MouseEvent):void{
var nameOfButton:String = ev.currentTarget.name;
//this.group_btn.nameOfButton.scaleX = 1.2 <--- doesnt work
trace(nameOfButton)
}