//获得屏幕的分辨率

var x:Number=Capabilities.screenResolutionX;

var y:Number=Capabilities.screenResolutionY;

Alert.show("x="+x+"y="+y);

第二种方法

Alert.show(stage.fullScreenWidth+"=="+stage.fullScreenHeight);

//获得stage(工作区)的宽、高

Alert.show(stage.stageWidth+"=="+stage.stageHeight);

//读取xml文件private function readxml2():void

{

var urlrequest:URLRequest=new URLRequest("file/stu.xml");

var urlloader:URLLoader=new URLLoader(urlrequest);

urlloader.addEventListener(Event.COMPLETE, completehandler);

}

private function completehandler(event:Event):void

{

var xml:XML=new XML(event.target.data);

// var arr:Array=new Array(xml);

this.dg.dataProvider=xml.children();

this.tree.dataProvider=xml;

this.cb.dataProvider=xml.children();

// this.hlist.dataProvider=xml.children();

}

//flex 获得系统路径

var add:String=ExternalInterface.call("window.location.href.toString",1);

Alert.show(add);

//背景颜色不断变化

private function changeBG():void{

var mytime:Timer=new Timer(2000);

mytime.addEventListener(TimerEvent.TIMER,changHandle);

mytime.start();

}

private function changHandle(e:TimerEvent):void{

this.setStyle("backgroundColor",Math.random()* 0xffffff);

}

//获得键盘按下的键的值

public function getCode():void

{

btn.addEventListener(KeyboardEvent.KEY_DOWN, keyHandle);

}

function keyHandle(event:KeyboardEvent):void

{

Alert.show("你按下了:" + String.fromCharCode(event.charCode));

}

//动态加载不同界面

import commont.Two;

import commont.One;

var t:Two=new Two();

var o:One=new One();

privatefunction showOne():void{

tw.removeAllChildren();

tw.addChild(o);

}

privatefunction showTwo():void{

tw.removeAllChildren();

tw.addChild(t);

}

//flex 绑定图片

[Bindable]

[Embed(source="img/1.jpg")]

publicvar phone1:Class;

//日期中文标题

"/>

//选择日期 dateChoose

function disDate():void{

txtDate.text=fm.format(dtchoose.selectedDate.toLocaleDateString());

}

//flex 中添加html标记

">

<mx:htmlText>

<![CDATA[

<input type='file'/>

<a href="http://www.baidu.com">你哈!!!</a>

]]>

</mx:htmlText>

</mx:TextArea>

//flex 带下划线的链接

" text="Hellollll" id="lblLink" rollOver="focusManager.deactivate()" color="blue" opaqueBackground="#ffffff"

rollOut="focusManager.activate()" styleName="Label"

creationComplete="link()"/>.Label{text-roll-over-color:red; text-decoration:underline; background-color:green; font-size:12px; text-selected-color:red;}

//flex 转向 URL

Var url:URLRequest=new URLRequest(“http://www.google.cn”);

navigateToURL(url,”_self”);//在本页打开

navigateToURL(url,”_blank”);//在新的一页打开

//弹出对话框---------非模式打开---------

PopUpManager.createPopUp(this,类(界面)的名称);

---------模式打开---------

var ep:Main=newMain ();

PopUpManager.addPopUp(ep,this,true);//界面,打开窗口父类,是否模式

PopUpManager.centerPopUp(ep);//在父类窗口居中

//-----Alert的用法

publicfunction test():void

{

var glow:GlowFilter=new GlowFilter();

glow.color=StyleManager.getColorName("blue");//边框颜色

glow.strength=5;

glow.alpha=0.8;

var alert:Alert=Alert.show("是否选择","提示",Alert.YES|Alert.NO,this,alertHandle);

alert.filters=[glow];

}

privatefunction alertHandle(event:CloseEvent):void{

if(event.detail==Alert.YES){

lbl.text="是";

}else{

lbl.text="否";

}

}

" label="Button" click="test()"/>

" id="lbl"/>

//flex Combobox添加 –请选择-

privatefunction loadCB(){

var arr:Array=new Array("-请选择-");

for(var i:int=1;i<10;i++){

arr[i]=i;

}

this.cb.dataProvider=arr;

}

//combobox 选择的值和下标

privatefunction selected():void{

Alert.show(cb.selectedItem.toString()+"下标:"+cb.selectedIndex);

}

" id="cb" creationComplete="loadCB()"change="selected()">

//鼠标移动变大,Button加图片,变手型

" icon="@Embed(source='img/3.jpg')"

" useHandCursor="true" buttonMode="true"/>

privatefunction changBig():void{

this.btn.scaleX=1.5;

this.btn.scaleY=1.5

}

privatefunction changSmall():void{

this.btn.scaleX=1;

this.btn.scaleY=1;

}

//flex panel 拖动效果

" layout="absolute" id="panel" mouseDown="ondragStart(event)" mouseUp="ondragStop(event)">

</mx:Panel>

privatefunction ondragStart(event:MouseEvent):void{

Panel(event.target).startDrag();

}

privatefunction 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);

//jsp/html文件嵌入到flex中(需要把flexiframe.swc放在项目的flex_libs下)

Application标签内xmlns:code=http://code.google.com/p/flex-iframe/

">

" layout="absolute">

</mx:Panel>

" layout="absolute">

<code:IFrame id="frm" source="file/万年历.html" height="100%" width="100%"/><!-这是最重要的-à

</mx:Panel>

</mx:HDividedBox>

//检查使用的操作系统

privatefunction checkOS():void{

var os:String=Capabilities.os;

tt.text="你的操作系统是:--"+os;

}

//检查所使用的浏览器

privatefunction checkPlay():void{

var play:String=Capabilities.playerType;

Alert.show(play);

if(play=="ActiveX"){

tt.text="你的浏览器是--IE";

}elseif(play=="PlugIn"){

tt.text="你的浏览器是--Mozilla-Firefox";

}else{

tt.text="你的浏览器是--其他";

}

}

//检查player的版本和使用的语言

privatefunction 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")]

publicvar cur:Class;

privatefunction initCursor(event:Event){

CursorManager.setCursor(cur);

}

//设置AdvancedDataGrid的表头竖线为空

headerSortSeparatorSkin="mx.skins.ProgrammaticSkin"

//获得鼠标坐标

var cx:Number=CursorManager.currentCursorXOffset;

var cy:Number=CursorManager.currentCursorYOffset;

var id:int=CursorManager.currentCursorID;

Alert.show("x:="+cx+"y:="+y+"id="+id);

Flex的基础用法【转】的更多相关文章

  1. PropertyGrid控件由浅入深(二):基础用法

    目录 PropertyGrid控件由浅入深(一):文章大纲 PropertyGrid控件由浅入深(二):基础用法 控件的外观构成 控件的外观构成如下图所示: PropertyGrid控件包含以下几个要 ...

  2. logstash安装与基础用法

    若是搭建elk,建议先安装好elasticsearch 来自官网,版本为2.3 wget -c https://download.elastic.co/logstash/logstash/packag ...

  3. elasticsearch安装与基础用法

    来自官网,版本为2.3 注意elasticsearch依赖jdk,2.3依赖jdk7 下载rpm包并安装 wget -c https://download.elastic.co/elasticsear ...

  4. BigDecimal最基础用法

    BigDecimal最基础用法 用字符串生成的BigDecimal是不会丢精度的. 简单除法. public class DemoBigDecimal { public static void mai ...

  5. flex sqlite基本用法

    flex sqlite基本用法 页面 <?xml version="1.0" encoding="utf-8"?> <s:WindowedAp ...

  6. Vue组件基础用法

    前面的话 组件(Component)是Vue.js最强大的功能之一.组件可以扩展HTML元素,封装可重用的代码.根据项目需求,抽象出一些组件,每个组件里包含了展现.功能和样式.每个页面,根据自己所需, ...

  7. Smarty基础用法

    一.Smarty基础用法: 1.基础用法如下 include './smarty/Smarty.class.php';//引入smarty类 $smarty = new Smarty();//实例化s ...

  8. 前端自动化测试神器-Katalon的基础用法

    前言 最近由于在工作中需要通过Web端的功能进行一次大批量的操作,数据量大概在5000左右,如果手动处理, 完成一条数据的操作用时在20秒左右的话,大概需要4-5个人/天的工作量(假设一天8小时的工作 ...

  9. Bootstrap fileinput:文件上传插件的基础用法

    官网地址:http://plugins.krajee.com/ 官网提供的样例:http://plugins.krajee.com/file-input/demo 基础用法一 导入核心CSS及JS文件 ...

随机推荐

  1. SQLServer2008 行转列3

    with a as ( select 日期,学号,名字, '语文' as 科目,语文 as 分数 from tsco union all select 日期,学号,名字, '数学' as 科目,数学 ...

  2. Google 网络库Volley简介

    Volley是什么? 2013 Google I/O 大会发布的Android平台网络通讯库,旨在帮助开发者实现更快速,简单,健壮的网络通讯.支持网络图片的缓存加载功能. 适用场景:数据量不大,但是通 ...

  3. 如何实现wpf的多国语言

    http://www.cnblogs.com/horan/archive/2012/04/20/wpf-multilanguage.html 4.0版本的locbaml http://michaels ...

  4. 使用SqlTransaction回滚事务

    https://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqltransaction(v=vs.110).aspx private ...

  5. Android实现图片裁切

    介绍 在应用开发中,如果涉及到个人信息,头像一般是不可避免的,类似这种情况,我们就需要用到图片裁切的功能,实现头像裁切,然后上传给服务器. 一般裁切的做法就是图层叠加选取框,然后根据坐标,计算裁切区域 ...

  6. R语言缺失值信息处理

    mean(!is.na(mat))可以计算数据完整度(没有缺失值的) mean(!is.na(mat))>0.9,90%完整可以使用 # 缺失值的位置研究as.vector(attributes ...

  7. HDU 1907 (博弈) John

    参见上一篇博客,里面有分析和结论. #include <cstdio> int main() { int T; scanf("%d", &T); while(T ...

  8. HDU 2512 一卡通大冒险

    我感觉这更像个数学问题. dp[i][j]表示将i件物品分成j组的方案数. 状态转移方程: dp[i][j] = dp[i-1][j-1] + j * dp[i-1][j]; 将i张卡分成j组可以有之 ...

  9. Storm的容错性

    一.简介 如果在消息处理过程中出了一些异常,Storm 会重新安排这个出问题的 topology.Storm 保证一个 topology 永远运行(除非你显式杀掉这个 topology) . 当然,如 ...

  10. Odoo 的库存管理与OpenERP之前的版本有了很大的不同,解读Odoo新的WMS模块中的新特性

    原文来自:http://shine-it.net/index.php/topic,16409.0.html 库存移动(Stock Move)新玩法Odoo的库存移动不仅仅是存货在两个“存货地点”之间的 ...