Personal tools

AS3 avatar notes

From Whirled

Jump to: navigation, search
ActionScript Tutorial
Create a smiple avatar using AS3.
Difficulty Level
Beginner
Requirements
ActionScript 3.0, Whirled SDK
Other Information
Next tutorial: Advanced avatar (ActionScript tutorial)

(Back to create avatars main page)

This tutorial helps those using AS3 to build an avatar for Whirled. If you are interested in a less code oriented method using the Flash CS3 check out Advanced avatar (Flash tutorial). In this tutorial, we will be looking at numerous notes on avatars.


How to add a state to the list of states

_control.addEventListener(ControlEvent.STATE_CHANGED,stateChanged);
_control.registerStates(["State1","State2","State3", "..."]);

How to add code to the state

protected function stateChanged(event:ControlEvent):void
{
    if(_control.getState()=="State1")
        {
        docode
        }
    else if (_control.getState()=="State2")
        {
        docode
        }
 
    else if (_control.getState()=="State3")
        {
        docode
        }
    ...
}