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>
相关文档:
今天找一些Flex资料,偶然发现很多人在问有关FABridge的问题,看了一下,大致都是在问在FlashBuilder中如何通过FABridge来实现F-A的交互。简单说说吧。
一.通过js访问Flex组件
1.准备工作。先建立Flex工程 :fademo,并放置一个文本框:txtName。做完后代码应该类似于这个样子:
<?xml version="1.0 ......
flex项目和组件等
open-source project : Flex
Adobe APIs
主要包含corelib, mappr, flickr, youtube及加密等类库.
http://labs.adobe.com/wiki/index.php/ActionScript_3:resources:apis:libraries
as3awss3lib
与 Amazon S3 交互的 ActionScript 3.0 类库
http://code.google.com/p/as3 ......
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 ......
(1)Event Listeners
Listening to parent objects does cause memory leaks
e.g.
& ......
今天在做项目的时候遇到了一个问题,访问xml文件就是成功不了。看了看以前写过的代码都可以,而这个项目中为什么就不行了呢?仔细查看了目录,是百思不得其解啊。
错误信息:*** Security Sandbox Violation ***
Connection to file:///C|/loading.swf halted - not permitted from xxxx/data.xml。这个xml是在工程里面sr ......