FLASH AS3全屏类
2009-01-04 19:17:36 来源:WEB开发网核心提示:代码:package { import Flash.display.MovieClip; import flash.display.SPRite; import flash.events.MouseEvent; import flash.text.TextField; import flash.text.TextFie
代码:
package {
import Flash.display.MovieClip;
import flash.display.SPRite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class fullbotton extends MovieClip {
public function fullbotton(b_width:int,b_height:int,f_size:int) {
var _Rect:Sprite = new Sprite();
_Rect.graphics.beginFill(0xff0000,1);
_Rect.graphics.drawRect(0, 0, b_width,b_height);
_Rect.graphics.endFill();
addChild(_Rect);
_Rect.buttonMode=true;
var t:TextField = new TextField();
t.htmlText="<FONT SIZE=’"+f_size+"’ color=’#ffff00’ ><b>点击此处切换观看模式(全屏/普通)</b></font>";
t.autoSize=TextFieldAutoSize.LEFT;
t.x=30;
t.y=2;
_Rect.addChild(t);
var _Rect1:Sprite = new Sprite();
_Rect1.graphics.beginFill(0x000000,0);
_Rect1.graphics.drawRect(0, 0, b_width,b_height);
_Rect1.graphics.endFill();
_Rect.addChild(_Rect1);
_Rect.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(event:MouseEvent):void {
switch (stage.displayState) {
case "normal" :
stage.displayState="fullScreen";
break;
case "fullScreen" :
default :
stage.displayState="normal";
break;
}
}
}
}使用:
var my_btn:fullbotton=new fullbotton(100,50,12);
addChild(my_btn);
在HTML中使用方法(感谢KAKA):
function cl(evt:MouseEvent):void {
stage.displayState=StageDisplayState.FULL_SCREEN;
}
my_btn.addEventListener(MouseEvent.CLICK,cl);
然后HTML标签中修改一下:
要在标签中加入allowFullScreen="true"
演示:
http://www.taoshaw.com/taoshaw/study/as3fullscreen/method2.html
源码下载:fullscreen.rar
package {
import Flash.display.MovieClip;
import flash.display.SPRite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class fullbotton extends MovieClip {
public function fullbotton(b_width:int,b_height:int,f_size:int) {
var _Rect:Sprite = new Sprite();
_Rect.graphics.beginFill(0xff0000,1);
_Rect.graphics.drawRect(0, 0, b_width,b_height);
_Rect.graphics.endFill();
addChild(_Rect);
_Rect.buttonMode=true;
var t:TextField = new TextField();
t.htmlText="<FONT SIZE=’"+f_size+"’ color=’#ffff00’ ><b>点击此处切换观看模式(全屏/普通)</b></font>";
t.autoSize=TextFieldAutoSize.LEFT;
t.x=30;
t.y=2;
_Rect.addChild(t);
var _Rect1:Sprite = new Sprite();
_Rect1.graphics.beginFill(0x000000,0);
_Rect1.graphics.drawRect(0, 0, b_width,b_height);
_Rect1.graphics.endFill();
_Rect.addChild(_Rect1);
_Rect.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(event:MouseEvent):void {
switch (stage.displayState) {
case "normal" :
stage.displayState="fullScreen";
break;
case "fullScreen" :
default :
stage.displayState="normal";
break;
}
}
}
}使用:
var my_btn:fullbotton=new fullbotton(100,50,12);
addChild(my_btn);
在HTML中使用方法(感谢KAKA):
function cl(evt:MouseEvent):void {
stage.displayState=StageDisplayState.FULL_SCREEN;
}
my_btn.addEventListener(MouseEvent.CLICK,cl);
然后HTML标签中修改一下:
要在标签中加入allowFullScreen="true"
演示:
http://www.taoshaw.com/taoshaw/study/as3fullscreen/method2.html
源码下载:fullscreen.rar
- ››asp.net页面弄成伪静态页面
- ››Asp.net 中将汉字转换成拼音的方法
- ››ASP.NET及JS中的cookie基本用法
- ››ASP.NET获取MS SQL Server安装实例
- ››asp.net实现调用百度pai 在线翻译英文转中文
- ››ASP.NET页面选项进行提示判断
- ››Asp.net定时执行程序
- ››ASP.NET中利用DataList实现图片无缝滚动
- ››ASP.NET验证控件RequiredFieldValidator
- ››ASP.NET中使用System.Net.Mail发邮件
- ››ASP.NET中获取用户控件中控件的ID
- ››ASP.NET中FileBytes写成文件并存档
更多精彩
赞助商链接