终于把628页的《Flex3/ RIA完全手册》看完了,而且在我的计划之内,所以这里也给自己鼓励一下哦,(声明:不是为了显摆,也不是为了夸自己多么多么能看厚书)因为这确实是我第一次看完这么厚的技术书籍。比如,我的《JSP宝典》已经买下半年多了,但我到现在还没看完,所以现在我索性把她放在那里当字典或资料查了,同学看见这本书都叫它“葵花宝典”,呵呵(足可见它的厚度吧),希望下面这两个月能够再接再励,争取突破这个高度,有的时候发现计算机的书籍真的一个比一个厚,我相信每一个大牛或大师级别的人大多也是这么过来的吧,呵呵既然拜读了这本《Flex3/ RIA完全手册》,也谈一下自己的心得体会,读书重在应用和交流嘛:
先声明下我不是谁的托,也不是在这里宣传这本书有多么多么的好,因为我也是从学校的图书馆里借来拜读的,接下来的时间本该马上开始另外一本书籍的学习,但是我下个学习任务中需要的开发工具和平台还没Down下来,所以就在这里码开文字消遣一会儿了!哈哈
大概说下这本书的内容组织结构:
第一篇 基础篇
说了下flex特性,Flex Builder3的安装与开发环境讲解,MXML的介绍,flex3.0程序的编译、调试、运行等
第二篇 ActionScript3.0基础
也是些基础性的东西,比如:AS语法与基础、AS中的数据类型、运算符和表达式、程序设计的基本结构、函数,面向对象基础,数字处理,日期与时间,字符串,数组,XML等,对于JAVA Programmer来说这些可以一带而过哦,因为确实很简单嘛
第三篇 组件篇
用组件构建Flex界面、界面设计等,有不少界面制作的实例,到时候一并把源代码发上来,还有自定义效果美化界面,CSS美化界面(包含滤镜的使用)flex美化应用(自定义界面属性和外观等),总之这张的实例还是蛮多的
第四篇 数据篇
Flex中的数据处理(数据绑定、数据存储、数据验证、格式化等)、使用正则表达式匹配字符串数据、数据的传输方式(文件流、XML等方式)、数据的交互(HTTPService与HTTP的交互、WebService交互,Fluorine网关与.net类的交互(java的可以不看这个哦))。
第五篇 扩展篇
着重讲了一个开发框架Cairngorm,包括Cairngorm源代码中类的介绍、框架的运行原理,还有一个实例,另外还介绍了flex3的新特性(相比Flex2),比如加载PDF文件,使用本地的SQL数据库,Flex3.0中的Ajax技术,Flex-Ajax Bridge控制技术等
第六篇 实例篇
实例篇主要介绍了三个经典案例:FLV播放器,对Adobe官方经典实例CairngormStore的分析与讲解算是详尽,扩展应用就得看个人造化了,最后一个实例比较有趣,客户端用Flex3实现,服务器端用java实现,通过LiveCycle Data Services服务器(被称作AMF网关)调用服务器端的程序来操作SQL2000数据库及其本地文件。
总体感觉这本书还行,容易上手,适合Flex3初学者,实例比较丰富,讲解也很透彻,如果对RIA富互联网应用程序感兴趣的朋友不妨可以一读,在此也公布自己这段学习期间的所有源代码,以供各位programmer交流,也希望你们如果有什么好的Flex/RIA方面的参考书籍也一并推荐哦!
偶的交流暂且就码到这里了,期待你们给我提供更好的RIA参考资料或书籍哦!哈哈
我交流我快乐,相信你们也是一样的!Sharing你们手中的每一本资料,那么你将会得到更大的收获!
下面贴一点界面设计实战和FLV播放器的源代码:(FLV用到了Cairngorm框架,自己去Adobe上下载一下吧)还有剩下的实例源代码我会陆续整理好打包传上来!
PS:恕不接受个人邮件发送,不要说“发个源代码到我邮箱吧”,也不要像在百度知道上那样发个“跪求XXXXXXXX源程序之类”的帖子。。。,我想作为开发者看到这样的字样除了呕吐和鄙视,那么接下来就是好几天吃不下饭了!相信JE上肯定没有这样的人!
Flex3界面设计综合实例源代码(最好下载我传上来的附件):
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
<mx:states>
<mx:State name="index"> <!--新建"index"状态-->
<mx:RemoveChild target="{panel1}"/> <!--移除登陆框-->
<mx:SetStyle name="fontFamily" value="Georgia"/>
<mx:SetStyle name="fontSize" value="12"/>
<mx:SetStyle name="fontWeight" value="bold"/>
<mx:AddChild position="lastChild">
<mx:Panel width="400" height="300" layout="absolute" horizontalCenter="0" verticalCenter="0" borderColor="#04D8F8" title="菜单导航" fontSize="14" fontFamily="Arial" id="panel2">
<mx:MenuBar id="myMenuBar" dataProvider="{myXMLList}" labelField="@id" showRoot="false" width="380" fontSize="12" fontFamily="Georgia" fontWeight="normal" change="menuClickHandle(event)"/>
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="index1" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox height="240" id="myVBox1" x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" width="{myMenuBar.width}" backgroundColor="#FA0505" backgroundAlpha="0.5">
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="index2" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" height="240" id="myVBox2" backgroundAlpha="0.5" backgroundColor="#F5E531" width="{myMenuBar.width}">
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="index3" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" height="240" width="{myMenuBar.width}" backgroundAlpha="0.5" backgroundColor="#8DF531" id="myVBox3">
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="index4" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" height="240" id="myVBox4" backgroundColor="#31F5E5" backgroundAlpha="0.5" width="{myMenuBar.width}">
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="index5" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" height="240" id="myVBox5" backgroundColor="#D731F5" backgroundAlpha="0.5" width="{myMenuBar.width}">
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="columnIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<!--柱状图-->
<mx:ColumnChart id="myColumnChart" dataProvider="{finance}" horizontalCenter="0" verticalCenter="12" width="360" height="220">
<mx:horizontalAxis><!--定义横坐标绑定到"finance"数据集中的"Month"上-->
<mx:CategoryAxis
dataProvider="{finance}"
categoryField="Month"
title="(月份)"/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries displayName="收入" xField="Month" yField="In"/>
<mx:ColumnSeries displayName="支出" xField="Month" yField="Out"/>
</mx:series>
</mx:ColumnChart>
</mx:AddChild>
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<!--Legend组件绑定柱状图中的数据名-->
<mx:Legend dataProvider="{myColumnChart}" x="291" y="30"/>
</mx:AddChild>
</mx:State>
<mx:State name="piechartIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<!--饼状图-->
<mx:PieChart id="myPieChart" dataProvider="{itProgrammer}" showDataTips="true" horizontalCenter="0" verticalCenter="8" width="360" height="220">
<mx:series>
<mx:PieSeries labelPosition="callout" labelFunction="displayCount" field="count">
<mx:calloutStroke>
<mx:Stroke weight="0" color="0x888888" alpha="1.0"/>
</mx:calloutStroke>
<mx:radialStroke>
<mx:Stroke weight="0" color="#ffffff" alpha="0.5"/>
</mx:radialStroke>
<mx:stroke>
<mx:Stroke weight="2" color="0" alpha="0.5"/>
</mx:stroke>
</mx:PieSeries>
</mx:series>
</mx:PieChart>
</mx:AddChild>
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:Legend dataProvider="{myPieChart}" x="10" y="26"/>
</mx:AddChild>
</mx:State>
<mx:State name="fileIndex" basedOn="index">
<mx:RemoveChild target="{panel2}"/>
<mx:AddChild position="lastChild">
<mx:Panel width="800" height="600" layout="absolute" horizontalCenter="0" verticalCenter="0" id="filePanel" title="文件目录浏览器实例" borderColor="#04A5F9">
<mx:VBox height="100%" width="100%" horizontalCenter="0" verticalCenter="0">
<mx:HBox width="100%" y="0">
<mx:FileSystemComboBox id="filecmb" directory="{filedg.directory}" directoryChange="filedg.directory=filecmb.directory;"/>
<mx:Button label="返回" id="btnBack" click="filedg.directory=filedg.directory.parent"/>
</mx:HBox>
<mx:FileSystemDataGrid width="100%" height="400" y="0" x="0" id="filedg" dataProvider="{new File('e:/')}"/>
</mx:VBox>
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="IEindex" basedOn="index">
<mx:RemoveChild target="{panel2}"/>
<mx:AddChild position="lastChild">
<mx:Panel width="800" height="600" layout="absolute" horizontalCenter="0" verticalCenter="0" borderColor="#05B8FB" id="htmlPanel" title="FlEX浏览器">
<mx:VBox x="0" y="0" height="100%" width="100%">
<mx:HBox width="100%" height="30" backgroundColor="#DDFADD" verticalAlign="middle">
<!--"mx:Spacer"标签是空格组件,可定义宽度和高度-->
<mx:Spacer width="100%"/>
<!--网址输入框-->
<mx:TextInput id="txtURL" width="450" x="{(htmlPanel.width-txtURL.width)/2}"/>
<!--实现网页跳转-->
<mx:Button id="btnGOTO" label="GO!" click="gotoURL()"/>
<mx:Spacer width="100%"/>
</mx:HBox>
<!--"mx:HTML"组件使得AIR程序可集成网页-->
<mx:HTML id="html" width="800" height="600" location="http://www.google.cn"/>
</mx:VBox>
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="txtEditorIndex" basedOn="index">
<mx:RemoveChild target="{panel2}"/>
<mx:AddChild position="lastChild">
<mx:Panel width="482" height="350" layout="absolute" horizontalCenter="0" verticalCenter="0" borderColor="#03DCFC" id="txtPanel" title="简单的文本编辑器">
<mx:Label x="28" y="10" text="文件路径" id="pathLabel"/>
<mx:TextInput x="102" y="8" width="277" id="txtFilePath"/>
<mx:Button x="387" y="8" label="浏览..." id="btnChooseFilePath" click="dlgFile.browseForOpen('浏览文件',[txtFilter,jpgFilter,gifFilter,bmpFilter,pngFilter,docFilter,fileAll]);dlgFile.addEventListener(Event.SELECT,selectHandle);"/>
<mx:TextArea x="28" y="50" width="424" height="211" id="txtContent"/>
<mx:Button x="28" y="275" label="修改" id="txtModify" click="modifyText()"/>
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="AStoJSIndex" basedOn="index">
<mx:RemoveChild target="{panel2}"/>
<mx:AddChild position="lastChild">
<mx:Panel width="400" height="300" layout="absolute" horizontalCenter="0" verticalCenter="0" borderColor="#06D6FB" id="astojsPanel" title="AS调用JS实例">
<mx:TextInput x="10" y="44" id="txtName" text="[请输入名字]"/>
<mx:Button x="191" y="44" label="确定" id="btnConnect" click="invokeJavaScript()"/>
<mx:Label x="10" y="114" id="lblResult"/>
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="dragIndex" basedOn="index">
<mx:RemoveChild target="{panel2}"/>
<mx:AddChild position="lastChild">
<mx:Panel width="400" height="300" layout="absolute" id="dragPanel" title="组件拖拽实例" borderColor="#06C9FA" horizontalCenter="0" verticalCenter="0" creationComplete="initListApp()">
<mx:HBox width="100%" horizontalCenter="0" verticalCenter="0" height="100%">
<mx:VBox height="100%" width="50%">
<mx:Label id="lblLeft" text="左列表"/>
<!--定义左列表,允许拖拽-->
<mx:List width="100%" height="100%" id="list1" allowMultipleSelection="true"
dragEnabled="true" dropEnabled="true" dragMoveEnabled="true">
</mx:List>
</mx:VBox>
<mx:VBox height="100%" width="50%">
<mx:Label text="右列表" id="lblRight"/>
<!--定义右列表,允许拖拽-->
<mx:List width="100%" height="100%" id="list2" allowMultipleSelection="true"
dragEnabled="true" dropEnabled="true" dragMoveEnabled="true">
</mx:List>
</mx:VBox>
</mx:HBox>
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="blurIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" height="240" id="myVBox6" backgroundAlpha="0.8" width="{myMenuBar.width}">
<mx:Image source="images/Vista.jpg" width="400" height="300" horizontalCenter="0" verticalCenter="20"/>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="dissolveIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" id="myVBox7" width="{myMenuBar.width}">
<mx:Image source="images/scene.jpg" width="400" height="290"/>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="fadeIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" id="myVBox8" width="{myMenuBar.width}">
<mx:Image x="10" y="30" source="images/scene02.jpg" width="400" height="300"/>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="resizeIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" id="myVBox9" width="{myMenuBar.width}">
<mx:Image x="0" y="21" source="images/dog.jpg" width="400" height="300"/>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="rotateIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" id="myVBox10" width="{myMenuBar.width}">
<mx:Image source="images/gulinshanshui.jpg" horizontalCenter="0" verticalCenter="0" width="400" height="300"/>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="soundIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" id="myVBox11" width="{myMenuBar.width}">
<mx:Image source="images/scene02.jpg" horizontalCenter="0" verticalCenter="0" width="400" height="300" autoLoad="true" mouseDownEffect="{mySoundEffect}"/>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="zoomIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:VBox x="{myMenuBar.x}" y="{myMenuBar.y+myMenuBar.height}" id="myVBox12" width="{myMenuBar.width}">
<mx:Image width="400" height="300" horizontalCenter="0" verticalCenter="0" source="images/eruanshi.jpg"/>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="swfIndex" basedOn="index">
<mx:RemoveChild target="{panel2}"/>
<mx:AddChild position="lastChild">
<mx:Panel width="800" height="200" layout="absolute" horizontalCenter="0" verticalCenter="0" borderColor="#00B9FD" backgroundImage="{bgSWF}">
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="filterIndex" basedOn="index">
<mx:AddChild relativeTo="{panel2}" position="lastChild">
<mx:Label text="Hello Flex3/RIA—我的界面我做主!" fontSize="20" filters="{[new DropShadowFilter(10,35)]}" horizontalCenter="0" verticalCenter="0" color="#FB04DB"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:transitions>
<mx:Transition id="myTransition1" fromState="*" toState="index1">
<mx:Parallel target="{myVBox1}">
<mx:WipeDown duration="2000"/>
<mx:Dissolve alphaFrom="0.0" alphaTo="1.0" duration="2000"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition2" fromState="*" toState="index2">
<mx:Parallel target="{myVBox2}">
<mx:WipeUp duration="2000"/>
<mx:Dissolve alphaFrom="0.0" alphaTo="1.0" duration="2000"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition3" fromState="*" toState="index3">
<mx:Parallel target="{myVBox3}">
<mx:WipeLeft duration="2000"/>
<mx:Dissolve alphaFrom="0.0" alphaTo="1.0" duration="2000"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition4" fromState="*" toState="index4">
<mx:Parallel target="{myVBox4}">
<mx:WipeRight duration="2000"/>
<mx:Dissolve alphaFrom="0.0" alphaTo="1.0" duration="2000"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition5" fromState="*" toState="index5">
<!--效果组合,对象为myVBox5-->
<mx:Parallel target="{myVBox5}">
<!--模糊的扩散效果 -->
<mx:Blur blurXFrom="0" blurXTo="180" blurYFrom="0" blurYTo="150" duration="2000"/>
<!--透明度渐变效果-->
<mx:Dissolve alphaFrom="0.0" alphaTo="1.0" duration="2000"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition6" fromState="*" toState="blurIndex">
<!--效果组合,对象为myVBox6-->
<mx:Parallel target="{myVBox6}">
<mx:Blur id="myBlur" blurXFrom="0" blurXTo="20" blurYFrom="0" blurYTo="20"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition7" fromState="*" toState="dissolveIndex">
<!--效果组合,对象为myVBox7-->
<mx:Parallel target="{myVBox7}">
<mx:Dissolve id="myDissolve" alphaFrom="1.0" alphaTo="0.5" color="white" duration="4000" targetArea="{new RoundedRectangle(20,20,320,180)}"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition8" fromState="*" toState="fadeIndex">
<!--效果组合,对象为myVBox8-->
<mx:Parallel target="{myVBox8}">
<mx:Fade id="myFade" alphaFrom="0.0" alphaTo="1.0" duration="4000"/>
<!--<mx:Glow id="myGlow" alphaFrom="0.2" alphaTo="0.8" blurXFrom="100" blurXTo="0" blurYFrom="100" blurYTo="0" color="yellow" inner="true" knockout="true" strength="5"/>-->
<!--<mx:Move id="myMove" xBy="2" xFrom="10" xTo="50" yBy="5" yFrom="10" yTo="50"/>-->
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition9" fromState="*" toState="resizeIndex">
<!--效果组合,对象为myVBox9-->
<mx:Parallel target="{myVBox9}">
<mx:Resize id="myResize" heightBy="2" heightFrom="300" heightTo="430" widthBy="4" widthFrom="400" widthTo="540" duration="1000"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition10" fromState="*" toState="rotateIndex">
<!--效果组合,对象为myVBox10-->
<mx:Parallel target="{myVBox10}">
<mx:Rotate id="myRotate" angleFrom="0" angleTo="180" originX="200" originY="150"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition11" fromState="*" toState="soundIndex">
<!--效果组合,对象为myVBox11-->
<mx:Parallel target="{myVBox11}">
<mx:SoundEffect id="mySoundEffect" autoLoad="true" bufferTime="200000" loops="3" startTime="0" useDuration="true" volumeFrom="0.5" volumeTo="2.0" source="sound\changhai.mp3"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition id="myTransition12" fromState="*" toState="zoomIndex">
<!--效果组合,对象为myVBox12-->
<mx:Parallel target="{myVBox12}">
<mx:Zoom id="myZoom" zoomHeightFrom="1.0" zoomWidthFrom="1.0" zoomHeightTo="2.0" zoomWidthTo="2.0"/>
</mx:Parallel>
</mx:Transition>
</mx:transitions>
<mx:Panel width="400" height="300" layout="absolute" id="panel1" title="用户登陆" fontSize="14" horizontalCenter="0" verticalCenter="2" borderColor="#06B6F7">
<mx:Button label="登陆" horizontalCenter="-87" verticalCenter="76" id="btnLogin" click="loginHandle()"/>
<mx:Button label="重置" horizontalCenter="80" verticalCenter="76" id="btnReset" click="resetHandle()"/>
<mx:Label text="用户名:" horizontalCenter="-91" verticalCenter="-52" id="label1"/>
<mx:Label text="密 码:" horizontalCenter="-90" verticalCenter="-19" id="label2"/>
<mx:TextInput horizontalCenter="28" verticalCenter="-52" id="txtUsername"/>
<mx:TextInput horizontalCenter="28" verticalCenter="-19" id="txtPassword" displayAsPassword="true"/>
<mx:Label x="69" y="132" text="检验码:" id="labelCheck"/>
<mx:TextInput x="138" y="130" id="txtCheck" width="69"/>
<mx:Label id="codeLabel" horizontalCenter="53" verticalCenter="16" fontSize="16" fontWeight="bold" color="#F71106"/>
<mx:LinkButton x="275" y="134" label="看不清楚?" id="againCode" click="initApp()" fontSize="10"/>
</mx:Panel>
<mx:Script>
<![CDATA[
import flash.filters.DropShadowFilter;
import mx.graphics.RoundedRectangle;
import flash.external.ExternalInterface;
import flash.filesystem.*;//引用filrsystem包
import flash.net.FileFilter;//应用FileFilter类
import mx.collections.ArrayCollection;
import mx.controls.Alert; //引用Alert类
import mx.events.MenuEvent;//MenuEvent类
[Embed(source="flash/bg.swf")]//背景图形绑定到bgswf
private var bgSWF:Class;
//简单编辑器,读取文件,选择文件,写文件的实现
private var fileAll:FileFilter=new FileFilter("*.*","*.*"); //文件过滤,允许打开All
private var txtFilter:FileFilter=new FileFilter("*.txt","*.txt"); //文件过滤,只允许打开txt
private var jpgFilter:FileFilter=new FileFilter("*.jpg","*.jpg");//文件过滤,只允许打开jpg
private var gifFilter:FileFilter=new FileFilter("*.gif","*.gif");//文件过滤,只允许打开gif
private var bmpFilter:FileFilter=new FileFilter("*.bmp","*.bmp");//文件过滤,只允许打开bmp
private var pngFilter:FileFilter=new FileFilter("*.png","*.png");//文件过滤,只允许打开png
private var docFilter:FileFilter=new FileFilter("*.doc","*.doc");//文件过滤,只允许打开doc
private var dlgFile:File=new File(); //定义一个File类实例
//选择文件后读取文件数据的方法
private function selectHandle(e:Event):void
{
var file:File=e.target as File; //获得文件
txtFilePath.text=file.nativePath; //显示文件路径
//定义FileStream类实例,用以处理文件流
var stream:FileStream=new FileStream();
stream.open(file, FileMode.READ); //以读的方式打开文件
//读取文件中的内容
txtContent.text=stream.readUTFBytes(stream.bytesAvailable);
stream.close(); //关闭文件流
}
//修改文件内容并写入到指定文件中的方法
private function modifyText():void
{
var fileWrite:File=new File(txtFilePath.text); //获取文件
var streamWrite:FileStream= new FileStream(); //定义FileStream类实例,用以处理文件流
streamWrite.open(fileWrite, FileMode.WRITE);//以写的方式打开文件
streamWrite.writeUTFBytes(txtContent.text);//写入到文件流中
Alert.show("修改成功"); //提示修改成功
streamWrite.close();//关闭写文件流
}
//ActionScript调用JavaScript函数返回字符串
private function invokeJavaScript():void
{
lblResult.text="调用成功!"+txtName.text;
}
//初始化组件列表
private function initListApp():void
{
list1.dataProvider=['苹果','橘子','菠萝','香蕉','番茄','芒果','龙眼'];//初始化左列表的项
list2.dataProvider=['宝马','奔驰','奥迪','大众'];//初始化右列表的项
}
//简单浏览器,集成网页
private function gotoURL():void
{
html.location="http://"+txtURL.text;//改变html组件的链接地址
}
private var fb:File=new File("e:/");
private var bk:File=fb.parent;
//定义柱状图数据集,,内容为每月收支情况
[Bindable]//对绑定数组是必须的关键字
private var finance:ArrayCollection=new ArrayCollection([
{Month:"一", In:2000, Out:1500},
{Month:"二", In:1000, Out:200},
{Month:"三", In:1500, Out:200},
{Month:"四", In:3500, Out:1000},
{Month:"五", In:500, Out:800},
{Month:"六", In:4500, Out:600},
{Month:"七", In:2000, Out:500},
{Month:"八", In:1570, Out:300},
{Month:"九", In:1200, Out:400},
{Month:"十", In:1500, Out:450},
{Month:"十一", In:1700, Out:2500},
{Month:"十二", In:1900, Out:1500},
]);
//定义饼状图数据集,,内容为每月收支情况
[Bindable]//对绑定数组是必须的关键字
private var itProgrammer:ArrayCollection=new ArrayCollection([
{itlang:"Java",cout:46.7},
{itlang:"C",count:22.4},
{itlang:"C++",count:14.9},
{itlang:"PHP",count:8.2},
{itlang:"C#",count:3.6},
{itlang:"Python",count:2.5},
{itlang:"Ruby",count:1.7}
]);
private function displayCount(data:Object, field:String, index:Number, precentValue:Number):String
{
var temp:String=(""+precentValue).substr(0,2);
return data.itlang+":"+data.count+temp+"%";
}
private function loginHandle():void //登陆事件方法
{
if(txtUsername.text==""|| txtPassword.text=="")
{
if(txtUsername.text==""&& txtPassword.text!="")
{
Alert.show("用户名不能为空");
}
if(txtPassword.text==""&& txtUsername.text!="")
{
Alert.show("密码不能为空");
}
if(txtPassword.text==""&& txtUsername.text=="")
{
Alert.show("用户名和密码不能为空");
}
}
else
{
if(txtUsername.text==loginXML.item.@name &&
txtPassword.text==loginXML.item.@pass &&
txtCheck.text.toLowerCase()==codeLabel.text.toLowerCase())
{
Alert.show("登陆成功!");
currentState="index";
}
if(txtUsername.text==loginXML.item.@name &&
txtPassword.text==loginXML.item.@pass &&
txtCheck.text=="")
{
Alert.show("校验码不能为空!");
}
if(txtUsername.text==loginXML.item.@name &&
txtPassword.text==loginXML.item.@pass &&
txtCheck.text!="" && txtCheck.text.toLowerCase()
!= codeLabel.text.toLowerCase())
{
Alert.show("您输的校验码有误!");
//重新生成检验码
initApp();
}
if(txtUsername.text!=loginXML.item.@name ||
txtPassword.text!=loginXML.item.@pass )
{
Alert.show("用户名或密码错误!");
}
}
}
private function resetHandle():void //重置事件方法
{
txtUsername.text="";
txtPassword.text="";
txtCheck.text="";
}
private function initApp():void //登陆检验码初始化函数
{
//显示检验码
codeLabel.text=generateCheckCode();
}
private function generateCheckCode():String //生成四位检验码函数
{
//初始化
var ran:Number;
var number:Number;
var code:String;
var checkCode:String="";
//生成四位随机数
for(var i:int=0; i<4; i++)
{
ran=Math.random();//生成random()数字类似为0.1234
number=Math.round(ran*10000);//round()方法四舍五入
if(number%2 ==0)//如果是偶数生成一个数字
{
//"0"的ASCII码是48
code=String.fromCharCode(48+(number%10));
}
else //生成一个字母
{
//"A"的ASCII码是65
code=String.fromCharCode(65+(number%26));
}
checkCode+= code;
}
return checkCode;
}
private function menuClickHandle(e:MenuEvent):void
{//MenuEvent类型的"label"属性可读取菜单项的内容
if(e.label=="WipeDown")
currentState="index1"; //单击"new"时切换到"index1"
else if(e.label=="WipeUp")
currentState="index2";
else if(e.label=="WipeLeft")
currentState="index3";
else if(e.label=="WipeRight")
currentState="index4";
else if(e.label=="Blur")
currentState="index5";
else if(e.label=="imageBlur")
currentState="blurIndex";
else if(e.label=="Dissolve")
currentState="dissolveIndex";
else if(e.label=="Fade")
currentState="fadeIndex";
else if(e.label=="imageResize")
currentState="resizeIndex";
else if(e.label=="imageRotate")
currentState="rotateIndex";
else if(e.label=="soundEffect")
currentState="soundIndex";
else if(e.label=="ColumnChart")
currentState="columnIndex";
else if(e.label=="PieChart")
currentState="piechartIndex";
else if(e.label=="zoomImage")
currentState="zoomIndex";
else if(e.label=="filterEg")
currentState="filterIndex";
else if(e.label=="SWF")
currentState="swfIndex";
else if(e.label=="fileBrowser")
currentState="fileIndex";
else if(e.label=="internetExplorer")
currentState="IEindex";
else if(e.label=="txtEditor")
currentState="txtEditorIndex";
else if(e.label=="AStoJS")
currentState="AStoJSIndex";
else if(e.label=="dragList")
currentState="dragIndex";
}
]]>
</mx:Script>
<mx:XML id="loginXML" xmlns="">
<items>
<item name="admin" pass="123456"/>
</items>
</mx:XML>
<mx:XMLList id="myXMLList" xmlns="">
<menuitem id="Effect">
<menuitem id="WipeDown" type="radio" groupName="one"/>
<menuitem id="WipeUp" type="radio" groupName="one"/>
<menuitem id="WipeLeft" type="radio" groupName="one"/>
<menuitem id="WipeRight" type="radio" groupName="one"/>
<menuitem id="Blur" type="radio" groupName="one"/>
<menuitem id="imageBlur" type="radio" groupName="one"/>
<menuitem id="Dissolve" type="radio" groupName="one"/>
<menuitem id="Fade" type="radio" groupName="one"/>
<menuitem id="imageResize" type="radio" groupName="one"/>
<menuitem id="imageRotate" type="radio" groupName="one"/>
<menuitem id="soundEffect" type="radio" groupName="one"/>
</menuitem>
<menuitem id="Charts_Others">
<menuitem id="ColumnChart" type="radio" groupName="two"/>
<menuitem id="PieChart" type="radio" groupName="two"/>
<menuitem id="zoomImage" type="radio" groupName="two"/>
<menuitem id="SWF" type="radio" groupName="two"/>
<menuitem id="filterEg" type="radio" groupName="two"/>
</menuitem>
<menuitem id="Tools">
<menuitem id="fileBrowser" type="radio" groupName="three"/>
<menuitem id="internetExplorer" type="radio" groupName="three"/>
<menuitem id="txtEditor" type="radio" groupName="three"/>
<menuitem id="AStoJS" type="radio" groupName="three"/>
<menuitem id="dragList" type="radio" groupName="three"/>
</menuitem>
<menuitem id="Windows">
<menuitem id="Componets" type="radio" groupName="four"/>
<menuitem id="Project" type="radio" groupName="four"/>
<menuitem id="Navigator" type="radio" groupName="four"/>
<menuitem id="Problems" type="radio" groupName="four"/>
<menuitem id="Debug" type="radio" groupName="four"/>
<menuitem id="State" type="radio" groupName="four"/>
</menuitem>
</mx:XMLList>
</mx:WindowedApplication>
FLV播放器的源代码:(Cairngorm框架的应用这里限于篇幅就不贴上来了,也请下载附件)
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:view="com.xi.flvPlayer.view.*"
xmlns:control="com.xi.flvPlayer.control.*"
layout="absolute"
width="624"
height="458"
showFlexChrome="false"
creationComplete="initApp();">
<mx:Script>
<
被折叠的 条评论
为什么被折叠?



