如何使用actionscript 2解决多项选择测验

时间:2012-01-16 12:29:18

标签: flash actionscript actionscript-2

我已经创建了一个多项选择问题。在自定义下拉菜单中有3个选项。每次点击计数为2时,在此下拉菜单中应显示动作2中的正确答案。

var click_count:Number=0;
drop_1_btn.onPress = function()
{
    click_count = click_count + 1;
    gotoAndStop(1);
    an = 1;
    trace(click_count);
};

drop_2_btn.onPress = function()
{
    click_count = click_count + 1;
    gotoAndStop(1);
    an = 2;
    trace(click_count);
};

drop_3_btn.onPress = function()
{
    click_count = click_count + 1;
    gotoAndStop(1);
    an = 3;

    trace(click_count);
};

1 个答案:

答案 0 :(得分:0)

这里我创建了一个名为click_cnt的文本框,并将其alpha设置为0 ..

drop_1_btn.onPress = function()
{
    gotoAndStop(1);
    an = 1;
    drop4_text.text = "1 million";

    var count:Number = parseInt(click_cnt.text);
    count = count + 1;
    click_cnt.text = count;
    if (parseInt(click_cnt.text) == 2)
    {
        _root.tick4.gotoAndStop(4);
        drop4_text.text = "3 million";
    }
    else
    {
        if (parseInt(click_cnt.text) == 1)
        {
            _root.tick4.gotoAndStop(3);
        }
        else
        {
            if (parseInt(click_cnt.text) > 2)
            {
                drop4_text.text = "3 million";
            }
        }
    }
};

drop_2_btn.onPress = function()
{
    drop4_text.text = "2 million";

    gotoAndStop(1);
    an = 2;
    var count:Number = parseInt(click_cnt.text);
    count = count + 1;
    click_cnt.text = count;
    if (parseInt(click_cnt.text) == 2)
    {
        _root.tick4.gotoAndStop(4);
        drop4_text.text = "3 million";
    }
    else
    {
        if (parseInt(click_cnt.text) == 1)
        {
            _root.tick4.gotoAndStop(3);
        }
        else
        {
            if (parseInt(click_cnt.text) > 2)
            {
                drop4_text.text = "3 million";
            }
        }
    }

};

drop_3_btn.onPress = function()
{
    gotoAndStop(1);
    an = 2;
    _root.tick4.gotoAndStop(2);
    drop4_text.text = "3 million";

};