Remix avatar (code tutorial)
Jump to navigation
Jump to search
| code Tutorial |
|---|
| Learn the basics about creating remixable avatars. |
| Difficulty Level |
| Advanced |
| Requirements |
| Other Information |
| See also: Remixable avatar (Flash tutorial) |
(Note: this is a first-pass at this documentation. It will be tidied.)
A remixable avatar is an avatar designed by a creator that has a built-in DataPack that can be edited on the Whirled web site by anyone that owns a copy of the avatar.
- First, create a directory in your avatar project to contain the _data.xml file as well as any default files to be included.
- See the instructions on the DataPack page for the format of the _data.xml file.
- Let's say you called your directory "mydata". In your avatar's build.xml file, add the following line:
<property name="app.data-dir" value="mydata"/>
- Now there's one more thing. You need to add a line for the default content to the datapack. Edit _data.xml and add one more file field: (make sure to replace swfname.swf with your own swf name.
<file name="_CONTENT" type="Blob" value="swfname.swf"/>
That's it! We hope to add some more tools to automate some of these steps.
When you build your avatar, the swf will be moved inside a zip file, along with the contents of your data dir. The zip file is the avatar media that would be uploaded to Whirled. If you run "ant test" it will actually test the zip file you've created.
To access the DataPack from within your avatar code, you simply do:
_ctrl = new AvatarControl(this); // create the avatar control var pack :DataPack = new DataPack(_ctrl.getDefaultDataPack());
And then the pack can be queried for files and data.