更改动态文本字段问题的颜色

时间:2009-03-25 08:48:11

标签: flash actionscript function actionscript-2 textfield

我有这个代码,当我翻转链接动画片段时,应该更改动态文本字段的颜色,然后在我推出时返回。我没有编译器错误,它只是不起作用。

function textColor(mc_function:MovieClip, tf_text:TextField) {
mc_function.onRollOver = function() {
    tf_text.textColor = 0x7cb0b7; 
};
mc_function.onRollOut = function() {
    tf_text.textColor = 0xffffff; 
};
}

boxLink(link_a1,text_a1);
boxLink(link_a2,text_a2);
boxLink(link_a3,text_a3);

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

试试这个:

function SetMouseAction(pMovieClip, pTextField):Void {
    pMovieClip.linkedText = pTextField;
    pMovieClip.onRollOver = function() {
            this.linkedText.textColor = 0x7cb0b7; 
    };
    pMovieClip.onRollOut = function() {
            this.linkedText.textColor = 0xffffff; 
    };
}

SetMouseAction(link_a1, text_a1);
SetMouseAction(link_a2, text_a2);
SetMouseAction(link_a3, text_a3);

至少我测试了它,它适用于我