用flash cs4 as 绘制图形、 绘制文本 、创建超链接文本
发布时间:2020-12-15 06:13:23 所属栏目:百科 来源:网络整理
导读:this.graphics.lineStyle(2,0x274E9A) this.graphics.moveTo(150,250) //起始点this.graphics.lineTo(200,300); //终止点this.graphics.curveTo(200,300,250,250)//曲线 this.graphics.lineTo(300,200)this.graphics.drawRoundRect(40,40,320,270,25,25) //
this.graphics.lineStyle(2,0x274E9A) this.graphics.moveTo(150,250) //起始点 this.graphics.lineTo(200,300); //终止点 this.graphics.curveTo(200,300,250,250)//曲线 this.graphics.lineTo(300,200) this.graphics.drawRoundRect(40,40,320,270,25,25) //圆角矩形 矩形的基础上再增加圆角的宽度和高度两个参数即可 this.graphics.beginFill(0x6600cc) //beginFill填充颜色 this.graphics.drawEllipse(180,150,70) // 椭圆 确定椭圆注册点左上角的坐标,椭圆的宽度和高度 this.graphics.endFill() //并用 endFill 来结束填充 this.graphics.drawCircle(150,100,20) //圆形 需要中心点坐标和半径 ?绘制文本 //在舞台上生成一个文本 var myText:TextField=new TextField() myText.text="SUNNY sunshine" addChild(myText) //设置文本域坐标的位置 myText.x=50 myText.y=50 //设置文本域的宽高 myText.width=200 myText.height=30 //设置文本域的边框 myText.border=true //设置文本域不可选状态 myText.selectable=false //创建文本格式对象设置文本内的字体,大小以及样式等,你还可以用一行代码来创式 var myFormat:TextFormat=new TextFormat("Arial",24,0x000000,true) var myFormat:TextFormat=new TextFormat() myFormat.font="Arial" myFormat.size=24 myFormat.bold=true //可以用 setTextFormat 和 defaultTextStyle 两种方法来应用设置好的文本。 //myText.defaultTextFormat=myFormat myText.setTextFormat(myFormat) ???? 我们在看一下创建文本格式的两种用法的区别,对于上面的代码,我们可以把它 ? ?创建超链接文本 var myStyleSheet:StyleSheet=new StyleSheet() myStyleSheet.setStyle("A",{textDecoration:"underline",color:"#0000ff"}) var myWebLink:TextField=new TextField() myWebLink.width=300 myWebLink.styleSheet=myStyleSheet myWebLink.htmlText="点击后面链接访问我的博客<A HREF='http://blog.csdn.net/meetlunay/article/details/7441016'>MeetLunay专栏</A>" addChild(myWebLink) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |