### Author Topic: Binary numbers  (Read 2149 times)

#### !8bit!man

• Active Member
• Posts: 210
• Karma: +0/-0
• Hack Hack Hack!!
##### Binary numbers
« on: Sun, Dec 4, 2011 »
Hi guys, it's possible to make a binary variable? i need it to save tons of data into a single save (made with flxsave).

if not how can i save lots of data in a single save file?

#### wg/funstorm

• Global Moderator
• Key Contributor
• Posts: 596
• Karma: +0/-0
##### Re: Binary numbers
« Reply #1 on: Sun, Dec 4, 2011 »

#### camasthecat

• Contributor
• Posts: 461
• Karma: +0/-0
• WOW! 400+ Posts!? Jeez! Do I have a life!?!?
##### Re: Binary numbers
« Reply #2 on: Sun, Dec 4, 2011 »
Code: [Select]
`if not how can i save lots of data in a single save file?`
I use a normal array.

#### !8bit!man

• Active Member
• Posts: 210
• Karma: +0/-0
• Hack Hack Hack!!
##### Re: Binary numbers
« Reply #3 on: Sun, Dec 4, 2011 »
but arrays in as3 works like C's arrays? if not how they work?

#### KWarp

• Active Member
• Posts: 105
• Karma: +0/-0
• Game Programmer
##### Re: Binary numbers
« Reply #4 on: Sun, Dec 4, 2011 »
AS3 arrays are implemented as Objects (Hashmaps) that only accept numbers as keys. It's kind of silly.

This is why you can do:

Code: [Select]
`var array:Array = new Array();array[-1] = "pickles"; `
To understand recursion, you must first understand recursion.

#### !8bit!man

• Active Member
• Posts: 210
• Karma: +0/-0
• Hack Hack Hack!!
##### Re: Binary numbers
« Reply #5 on: Mon, Dec 5, 2011 »
So array can store all the data of the world? and you assign a value by putting a number into []? that's more easy than C.

and, after i saved that array, when i load it for read the data in a certain position i put something like  x= y[positionthatiwant]?

#### photonstorm

• Key Contributor
• Posts: 1502
• Karma: +1/-0
##### Re: Binary numbers
« Reply #6 on: Mon, Dec 5, 2011 »
AS3 arrays are implemented as Objects (Hashmaps) that only accept numbers as keys. It's kind of silly.

Actually you can use anything as the key. String, Object ... The AS3 docs say to use an integer, but for some reason it doesn't actually enforce it even in strict mode.
http://www.photonstorm.com

"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

#### !8bit!man

• Active Member
• Posts: 210
• Karma: +0/-0
• Hack Hack Hack!!
##### Re: Binary numbers
« Reply #7 on: Wed, Dec 7, 2011 »
Well, i've saved an array with FlxSave but when i've tried to load it the save file was empty and my array became null. why this happens?

#### camasthecat

• Contributor
• Posts: 461
• Karma: +0/-0
• WOW! 400+ Posts!? Jeez! Do I have a life!?!?
##### Re: Binary numbers
« Reply #8 on: Wed, Dec 7, 2011 »
Did you bind the save?
Code: [Select]
`_save = new FlxSave();_save.bind("The Save");`
Oh, and you have to make a variable in the FlxSprite:
Quote
_save.data.theVariable = theArray;

#### !8bit!man

• Active Member
• Posts: 210
• Karma: +0/-0
• Hack Hack Hack!!
##### Re: Binary numbers
« Reply #9 on: Thu, Dec 8, 2011 »
It's exactly what i've done. it's for that reason that i can't understand why it do that?
it's possible that flixel 2.35 can't save arrays?

#### !8bit!man

• Active Member
• Posts: 210
• Karma: +0/-0
• Hack Hack Hack!!
##### Re: Binary numbers
« Reply #10 on: Thu, Dec 8, 2011 »
Nothing. i've fixed it.

thanks you guys anyway

#### Alextfish

• Active Member
• Posts: 174
• Karma: +0/-0
##### Re: Binary numbers
« Reply #11 on: Thu, Dec 8, 2011 »
What was the problem? That way you'll help other people who find it and haven't found the fix yet

#### !8bit!man

• Active Member
• Posts: 210
• Karma: +0/-0
• Hack Hack Hack!!
##### Re: Binary numbers
« Reply #12 on: Thu, Dec 8, 2011 »
It was a really nooby problem... i was saving the array in a slot with a different letter from the one i was trying to load..

#### camasthecat

• Contributor
• Posts: 461
• Karma: +0/-0
• WOW! 400+ Posts!? Jeez! Do I have a life!?!?
##### Re: Binary numbers
« Reply #13 on: Fri, Dec 9, 2011 »
It was a really nooby problem... i was saving the array in a slot with a different letter from the one i was trying to load..

This is one of those "durf" moments we all have. Glad you found the problem.