Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 10-21-2002, 03:04 PM   #1
jalb
Registered User
 
Join Date: Oct 2002
Posts: 1
Question Load data directly into ActionScript

Hi,
I would like to build a very simple Flash module that loads a list of string into a ListBox so that the user can make a choice. I use Flash MX. My problem is that I am unable to load the content of the data.txt file directly into the actionscipt variable. If I load it in a TextField to display it, there is no problem.
My data.txt contains : var1=string1;string2;string3;
My Actionscipt is at level 0 in the first layer and my ListBox is test23:
var1;
this.loadVariables("data.txt", 0);
test23.setSelectedIndex(0);
toke(var1);
function toke(liste)
{
rotate = true;
point = 0;
while (rotate) {
index = liste.indexOf(";",point)
if (index==-1) rotate=false;
else {
sub = liste.substring(point,index);
test23.addItem(sub,sub);
point = index+1;
}
}
}
How can I load data located in text files into ActionCript ?
Thank you.
Jalbert
jalb is offline   Reply With Quote
Old 10-21-2002, 03:20 PM   #2
i++
Registered User
 
Join Date: Sep 2002
Location: 5 feet over ground
Posts: 120
Default

hi jalb,

if you are using flash mx you can use the new LoadVars-object.
ActionScript Code:
myVars = new LoadVars(); myVars.load("test.txt"); myVars.onLoad = function() {     trace(this.var1); };
and you need to add a "&" in front of your variable string (also in flash 4/5):

&var1=string1;string2;string3

hope it helps

i++
i++ is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:43 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.