Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
My Carrier: NA

Saving data...

Hi,

 

My app has some as3 sprites in it (that the user modifies), what would be the best way to save these so the user can open them again if they close the app?

 

Thanks

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Saving data...

You wouldnt save the Sprite itself, but the characteristics of the sprite to restore it's state.  For example: x,y,rotation,size,color,etc.  Depending on the number of sprites and the complexity of the information, either XML or SQLite, which ever you are more comfortable with.

Please use plain text.
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
My Carrier: NA

Re: Saving data...

 

	var myFile:File = File.desktopDirectory.resolvePath("MyNewFile.txt");
			var fileStream:FileStream = new FileStream();
			fileStream.open(myFile, FileMode.UPDATE);
			fileStream.position = 10;
			fileStream.writeUTFBytes("AIR");
			fileStream.close();

 

Ok thanks, I found this example to write to my desktop, how could I make it write to the device?

 

 


--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Please use plain text.
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)
My Carrier: Mobile Vikings

Re: Saving data...

Such information can be found in the webcasts: Developer resources. You can download the slides and see lots of example source code.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.