由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Flash版 - Please help - how to assign the loaded txt/xml file's array to variables?
相关主题
这里就说flash吗?大家做完flash测试影片的时候遇到过内存不足的情况吗
AS3传参数给loaded swf?essential as3
如何从文本文件读取参数?很想用Flash展示图片,求建议
说起Flash--我的故事请问怎么用flash做动画电影?
罗尼,我还没有flash cs3请教一个变形问题(update)
带我入Flash门的书looking for ActionScript 3.0 Expert
用什么软件做flash?问个菜鸟的问题
请问能否用AS动态生成button?Flash 软件
相关话题的讨论汇总
话题: iobj话题: xml话题: 50话题: var话题: urlloader
进入Flash版参与讨论
1 (共1页)
f*******w
发帖数: 407
1
我是刚接触actionscript没到一个星期的新手,请版上的高手指教:
I use following flash actionscript code, got from online, to load the "
Loading.txt" file:
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void {
var myArrayOfLines:Array = e.target.data.split(/\n/,",");
}
myTextLoader.load(new URLRequest("Loading.txt"));
In "Loading.txt", the data of object in a row is (Dim1 Dim2 Dim3 OX OY OZ)
is:
60,12,9,-50,-50,50
84,12,9, 50, 50,50
Then I use onLoaded[i-1][j-1], in a loop to get the data in row i and column
j of the array, but I got some error message. Can somebody help me on this?
I am totally new to actionscript. The loop I used is like
var ArrayRows:int=2 // how to automatically get the number of rows of the
txt file?
for(iObj=0;iObj Dim1 = ObjDimArray[iObj][0]
Dim2 = ObjDimArray[iObj][1]
Dim3 = ObjDimArray[iObj][2]

OX = ObjOriginArray[iObj][3]
OY = ObjOriginArray[iObj][4]
OZ = ObjOriginArray[iObj][5]
}
Also, seems most people recommend using xml and I compiled an xml file "
Loading.xml" for above "Loading.txt" as below



HW
60
12
9
-50
-50
50


HW
84
12
9
50
50
50


I used following code to load the "Loading.xml". I would like to use a loop
to read all values and assign to a variable. Can anybody teach me how to do
that?
var myXML:XML = new XML();
var XML_URL:String = "Loading.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void
{
myXML = XML(myLoader.data);
trace("Data loaded.");
}
Please help - how to assign the loaded txt/xml file's array to variables?
I use following flash actionscript code, got from online, to load the "
Loading.txt" file:
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void {
var myArrayOfLines:Array = e.target.data.split(/\n/,",");
}
myTextLoader.load(new URLRequest("Loading.txt"));
In "Loading.txt", the data of object in a row is (Dim1 Dim2 Dim3 OX OY OZ)
is:
60,12,9,-50,-50,50
84,12,9, 50, 50,50
Then I use onLoaded[i-1][j-1], in a loop to get the data in row i and column
j of the array, but I got some error message. Can somebody help me on this?
I am totally new to actionscript. The loop I used is like
var ArrayRows:int=2 // how to automatically get the number of rows of the
txt file?
for(iObj=0;iObj Dim1 = ObjDimArray[iObj][0]
Dim2 = ObjDimArray[iObj][1]
Dim3 = ObjDimArray[iObj][2]

OX = ObjOriginArray[iObj][3]
OY = ObjOriginArray[iObj][4]
OZ = ObjOriginArray[iObj][5]
}
Also, seems most people recommend using xml and I compiled an xml file "
Loading.xml" for above "Loading.txt" as below



HW
60
12
9
-50
-50
50


HW
84
12
9
50
50
50


I used following code to load the "Loading.xml". I would like to use a loop
to read all values and assign to a variable. Can anybody teach me how to do
that?
var myXML:XML = new XML();
var XML_URL:String = "Loading.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void
{
myXML = XML(myLoader.data);
trace("Data loaded.");
}
非常感谢!
1 (共1页)
进入Flash版参与讨论
相关主题
Flash 软件罗尼,我还没有flash cs3
紧急求助文本框,在线等带我入Flash门的书
question about AS3 setCursor用什么软件做flash?
新手菜鸟问个button的弱问题请问能否用AS动态生成button?
这里就说flash吗?大家做完flash测试影片的时候遇到过内存不足的情况吗
AS3传参数给loaded swf?essential as3
如何从文本文件读取参数?很想用Flash展示图片,求建议
说起Flash--我的故事请问怎么用flash做动画电影?
相关话题的讨论汇总
话题: iobj话题: xml话题: 50话题: var话题: urlloader