Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 我如何知道在Flash中单击了哪个按钮_Actionscript 3_Flash_Flash Cs6 - Fatal编程技术网

Actionscript 3 我如何知道在Flash中单击了哪个按钮

Actionscript 3 我如何知道在Flash中单击了哪个按钮,actionscript-3,flash,flash-cs6,Actionscript 3,Flash,Flash Cs6,我正在用Flash CS6制作一个简单的游戏 共有3层: 行动 第一层 第二层 在第1层中,有3个按钮: 按钮1、按钮2和按钮3 每个按钮都会将您发送到第2层的第5帧。例如,还有另一个按钮,前进按钮 我如何知道第5帧上单击了哪个按钮?如何通过单击“前进”按钮使其转到不同的帧,具体取决于是来自按钮1、2还是3。对于使用单击事件转到不同帧的函数,只需在函数定义中添加条件: if (event.target == btn_1) //btn_1 is the instance name of but

我正在用Flash CS6制作一个简单的游戏

共有3层:

  • 行动
  • 第一层
  • 第二层
  • 在第1层中,有3个按钮:

    • 按钮1、按钮2和按钮3
    每个按钮都会将您发送到第2层的第5帧。例如,还有另一个按钮,前进按钮


    我如何知道第5帧上单击了哪个按钮?如何通过单击“前进”按钮使其转到不同的帧,具体取决于是来自按钮1、2还是3。

    对于使用
    单击
    事件转到不同帧的
    函数,只需在函数定义中添加条件:

    if (event.target == btn_1) //btn_1 is the instance name of button 1
      { //add whatever you want to do with it
      } 
    else if (event.target == btn_2) // btn_2 is the instance name of button 2
      {
      }
    
    添加任意数量的条件。

    问题已解决

    加:

    var-bt:int=0

    在每个按钮功能中,ad bt=1、bt=2和bt=3

    然后在其他按钮功能中添加:

    如果bt=1 gotoAndStop(5),如果bt=2 gotoAndStop(6),如果bt=3 gotoAndStop(7)


    谢谢:)

    请更新您的问题,以显示您当前用于单击的代码。