flex实现读取本地文件
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
private var loader:URLLoader = new URLLoader();
private var request:URLRequest = new URLRequest("a.txt");
private function initComplete():void
{
loader.load(request);
loader.addEventListener(Event.COMPLETE, onComplete);
}
private function onComplete(event:Event):void
{
var loader:URLLoader = event.target as URLLoader;
if (loader != null)
{
trace(loader.data);
}
else
{
trace("loader is not a URLLoader!");
}
}
之所以要读取本地文件,是因为我没有安装FlexDataService没有发配置WebService的WSDL所以从文本中把它读出来,赋值给WebService的wsdl属性,但是我看FlexDeveloperGuid上有一句话
You configure destinations in the Flex services configuration file
or a file that it includes by reference.
这好像是说可以不用FDS,但是有不知道怎么弄,只好用这个不安全的方法,其实我们可以把字符串加密....呵呵
对了这样写的时候需要注意一点是给WebService的wsdl指定了之后还需要调用一个loadWSDL()方法,要不然不管用哦!
相关文档:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
<mx:Panel width="458" height="313" layout="absolute">
<mx:Label id="lbl" x="19" y="10" text="" width="171" height="20"/>
<mx:DataGrid id="dg" x="19" y="58" dataProvider="{arr}" editable="true" ......
1.下载eclipse的插件包:FB3_WWEJ_Plugin.exe
地址:http://trials.adobe.com/Applications/Flex/FlexBuilder/3/FB3_WWEJ_Plugin.exe
2.在任意目录建一个以下结构的目录:flex_plugin->eclipse->plugins和features
3.进入Flex Builder 3 的安装目录 将plugins目录下所有以 com.adobe 开头的文件或文件夹copy到上 ......
自定义类(BroadCastMarquee.as):
package marquee
{
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFiel ......
flash和flex针对不同的目的,提供了3种不同的坐标系。
全局的就是(stage级别的)
本地坐标系(组件级别的)
内容坐标系(相对于本地坐标系说的 ......