如何有AS纯代码来定义动态文本框的字体颜色和加粗

      Flash学习 2006-9-17 0:28
actionscript
如何有AS纯代码来定义动态文本框的字体颜色和加粗
space.flash8.net/bbs/viewthread.php?tid=305501&pid=1888626&page=1&extra=page%3D2#pid1888626
--------我的回答-----------


Flash 动画

-------------------
var fmt:TextFormat = new TextFormat();
fmt.bold = ture;
fmt.color = 0xff0000;
var a:MovieClip=_root.createEmptyMovieClip("a",1);
a._x=a._y=10;
var t0:MovieClip=a.createEmptyMovieClip("t0_mc",2);
var ta:MovieClip=a.createEmptyMovieClip("t1_mc",0);
var tb:MovieClip=a.createEmptyMovieClip("t2_mc",1);
var t00:TextField=t0.createTextField("t",0,0,0,350,22);
var t1:TextField=ta.createTextField("t",0,0,0,50,22);
var t2:TextField=tb.createTextField("t",0,0,0,50,22);
t00.text="如何有AS纯代码来定义动态文本框的字体颜色和加粗";
t1.text="点我啊";
t2.text="到你啦";
t1._x=50,
t2._x=100;
t1._y=t2._y=50;
function cl(){
  var fmt = new TextFormat();
  fmt.bold = false;
  fmt.color =0;
  for(var k in a){a[k].t.setTextFormat(fmt);}
  }
t0.onPress=function(){
  cl();
  fmt.bold = true;
  fmt.color=0x00ff00;
  this.t.setTextFormat(fmt);
  getURL("http://yuheduo.5dblog.com");
  };
ta.onPress=function(){
  cl();
  fmt.bold = true;
  fmt.color=0x00ff00;
  this.t.setTextFormat(fmt);
  };
tb.onPress=function(){
  cl();
  fmt.bold = true;
  fmt.color=0x00ff00;
  this.t.setTextFormat(fmt);
  };
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}