- 浏览: 37941 次
- 性别:
- 来自: 上海
文章分类
最新评论
//获得屏幕的分辨率
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();
private function showOne():void{
tw.removeAllChildren();
tw.addChild(o);
}
private function showTwo():void{
tw.removeAllChildren();
tw.addChild(t);
}
//flex 绑定图片
[Bindable]
[Embed(source="img/1.jpg")]
public var phone1:Class;
//日期中文标题
<mx:DateChooser id="dtchoose" x="219" y="83" dayNames="[日,一,二,三,四,五,六]" monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]" change="disDate()" minYear="2007"/>
//选择日期 dateChoose
function disDate():void{
txtDate.text=fm.format(dtchoose.selectedDate.toLocaleDateString());
}
//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 带下划线的链接
this.lblLink.htmlText="<a href='http://www.google.com' target='_blank'>新 闻</a>";
<mx:Label x="524" y="393" 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=new Main ();
PopUpManager.addPopUp(ep,this,true);//界面,打开窗口父类,是否模式
PopUpManager.centerPopUp(ep);//在父类窗口居中
//-----Alert的用法
public function 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];
}
private function alertHandle(event:CloseEvent):void{
if(event.detail==Alert.YES){
lbl.text="是";
}else{
lbl.text="否";
}
}
<mx:Button x="62" y="80" label="Button" click="test()"/>
<mx:Label x="62" y="37" text="Label" width="65" id="lbl"/>
//flex Combobox添加 –请选择-
private function loadCB(){
var arr:Array=new Array("-请选择-");
for(var i:int=1;i<10;i++){
arr[i]=i;
}
this.cb.dataProvider=arr;
}
//combobox 选择的值和下标
private function selected():void{
Alert.show(cb.selectedItem.toString()+"下标:"+cb.selectedIndex);
}
<mx:ComboBox x="194" y="80" id="cb" creationComplete="loadCB()" change="selected()">
//鼠标移动变大,Button加图片,变手型
<mx:Button x="72" y="80" label="Button" click="test()" mouseMove="changBig()" mouseOut="changSmall()" id="btn" height="52" icon="@Embed(source='img/3.jpg')"
labelPlacement="bottom" width="67" useHandCursor="true" buttonMode="true"/>
private function changBig():void{
this.btn.scaleX=1.5;
this.btn.scaleY=1.5
}
private function changSmall():void{
this.btn.scaleX=1;
this.btn.scaleY=1;
}
//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);
//jsp/html文件嵌入到flex中(需要把flexiframe.swc放在项目的flex_libs下)
Application标签内xmlns:code=http://code.google.com/p/flex-iframe/
<mx:HDividedBox x="0" y="10" width="100%" height="500">
<mx:Panel width="30%" height="500" layout="absolute">
</mx:Panel>
<mx:Panel width="70%" height="500" layout="absolute">
<code:IFrame id="frm" source="file/万年历.html" height="100%" width="100%"/><!-这是最重要的-à
</mx:Panel>
</mx:HDividedBox>
//检查使用的操作系统
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);
}
//设置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);
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xuhuanchao/archive/2009/10/31/4749241.aspx
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();
private function showOne():void{
tw.removeAllChildren();
tw.addChild(o);
}
private function showTwo():void{
tw.removeAllChildren();
tw.addChild(t);
}
//flex 绑定图片
[Bindable]
[Embed(source="img/1.jpg")]
public var phone1:Class;
//日期中文标题
<mx:DateChooser id="dtchoose" x="219" y="83" dayNames="[日,一,二,三,四,五,六]" monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]" change="disDate()" minYear="2007"/>
//选择日期 dateChoose
function disDate():void{
txtDate.text=fm.format(dtchoose.selectedDate.toLocaleDateString());
}
//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 带下划线的链接
this.lblLink.htmlText="<a href='http://www.google.com' target='_blank'>新 闻</a>";
<mx:Label x="524" y="393" 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=new Main ();
PopUpManager.addPopUp(ep,this,true);//界面,打开窗口父类,是否模式
PopUpManager.centerPopUp(ep);//在父类窗口居中
//-----Alert的用法
public function 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];
}
private function alertHandle(event:CloseEvent):void{
if(event.detail==Alert.YES){
lbl.text="是";
}else{
lbl.text="否";
}
}
<mx:Button x="62" y="80" label="Button" click="test()"/>
<mx:Label x="62" y="37" text="Label" width="65" id="lbl"/>
//flex Combobox添加 –请选择-
private function loadCB(){
var arr:Array=new Array("-请选择-");
for(var i:int=1;i<10;i++){
arr[i]=i;
}
this.cb.dataProvider=arr;
}
//combobox 选择的值和下标
private function selected():void{
Alert.show(cb.selectedItem.toString()+"下标:"+cb.selectedIndex);
}
<mx:ComboBox x="194" y="80" id="cb" creationComplete="loadCB()" change="selected()">
//鼠标移动变大,Button加图片,变手型
<mx:Button x="72" y="80" label="Button" click="test()" mouseMove="changBig()" mouseOut="changSmall()" id="btn" height="52" icon="@Embed(source='img/3.jpg')"
labelPlacement="bottom" width="67" useHandCursor="true" buttonMode="true"/>
private function changBig():void{
this.btn.scaleX=1.5;
this.btn.scaleY=1.5
}
private function changSmall():void{
this.btn.scaleX=1;
this.btn.scaleY=1;
}
//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);
//jsp/html文件嵌入到flex中(需要把flexiframe.swc放在项目的flex_libs下)
Application标签内xmlns:code=http://code.google.com/p/flex-iframe/
<mx:HDividedBox x="0" y="10" width="100%" height="500">
<mx:Panel width="30%" height="500" layout="absolute">
</mx:Panel>
<mx:Panel width="70%" height="500" layout="absolute">
<code:IFrame id="frm" source="file/万年历.html" height="100%" width="100%"/><!-这是最重要的-à
</mx:Panel>
</mx:HDividedBox>
//检查使用的操作系统
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);
}
//设置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);
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xuhuanchao/archive/2009/10/31/4749241.aspx
发表评论
-
Flex中如何去掉Tree控件默认文件夹图标、叶子节点图标
2011-11-01 16:07 1171利用folderClosedIcon和folderOpenIc ... -
Flex DataGrid数据的多种显示方式
2011-09-28 10:54 1378Flex DataGrid单元格显示数据有多种方式。 1.默认 ... -
Flex分页(适用于小型数据)
2011-09-27 15:53 967<?xml version="1.0" ... -
四种方式实现Flex页面跳转
2011-09-26 15:08 1000Flex页面跳转是不被大多数人知道的东西,这里向大家简单介绍一 ... -
Flex学习网址
2011-09-05 15:40 7721.国外站点 http://www.blogjava.net/ ... -
DataGrid删除数据后如何自动更新
2011-08-23 23:07 1296mainl.mxml <?xml version=&qu ... -
Flex与java文件上传
2011-08-21 14:31 1208在Adobe的Flex RIA编程环境下,是无法读取本地文件的 ... -
Flex学习站点汇总
2011-08-05 13:04 757一、国外站点 1.资源类 Adobe Flex 2 Com ...
相关推荐
总结flex各种用法,对flash Builder不熟悉的初学者可以下下来看下,方便查找
flex 里面DataGrid常用到的所有用法总结!
博文链接:https://qichunren.iteye.com/blog/234410
详解flex combox checkbox用法 并且附开发例子给予介绍 分为两部分combox和checkbox各自绑定数据源 checkbox选中值赋给combox
以下是我最近做flex组件编程时的总结,是主要针对lineChart的用法,其中某些属性对同是有横纵坐标的columnChart、barChart等都有效,比如对背景的网格线、横纵坐标线条的粗细颜色和标签的设置都有效。
此文档描述了Java工程和Flex工程独立的配置,文档由本人总结归纳出实用且简便的方法,文档中配有步骤说明和图解,大家按照文档可以进行配置,本人在公司项目中使用此方法,所以和大家分享分享,大家觉得还有什么更好...
你在使用FLEX编程是否遇到各种问题?那你可以看看这个文档咯,总结了常见问题和解决方法。。
1. 尽量抽象出方法,写进as类或者as文件中,以降低耦合度(避免方法的依赖性)。而关于业务的一些操作方法那是没办法避免的。 2. 尽量将会公共使用的组件抽离出来,比如说一些通用性的组件,单独的作为component会...
总结了一些常用的Flex特效的使用方法: AnimateProperty:动画属性 Blur :模糊 Desolve :溶解 Fade :凋零 Glow :发光 Iris :瞳孔放大缩小 Move :移动 Pause :定格 Resize :改变大小 Rotate :旋转...
5、路由的使用 vue-router 6、vue发送 ajax请求 7、计算属性,方法与侦听器 8、组件间绑定原生事件 9、vue常见插件 10、全局事件的绑定与解绑 11、vue递归组件实现 12、vue动画特效 13、vue移动端开发注意点 ...
本章小结 第八章 Fl ash10的绘画API 路径 一个简单的例子 画曲线 wide绘制命令和NO_OP 缠绕 三角 位图填充和三角 uvtData 更多三角 三角和3D uvt中的t 旋转圆柱 创建一个3D地球 图形数据 总结 第九章 Pi xel Bender ...
面试必备,工作一定会用到。emmm大家都懂的,话不多说,先直接贴一个总结和效果图。...要怎么实现上面这幅图的效果呢,下面为大家总结了10中常用的方法。首先我先创建一个公共的模板样式 <div class=child
2.4.2使用FlexBuilder 2.4.3使用免费的命令行编译器 2.4.4关于跟踪 2.4.5缩放影片 2.5使用代码动画 2.5.1循环 2.5.2帧循环 2.5.3剪辑事件 2.5.4事件和事件处理器 2.5.5侦听器和处理器 2.5.6动画事件 2.6显示列表 2.7...
├01 css3元素选择器 属性选择器 伪类选择器.mp4 ├02 css3文本选择器 表单选择器 子选择器.mp4 ...├27 阿里矢量图标库的使用方法.mp4 ├28 淘宝网移动端首页开发实战1.mp4 └29 淘宝网移动端首页开发实战2.mp4
小总结 图片响应式 react native中,图片必须写大小值,不然默认宽高都是0,而且react native的flex不支持width:100%这种写法。 如果需要响应式的图片,有两种方法: 图片只写高度值,不写宽度值,外层容器使用flex来...
最好统一使用flex布局 css开发中遇到问题的解决整理与技巧方法总结(包含css3) Mixin-可以重用的代码块 其他 js模块化规范(重点!) 变量的解构赋值 计算机网络相关 浏览器 前端框架 跨平台移动端原生应用开发 ...
2.4.2 使用Flex Builder 2.4.3 使用免费的命令行编译器 2.4.4 关于跟踪 2.4.5 缩放影片 2.5 程序动画 2.5.1 动画的执行过程 2.5.2 帧循环 2.5.3 影片事件 2.5.4 事件和事件处理 2.5.5 事件侦听器与处理函数 2.5.6 ...
前端训练前置练习项目...参考简易表单验证网易云课堂原生JS项目实战,表单验证技术栈:原生JS总结: viewport视窗大小自适应设置,参考布局模式之flex弹性布局,参考和min-height使用的替代是父级元素需要有明确的heig