个人总结flex各种用法

多篇日志总结的,非原创,但为了更多人看这篇不错的日志,设置为原创,对个作者在此到个歉了

//获得屏幕的分辨率
var x:Number=Capabilities.screenResolutionX;
var y:Number=Capabilities.screenResolutionY;
Alert.show("x="+x+"y="+y);
第二种方法
Alert.show(stage.fullScreenWidth+"=="+stage.fullScreenHeight);

//flex 获得系统路径
var add:String=ExternalInterface.call("window.location.href.toString",1);
Alert.show(add);

//获得键盘按下的键的值
public function getCode():void
{
btn.addEventListener(KeyboardEvent.KEY_DOWN, keyHandle);
}

function keyHandle(event:KeyboardEvent):void
{
Alert.show(" 你按下了:" + String.fromCharCode(event.charCode));
}

//日期中文标题
<mx:DateChooser id="dtchoose" x="219" y="83"
dayNames="[日,一,二,三,四,五,六]"
monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]"
change="disDate()" minYear="2007"
/>

//flex 中添加html标记
<mx:TextArea id="text" creationComplete="init()" width="248" height="59">
<mx:htmlText>
<![CDATA[
<input type='file'/>
<a href="http://www.baidu.com">你哈!!!</a>
]]>
</mx:htmlText>
</mx:TextArea>

//flex panel 拖动效果
<mx:Panel x="194" y="125" width="192" height="121" layout="absolute"id="panel"
mouseDown="ondragStart(event)" mouseUp="ondragStop(event)">
</mx:Panel>
private function ondragStart(event:MouseEvent):void
{
Panel(event.target).startDrag();
}
private function ondragStop(event:MouseEvent):void
{
Panel(event.target).stopDrag();
}

//
写入共享数据
share=SharedObject.getLocal("username");
share.data.userName=txtUser.text;
share.flush();
//读取共享数据
var share:SharedObject=SharedObject.getLocal("username");
Alert.show(share.data.userName);

//检查使用的操作系统
private function checkOS():void
{
var os:String=Capabilities.os; tt.text="你的操作系统是:--"+os;
}

//检查所使用的浏览器

private function checkPlay():void
{
var play:String=Capabilities.playerType;
Alert.show(play);
if(play=="ActiveX") {tt.text="你的浏览器是--IE";}
else if(play=="PlugIn"){
tt.text="你的浏览器是--Mozilla-Firefox";
}
else
{tt.text="你的浏览器是--其他";}
}

//检查player的版本和使用的语言
private function other():void
{
var v:String=Capabilities.version;
var l:String=Capabilities.language;
tt.text="你的flayer版本号:--"+v+"\r\n你的语言是:--"+l;
}

//改变鼠标样式
[Bindable]
[Embed(source="img/157.jpg")]
public var cur:Class;
private function initCursor(event:Event)
{CursorManager.setCursor(cur);}

//获得鼠标坐标
var cx:Number=CursorManager.currentCursorXOffset;
var cy:Number=CursorManager.currentCursorYOffset;
var id:int=CursorManager.currentCursorID;
Alert.show("x:="+cx+"y:="+y+"id="+id);

//.复制内容到系统剪贴板
System.setClipboard(strContent);

//复制一个ArrayCollection
var bar:ListCollectionView = new ListCollectionView( ListCollectionView( ac ).list );

//打开一个新浏览器窗口
navigateToURL(new URLRequest('http://ntt.cc'), '_blank');
//刷新浏览器
navigateToURL(new URLRequest("javascript:location.reload();"),"_self")
//关闭浏览器
navigateToURL(new URLRequest("javascript:window.close()"),"_self");

//清除子串左侧空格
public function LTrim(s : String):String
{
var i : Number = 0;
while(s.charCodeAt(i) == 32 || s.charCodeAt(i) == 13 || s.charCodeAt(i) == 10 || s.charCodeAt(i) == 9)
{
i++;
}
return s.substring(i,s.length);
}

总结自:
http://www.ej38.com/showinfo/flex-162498.html
http://www.ej38.com/showinfo/flex-163500.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值