开发者

Newbie question: Stop() hide EnventListener

开发者 https://www.devze.com 2023-02-17 18:42 出处:网络
That seems a very simple question but I don\'t found anything on internet (or I don\'t enter the good words on google).

That seems a very simple question but I don't found anything on internet (or I don't enter the good words on google).

I try to implement a gallery of image with two buttons on each side of the picture to go to the next or the previous image. Very simple!

This is my code:

leftButton.addEventListener(MouseEvent.CLICK, ButtonLeftHandler);
rightButton.addEventListener(MouseEvent.CLICK, ButtonRightHandler);

function ButtonLeftHandler(event:MouseEvent):void {
    trace("Mouse Button Left开发者_StackOverflow clicked");
    picIndex--;
    uiLoader.source = picIndex + ".jpg"; 
    gotoAndPlay(23);
} 

function ButtonRightHandler(event:MouseEvent):void {
    trace("Mouse Button Right clicked");
    picIndex++;
    uiLoader.source = picIndex + ".jpg"; 
    gotoAndPlay(23);
} 

stop();
trace("Sequence Stopped"); 

uiLoader and picIndex are defined in a earlier frame..

On my output, I get

Sequence Stopped

When I clicked on a button. I don't get the trace message "Mouse button left..." My sequence is blocked.

Why ?!

Thank you


Your buttons have to have the instance names you're using (leftButton and rightButton) assigned in the Properties panel. They also have to be available (on Stage) on the frame that is running this code.


Ok the problem was I have a layer just in top of my button and it's hiding the button

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号