Flex:上传图片前预览
<?xml version="1.0" encoding="utf-8"?>
<!-- http://yecon.blog.hexun.com/31030831_d.html -->
<!-- http://www.slsay.com -->
<Application name="FileReference_load_test"
xmlns="http://ns.adobe.com/mxml/2009"
xmlns:mx="library:adobe/flex/halo"
xmlns:net="flash.net.*"
layout="flex.layout.BasicLayout">
<Script>
<!--[CDATA[
import mx.controls.Alert;
import mx.utils.ObjectUtil;
private function btn_click(evt:MouseEvent):void {
var arr:Array = [];
arr.push(new FileFilter("Images", ".gif;*.jpeg;*.jpg;*.png"));
fileReference.browse(arr);
}
private function fileReference_select(evt:Event):void {
fileReference.load();
}
private function fileReference_complete(evt:Event):void {
img.source = fileReference.data;
Alert.show(ObjectUtil.toString(fileReference));
}
]]-->
</Script>
<Declarations>
<net:FileReference id="fileReference"
select="fileReference_select(event);"
complete="fileReference_complete(event);" />
</Declarations>
<mx:Panel id="panel"
layout="absolute"
horizontalCenter="0"
verticalCenter="0"
width="500"
height="300">
<mx:Image id="img"
verticalCenter="0"
horizontalCenter="0"
maxWidth="200"
maxHeight="200" />
<mx:ControlBar>
<mx:Button id="btn"
label="Browse and preview..."
click="btn_click(event);" />
<mx:Button label="Upload..."
enabled="false" />
</mx:ControlBar>
</mx:Panel>
</Application>
相关文档:
Blinds.as
package effects
{
import effects.effectClasses.BlindsInstance;
import mx.controls.scrollClasses.ScrollBarDirection;
import mx.effects.IEffectInstance;
import mx.effects.TweenEffect;
public class Blinds extends TweenEffect
{
......
1.当下载了flash builder 4 beta ,安装启动时候,回提示输入注册码。可通过网址https://freeriatools.adobe.com/flashbuilder4beta/ 输入Flex Builder 3 Serial #: 来换取 builder 4 beta的注册码。在邮件中查收
2.通过http://www.adobe.com/devnet/flex/videotraining/flex4beta/来学习flex4.个人感觉video做的很不 ......
用了3天时间写了这个 第一版本 进度图, 其实也是甘特图的一种了,
目前甘特图有很多软件了,但是在线的还比较少,而且功能比较单一,
不过国内的倒是有几个, 一个是异度的,一个是向日葵的,都是用JS写的
还有个用FLASH 写的 也很不错, 我用FLEX 写了个,问题还是有的,比如占用CPU
资源过高,不过扩展性到是很强 。 ......
Flex使用Loader和URLRequest加载本地图片示例:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
import mx.controls.Alert;
import flash.display.*;
i ......
MXML:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" fontSize="20" initialize="doinit()" mouseOver="getMouseTarget(event)">
<mx:ArrayCollection id="dgArray">
<mx:Object pid="1" name="秦始皇" time="秦" />
&nbs ......