如何在这个函数上写

时间:2014-04-10 14:07:27

标签: actionscript-3 flash actionscript

如果dz_mc然后文本是dz2_mc文本更改为另一个文件时如何写入。这是可能的还是我必须寻找另一个解决方案......

function (event:Event){
dz_mc.hitTestPoint(Star.x, Star.y, true)) {
       deepText.text = "Dziļums no 0,5m - 1m";
dz2_mc.hitTestPoint(Star.x, Star.y, true)) {
       deepText.text = "Dziļums no 1m - 2m";
dz3_mc.hitTestPoint(Star.x, Star.y, true)) {
       deepText.text = "Dziļums no 2m - 2,5m";
}
}

1 个答案:

答案 0 :(得分:1)

尝试:

function (event:Event){

    var output:String = "";

    if(dz_mc.hitTestPoint(Star.x, Star.y, true)) {
        output = "Dziļums no 0,5m - 1m";
    } else if( dz2_mc.hitTestPoint(Star.x, Star.y, true)) {
        output = "Dziļums no 1m - 2m";
    } else if (dz3_mc.hitTestPoint(Star.x, Star.y, true)) {
        output = "Dziļums no 2m - 2,5m";
    }

    deepText.text = output;
}