views:

62

answers:

2

Hi,

I am a newbie at Flash/Flex and Actionscript 3.

I would like to know how can I create a dress up game in Flash/Actionscript where users can click on (not drag and drop) the available accessories/clothing and the avatar will display with the new selection immediately, and I can save the settings and take snapshot of the avatar in the new clothing selection. It will be good if there is references/tutorials that I can follow.

And secondly, may I know how do I save the selection, is it via xml or json or database? It will be good to store the clothes/accessories dynamically.

Thank you very much.

+1  A: 

If you're a newbie, you may want to have a look at some basic Flash programming tutorials, I think Colin Moock does a pretty good job of introducing Actionscript 3 in his "Lost Actionscript Week End" video series, which you should find on Adobe TV.

After this, you could have a look at Object Oriented Programming and Design Patterns, the Decorator pattern may be of particular interest for your game.

When you'll understand more about OOP, I don't think that saving a selection shouldn't be a problem, but you may have to look into a server side language like PHP...

PatrickS
A: 

You'll need to familiarize yourself with the basics first as PatrickS mentionned.

Once you're ready to dive in the development of this, you'll have to consider a few options in the way you store the avatar's appearance to a remote file / database.

A few options are: - Dynamically take a snapshot of your avatar (with a BitmapData.draw( ... ) call), and pass the byteArray of your snapshot to a URL where your server will expect and save your avatar to a file / database entry. - Dynamically take just the bare information needed (avatar skin color, clothing, accessories, positions maybe too), and pass this as a formatted string (can be XML, JSON, URL-Encoded even, whatever you're comfortable with) to a URL where your server will expect and save your avatar data to a file / database entry. To call this back though, you will need to develop also a writing mechanism for your Flash avatar to take this information back from the server and re-apply it.

The 1st method is the simplest way. On your server, you can use PHP's GD library to do the image manipulation if you need to crop or resize too.

And yes... I've done this before, too many times lol.

bigp