//获得屏幕的分辨率

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. 深入理解Java内存模型(一)——基础

    并发编程模型的分类 在并发编程中,我们需要处理两个关键问题:线程之间如何通信及线程之间如何同步(这里的线程是指并发执行的活动实体).通信是指线程之间以何种机制来交换信息.在命令式编程中,线程之间的通信 ...

  2. 总结Selenium自动化测试方法(四)WebDriver常用的操作

    四.WebDriver常用的操作 1.控制浏览器操作 #控制浏览器的大小 self.driver.set_window_size(480,800) #控制浏览器返回 self.driver.back( ...

  3. Codeforces Beta Round #97 (Div. 1)

    B 判矩阵的时候 出了点错 根据点积判垂直 叉积判平行 面积不能为0 #include <iostream> #include<cstdio> #include<cstr ...

  4. cocos2d-x 获取图片的某像素点的RGBA颜色 -转

    cocos2d-x 获取图片的某像素点的RGBA颜色  原文:http://www.cnblogs.com/jaoye/archive/2013/02/19/2916501.html 没做过 太多的图 ...

  5. C# Access DBHelp

    /* * By :落落 * URL: Www.MyLuoLuo.Com */ using System; using System.Collections.Generic; using System. ...

  6. 【笨嘴拙舌WINDOWS】GDI(2)

    古时候,大师舞文之时需要笔墨纸伺候,不同笔,不同墨,作品风格迥异! 以下是windows提供的笔(带有墨): CreatePen(PS_SOLID,0,clRed);                  ...

  7. UVa 10954 (Huffman 优先队列) Add All

    直接用一个优先队列去模拟Huffman树的建立过程. 每次取优先队列前两个数,然后累加其和,把这个和在放入到优先队列中去. #include <cstdio> #include <q ...

  8. 51nod1188 最大公约数之和 V2

    考虑每一个数对于答案的贡献.复杂度是O(nlogn)的.因为1/1+1/2+1/3+1/4......是logn级别的 //gcd(i,j)=2=>gcd(i/2,j/2)=1=>phi( ...

  9. 你其实真的不懂print("Hello,world")

    http://www.jianshu.com/p/abb55919c453 debugPrint在发布的版本里也 会输出debugPrint只是更倾向于输出对象的调试信息.不管是开发环境还是测试环境都 ...

  10. web服务器的相关资料 ngix

    OpenResty:官方网站  http://openresty.org/cn/index.html 利用nginx+lua+memcache实现灰度发布 http://www.cnblogs.com ...