AS2:如何交换Shape和TextField的深度?

时间:2014-06-27 03:25:58

标签: actionscript-2

AS2

this.createTextField("lbl_txt", this.getNextHighestDepth(), 70, 5, 150, 30)
lbl_txt.autoSize = true;
lbl_txt.text = "Hello";

var fmt:TextFormat = new TextFormat();
fmt.bold = true;
fmt.color = 0x000000;
fmt.underline = true;
fmt.font = "Arial";
lbl_txt.setTextFormat(fmt);


时间轴图层
行动
button_layer(button_layer是rollOver上的动画)
箭头
背景

期望的结果
button_layer和动作是最顶层和光标保持指针而不是切换到rollOver上的文本光标。

行动
button_layer
箭头
lbl_txt(由AS创建的TextField)
背景

1 个答案:

答案 0 :(得分:0)

var textdepth = this.getNextHighestDepth();

//store the depth value somewhere

this.createTextField("lbl_txt", , 70, 5, 150, 30)
lbl_txt.autoSize = true;
lbl_txt.text = "Hello";

var fmt:TextFormat = new TextFormat();
fmt.bold = true;
fmt.color = 0x000000;
fmt.underline = true;
fmt.font = "Arial";
lbl_txt.setTextFormat(fmt);

//now lastly swap it
myMovieClip.swapDepths(textdepth);

注意:swapee应该是一个movieclip或一个按钮。