Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-01-2004, 10:58 PM   #1
Disjuku
Registered User
 
Disjuku's Avatar
 
Join Date: Dec 2003
Location: New Zealand
Posts: 218
Send a message via Yahoo to Disjuku
Default loading text from a file

I am wondering if anyone would know how I can get info from a text file etc, ie. I want flash to read a bunch of characters, each representing a "tile" in flash and build a map out of it

example of the text file

xooooooOOOoooooooooox
oxxxxxxxxxxxxxpxxxxxo
oxxxpxxxxxpxxxxxxxxxO
OxxxxxxxxxxxxxxxxxxxO
OxxxxxxxxpxxxxxpxxxxO
Oxxxpxxxxxxxxxxxxxxxo
xooooooooooooOOOoooox

where the x may be grass, the o a rock, and the O a tile which makes the user go to a different level thing, and the p a tree etc

Then flash reads this and fills a grid according to what characters were in the text file
Disjuku is offline   Reply With Quote
Old 02-01-2004, 11:10 PM   #2
splict
spend my time in blender
 
splict's Avatar
 
Join Date: Oct 2003
Location: tampa, fl
Posts: 1,138
Default

The best way to do this is with an array. If you wanna pull stuff out of a text file you can.

The common way is of course LoadVariabless. you could have the string like
&grid=oooooooooooooooxxxxxxxxxxxxoxoxoxoooxxooO OO
or
&row1=oooooooooooooxxxxoxooxx&row2=oooxoxooxoox xxx
etc. Then just read the letters and manipulate them with the various String and or Array functions.

If none of this was what you were asking, but instead want to know what to do once its inside flash then, sorry, ignore that and ask again

-splict
__________________

Certified Flash MX 2004 Developer

Last edited by splict; 02-01-2004 at 11:12 PM.
splict is offline   Reply With Quote
Old 02-01-2004, 11:16 PM   #3
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

I see that splict is beating me all day long... I think it's time for me to retire...

Don't get confused though, splict... This is F5 forum...
You know what that means, Disjuku??? Go get FMX at least... You are missing too many things and you are wanting too many things...


Yeah... What splict says... But you'd need to use loadVariables() function instead... There are tons of threads that tells you how to load text file into F5 since you are not the first one who's asking that...

So, let me skip that part, but here is the tone downed version with the array...
PHP Code:
str "xooooooOOOoooooooooox|oxxxxxxxxxxxxxpxxxxxo";
map_arr str.split("|");
map_arr[0] = map_arr[0].split("");
map_arr[1] = map_arr[1].split("");
trace(map_arr[0]);
trace(map_arr[1]); 
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 02-01-2004, 11:28 PM   #4
splict
spend my time in blender
 
splict's Avatar
 
Join Date: Oct 2003
Location: tampa, fl
Posts: 1,138
Default

i don't know why I always do that when Disjuku posts. but actually i immediately went back and adjusted it for flash 5 (loadVariables and no onData) i thought i had done it quick enough that no one would notice.

And yeah, there are still a couple versions of code you could use, CyanBlue's probably being the best and most common - I just wanted to make sure I got the question right before I got into code.

Anyways, my posts today have been a bit off - SuperBowl drinking and all, (though I had my face in my new book the whole time )
__________________

Certified Flash MX 2004 Developer
splict is offline   Reply With Quote
Old 02-01-2004, 11:47 PM   #5
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Hehe... The basic rule of thumb is to edit the post before you actually see that annoying 'Last edited by ...' line... If you edit the post and you see that line, you've done it too late...

Well... Yeah... AS.org has been online long enough... I guess at least 75% of the so-called 'unique' problems are already discussed in the past... It's just the people who do not/can not search the forum to find the right answer AND the crude search capability built in this vBulletin...

Hey, nothing wrong with the posts going off... It is sort of a trend thesedays... 7/10 threads go OT with no apparent reason like this thread...

Well... Good night, everybody and splict... I've got to call it a day...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 02-02-2004, 03:26 AM   #6
Disjuku
Registered User
 
Disjuku's Avatar
 
Join Date: Dec 2003
Location: New Zealand
Posts: 218
Send a message via Yahoo to Disjuku
Default

lol, its been crazy in here :|, I generally cant find what I am after with the search, it either brings up heaps of MX stuff or I am unable to find anything good which I can manipulate for my own useage, or the last person to ask worded it differently from how I did :/ - and yeah, I need flash MX lol, I have been working for a bit, just about to buy my own laptop, then I will have no money again, and I will be at uni, so I dont see any money to buy it with coming my way in the near future , anyway, I will go off and try to work out what you have said above

Man I ask a lot of questions here, at least I am learning as I go, and I do try to contrubute more than I use :P - pitty the three games I have been working on have kinda come to a stand still, the first one ended up with too many things I cant do, second one I am still building up the courage to hit the AI of the computer player, and this third one (a bit like zelda etc, more like graal if you have ever played that) is going to be so horrible I doubt I will ever make it past the character movement, but the main thing is that I am learning how to do things, I managed to complete most of the second game on my own, where as the first one was nearly all done through help on here, anyway, thanks! lol
Disjuku is offline   Reply With Quote
Old 02-02-2004, 09:01 AM   #7
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Well... The only suggestion for you, Disjuku, is that you really have to spend time to find the information that you are seeking from the forum... I've been watching your questions and lots of them looked like you didn't really need to post the thread since they were answered before... One more thing about the search is that you learn by browsing other people's posts as well...

I know how tough it is to get the new program if you do not make enough money... But you should be able to get the educational version when you go to school... So, get it that way no matter how much it costs... You should not really stay with F5 for your own good...

As for your projects, it doesn't really matter whether you've done it with other people's help or not... You learn something while you do the project... That's all that matter...

Well... Thank you for your contirbution at the forum and good luck on your journey...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 02-02-2004, 04:47 PM   #8
Disjuku
Registered User
 
Disjuku's Avatar
 
Join Date: Dec 2003
Location: New Zealand
Posts: 218
Send a message via Yahoo to Disjuku
Default

lol yeah, I should get a job when I come down for holidays, might just be able to stick some of that money aside ;P
Disjuku 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
loading an object from an array NateVeronica ActionScript 2.0 1 03-30-2004 10:53 PM


All times are GMT. The time now is 02:09 AM.

///
Follow actionscriptorg on Twitter

 


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