1,新建文件300*200,新建一个按钮
2,把这个按钮拖入到场景中
右击加入as
on(release){
 _root.createTextField("newtext",50,30,80,300,100);//创建textfield对象
 newtext.text="这是一个动态生成的\n文本框!";//文本内容
 newtext.textcolor=0x999999;
 var txtformat=new TextFormat();//建立textformat实体
 txtformat.font="宋体";
 txtformat.size=15;
 txtformat.color=0xFF0000;
 txtformat.bold=true;
 newtext.setTextFormat(4,6,txtformat);//设置textfield对象的样式,从第四个字符串完后开始至第六个字符串截止的样式
}

 一个小小的动态文本框就这样生成了

fla源文件下载.fla

posted on 2006-08-08 12:28  榻榻米  阅读(359)  评论(0编辑  收藏  举报