Avatar creation FAQ

How do I set my hotspot?
The Hotspot is the point (x,y,z) where the Whirled object exists. Setting it at what would be the avatar's center on the floor (as if it were a 3-D object) makes perspective and layering in the Whirled much more convincing. Setting it at the bottom edge of the image makes your avatar appear to float when it comes in front of or behind other objects.

You can set your hotspot by changing its coordinates. Do this by placing your cursor at the bottom of the screen, at your character's center of gravity. (Somewhere between its legs...if it has legs.) Now look at the "Info" tab and write down the X and Y coordinates listed. Pop these into the right place in the script above and you are good to go. (Remember that avatars max out at 450 pixels high, so neither value should be above that.)

_control.setHotSpot(x,y,z);

How can I change the placement of my avatar's name?
You can call setHotSpot.

The third argument to setHotSpot will specify the height above the bottom of the avatar where your Avatar's name will be placed.

How can I make my avatar's name invisible?
_control.setHotSpot(x,y,reallyBigNumber);

Why does my avatar keep cycling through all of its scenes?
Most likely there is a bug in your code. When you compile a SWF with Adobe Flash CS3, if there are any major bugs, it will just create a movie that loops through all the scenes. Try to look for a window named "Compiler Errors" in CS3; this should tell you what you need to fix.

If you are getting the error "Type was not found or was not a compile-time constant: AvatarControl." then make sure that you have downloaded the Whirled SDK. Flash must also be configured to know where the Whirled SDK is.

Why is my avatar being cut off when I turn to the right?
If you are using the Advanced avatar (Flash tutorial) template, the Body class is automatically flipping your avatar to face the right direction, but will flip improperly if the Body is not set correctly in your code. On this line: _body = new Body(_ctrl, this, w); Make sure to replace the w with the width of your scene.

How big can my avatar be?
600 pixels wide by 450 pixels tall. Bigger avatars can be uploaded, but they are cropped to 600x400 on viewing.

How do you make an invert element in an avatar?
In Flash, set the Blend mode of your movieClip to Invert. In Actionscript, set a DisplayObject's blendMode property to flash.display.BlendMode.INVERT.

How do I stop an animation from looping?
stop;
 * 1) Go to the last frame of the animation.
 * 2) Hit F9.
 * 3) Type the following:

Note: If that isn't working, make sure 'script assist' is not clicked.

How do I randomly trigger an effect?
For this example we'll make randomly blinking eyes:

1. Make the eyes a movieclip symbol, and animate a blink (which may well be one frame).

2. Add about five frames between the first frame and the blink animation.



3. Put this script in a keyframe at the last frame before the blink: var blink:Number= Math.random*100; // creates a random number, 'blink', from 1 to 100 if(blink > 5){ // if 'blink' is greater than 5, or, with the above line, 'there is a 95% chance to...' gotoAndPlay(1); // ...loop back to the first frame }

This creates a cycle over the first five frames (where the eyes stay open). At the end of each cycle, it has a 95% chance of continuing the cycle (keeping the eyes open). We chose 'blink > 5' rather than 'blink < 95' because what you really want to say is that it has a 5% chance of blinking (not a 95% chance of not blinking). So, in the 5% chance the 'gotoAndPlay' event doesn't run, the playhead moves along the rest of the movieclip, where we have the blinking animation. At the end of the movieclip (as with any movieclip) it automatically loops back to the first frame, which conveniently drops it into the cycle again.

How do I create a cycle?
gotoAndPlay("dance01cycle");
 * 1) Locate  the first frame of your cycle and put a keyframe on the actions layer.
 * 2) Label it something like "dance01cycle". Now locate the last frame of the cycle and put a keyframe there. In the actions palette, type:

How do I make my avatar move faster or slower across a room?
The move speed is the rate at which your avatar will traverse a room at full size, in pixels per second. The default move speed is 500. Lower numbers are slower and higher numbers are faster. _ctrl.setMoveSpeed(n); Upload to Whirled and check your walk speed in action. Then go back to your source file and adjust up or down. The number "n" may not be less than 50.
 * 1) Add this line of ActionScript directly under your existing "_ctrl..." lines.
 * 2) Replace the n in the script with the speed you want for your avatar.

How do I get a .swf file of my avatar?
If you don't have a .swf file of you avatar, just open the .fla file and press Ctrl-Enter (or File &rarr; Publish) to publish a .swf file. After that, you can upload your avatar.

If your avatar was made from scratch, you may need to add the code mentioned in the question below.

How do I publish my avatar?
If you are using a base with the code already contained, you can just do File &rarr; Publish.

If you have created your avatar from scratch and it is ready to be published, create a single keyframe in your "main" scene. Add this ActionScript:

import com.whirled.AvatarControl; import com.whirled.ControlEvent; var _ctrl :AvatarControl = new AvatarControl(this); _ctrl.addEventListener(ControlEvent.APPEARANCE_CHANGED, updateLook); _ctrl.addEventListener(ControlEvent.STATE_CHANGED, updateLook); _ctrl.setHotSpot(150, 320); // Set these as the X, Y coordinates of the centerpoint of the "floor" between your avatar's feet _ctrl.registerStates("Default", "Dance 1", "Dance 2"); // Assuming you have dances, or other states to swap in updateLook; function updateLook (o :Object = null) :void {   var isMoving :Boolean = _ctrl.isMoving; var orient :Number = _ctrl.getOrientation; var scene :String = null; if (!isMoving) { var state :String = _ctrl.getState; if (state == "Dance 1") { scene = "dance_01" + "_" + (orient < 180 ? "right" : "left"); } else if (state == "Dance 2") { scene = "dance_02" + "_" + (orient < 180 ? "right" : "left"); }   }    if (scene == null) {  // if none of the above (not dancing, or is walking) scene = (isMoving ? "walk" : "face") + "_" + (orient < 180 ? "right" : "left"); }   gotoAndPlay(1, scene); }

This is a very important script. It lets Whirled know exactly what your character is capable of doing. If you have any actions other than "default," "walk" or "Dance" you will want to add them here in the "_ctrl.registerStates" line, and then add another "else if" statement further down for that specific action.

I get errors when I try to publish my avatar, what should I do?
If you get errors while publishing your avatar, you should first make sure that you have the classpaths set. You can find instructions on how to do that here.

If that wasn't the problem, you can try asking for debugging help in and/or. When you post asking for help, include information on what errors you get when you try to publish.

How do I make an avatar compatible with certain AVR games?
Some AVR games require the use of avatars with certain states and/or actions. Check the list of AVRG Avatar States for information on what states or actions the various games need.

How do I make remixable or configurable avatars?
For remixable avatars, check the information in these wiki pages or groups:
 * Color remixable avatar (Flash tutorial)
 * Remixable avatar (Flash tutorial)
 * Remix avatar (code tutorial)
 * Group

For configurable avatars, check the information links in configurable items.