首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

个人小结flex各种用法

2012-11-25 
个人总结flex各种用法多篇日志总结的,非原创,但为了更多人看这篇不错的日志,设置为原创,对个作者在此到个

个人总结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

热点排行