Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075919 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:28:47 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Saving an image in Flash
Pages: 1 [2]
Print
Author Topic: Saving an image in Flash  (Read 1637 times)
st33d
Guest
« Reply #20 on: September 04, 2011, 11:54:47 PM »

no, your image list is an array of images

you add that to the object, feed that to a ByteArray, compress it, save it, job done

when you want the images back you load the file as a ByteArray, uncompress it, use readObject on it, then use a for-in loop to see what the objects are

much as I'd love to write the entire code verbatim, I'm a bit busy Wink
Logged
Sean A.
Level 8
***



View Profile Email
« Reply #21 on: September 05, 2011, 07:06:23 AM »

Haha thanks it's just I've never had to use the object class like this. I should be able to do it from here on out. I'll post back with an update on how it turns out. Thanks again for all your help.
Logged
st33d
Guest
« Reply #22 on: September 05, 2011, 08:52:53 AM »

You should try doing a bit of Javascript. They do that sort of thing all the time.

Does wonders for your AS3 skills.
Logged
Sean A.
Level 8
***



View Profile Email
« Reply #23 on: September 05, 2011, 10:35:27 AM »

Alright so tested the method of adding the images to the object and writing it but the text file was way too small and the data never made it into the file. So then I tried writing just the BitmapData of each image to the object and saving that but there was even less data in the text file, just an index number for each image and tons of brackets. So lastly I downloaded a class that encodes and decodes BitmapData to and from strings. So I did that and then added each string to the object saved it and finally that worked.
Logged
Sean A.
Level 8
***



View Profile Email
« Reply #24 on: September 05, 2011, 12:23:33 PM »

God dammit. So apparently I can load the text file containing the images using FileReference just fine but I need to use the URLLoader class to load it (because when I am loading it, it needs to be automated and without pop-up window) and the URLLoader class can't load things as a ByteArray like FileReference can. So now I need a way to use the URLLoader class to load a text file as a ByteArray.

Edit: Ok turns out I fixed that problem but there is a weird End of File bug that happens occasionally when using the readObject method of the ByteArray class but it can be solved using byteArray.position = 0; before you readObject.
« Last Edit: September 05, 2011, 01:04:06 PM by Sean A. » Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic