[AS3]as3用代码绘一个实际的按钮源代码实例
[AS3]as3用代码绘一个实际的按钮源代码实例
[AS3]as3用代码绘一个实际的按钮源代码实例
- package
- {
- import flash.display.SimpleButton;
- import flash.display.Sprite;
- import flash.events.MouseEvent;
- import flash.text.TextField;
- public class Main extends Sprite
- {
- public function Main():void
- {
- init();
- }
- private function init():void
- {
- var a:Sprite = new Sprite(); //CuPlayer.com按钮抬起时显示状态
- huitu(a,0x00ff00);
- var b:Sprite = new Sprite(); //CuPlayer.com放到按钮上显示状态
- huitu(b,0xff0000);
- var c:Sprite = new Sprite(); //按下按钮显示状态
- huitu(c,0x0000ff);
- //CuPlayer.com创建按钮对象
- var abc:SimpleButton = new SimpleButton(a,b,c,c);
- abcabc.x = abc.y = 50;
- this.addChild(abc);
- abc.addEventListener(MouseEvent.CLICK, abcclick);
- }
- private function abcclick(evt:MouseEvent):void
- {
- trace(evt.target.data);
- }
- //CuPlayer.com统一调用的绘图按钮方法
- private function huitu(obj:Sprite, col:uint):void
- {
- obj.graphics.beginFill(col);
- obj.graphics.drawRect(0,0,100,100);
- obj.graphics.endFill();
- }
- }
- }
热门文章推荐
- [rtmp]流媒体协议RTMP,RTSP与HLS有什么不同?
- [Wowza]流媒体服务器Wowza Media Server的安装与启动教程
- [wowza]wowza推流发布和播放(推流RTMP流)介绍
- [wowza]Wowza Streaming Engine 4的安装与配置教程
- [wowza]Wowza Media Server 安装教程(含windows/Linux平台)
- [wowza]RTP直播流推送到另一个远端的服务器
- [AS3]Wowza Media Server服务器
- [wowza]wowza推RTSP流要求用户名密码
请稍候...