Actionscript 3 如何将按钮与图像匹配?

Actionscript 3 如何将按钮与图像匹配?,actionscript-3,button,random,click,mouseevent,Actionscript 3,Button,Random,Click,Mouseevent,我正在创建一个图像匹配程序,在顶部随机显示一个图像。用户需要从选项列表中选择一个匹配的图像,匹配好的图像会显示一条消息,匹配不好的图像会结束游戏 如何确定Elegir1按钮是否与persoanje 1匹配 屏幕截图: DiabloB.addEventListener(MouseEvent.CLICK,Elegir1) this.addEventListener(Event.ENTER_FRAME, Caida) function Caida(e: Event) { T++ if

我正在创建一个图像匹配程序,在顶部随机显示一个图像。用户需要从选项列表中选择一个匹配的图像,匹配好的图像会显示一条消息,匹配不好的图像会结束游戏

如何确定
Elegir1
按钮是否与
persoanje 1
匹配

屏幕截图:

DiabloB.addEventListener(MouseEvent.CLICK,Elegir1)
this.addEventListener(Event.ENTER_FRAME, Caida)

function Caida(e: Event) {
    T++
    if (T == 10) {
        T = (Math.random() * 4 + 1)

        //this is the random IMG "Personaje 1, Personaje 2 , Personaje 3 , Personaje 4"
        refClass = getDefinitionByName("Personaje " + T) as Class;
        ref = new refClass()
        ref.y = -250
        addChild(ref)
        T = -500
        enemigos.push(ref)
        trace(enemigos.length)
        setTimeout(function () {
            removeChild(ref);
        }, 20500);
    }
}

// this is the button 
function Elegir1(e: MouseEvent) {

}

代码:

DiabloB.addEventListener(MouseEvent.CLICK,Elegir1)
this.addEventListener(Event.ENTER_FRAME, Caida)

function Caida(e: Event) {
    T++
    if (T == 10) {
        T = (Math.random() * 4 + 1)

        //this is the random IMG "Personaje 1, Personaje 2 , Personaje 3 , Personaje 4"
        refClass = getDefinitionByName("Personaje " + T) as Class;
        ref = new refClass()
        ref.y = -250
        addChild(ref)
        T = -500
        enemigos.push(ref)
        trace(enemigos.length)
        setTimeout(function () {
            removeChild(ref);
        }, 20500);
    }
}

// this is the button 
function Elegir1(e: MouseEvent) {

}

允许您访问。目标是一个带有一个。在比较两者的位置创建条件单击。然后,为每个结果运行各自的函数

英语似乎不是作者的母语。清理了代码的格式,嵌入了共享的图像,并为问题添加了描述性语言(从标题中删除)。还增加了一个更简洁的标题。