|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hello,
How do you read in a 2 dimensional array of ints from a file ? Its for the levels of my game... |
|
#2
|
|||
|
|||
|
OK, i tried the easiest way of my beginning in FLASH with loadvariables, coz
i'm a beginner.. To avoid headache thinking of a dimensional array, i would prefer to simplify it by using long code in flash (more code in flash).It is because, coding in FLASH, is quite easier . But it's worth for beginner First oFF, we want to have a simple 2 dimensional array PHP Code:
Let start with a load action from text file named Text.txt. The text file would have a code like these: &myDimensionalArray=pakcik:kantin,makcik:sekolah&quit=quit Then in the FLASH 5.0 1.loadVariablesNum ("Text.txt", 0);(Loaded after frame 1, just to make sure it is loaded, maybe frame 5) 2.The next frame, we try to make it as a 1 dimensional array first, by splitting the comma (,) first PHP Code:
#This is to check wether the Array is built OK #If it is working then we can continue #Output Array[0]=pakcik:kantin Array[1]=makcik:sekolah 3. In the same frame (If it is OK to view) , we can start splitting our array into 2 dimensional array PHP Code:
#The purpose of tmpArray is that, we cannot split the newTwoDArray[i] and assigning back to it again #Output Array[0]=pakcik:kantin Array[1]=makcik:sekolah Array[0][0]=pakcik Array[0][1]=kantin Array[1][0]=makcik Array[1][1]=sekolah #The first 2 lines is the 1 dimensional array, the rest is the 2 dimesional array Hope this will help, based on what i understand. Conclusion of the function PHP Code:
Last edited by pakcik_kantin : February 7th, 2003 at 01:35 PM. |
|
#3
|
|||
|
|||
|
thnx a lot for the large explication!
I'l get right on it ;-) |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Flash Development > reading 2dimensional array from file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|