Flex文件读取报错示例
编程学习 2021-07-05 11:32www.dzhlxh.cn编程入门
这篇文章以示例的方式介绍了Flex文件读取报错的情况,需要的朋友可以参考下
Flex文件读取
1、s:WindowedApplication
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="initHandler()">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
/*初始化函数*/
protected function initHandler():void
{
var file:File = new File();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
</s:WindowedApplication>
2、File
var file:File = new File(File。applicationDirectory.nativePath+"/test.txt");
1、s:WindowedApplication
代码如下:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="initHandler()">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
/*初始化函数*/
protected function initHandler():void
{
var file:File = new File();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
</s:WindowedApplication>
2、File
代码如下:
var file:File = new File(File。applicationDirectory.nativePath+"/test.txt");