User talk:Salmon

import com.threerings.msoy.export.AvatarControl; import com.threerings.msoy.export.ControlEvent; var _ctrl :AvatarControl = new AvatarControl(this); _ctrl.addEventListener(ControlEvent.APPEARANCE_CHANGED, updateLook); _ctrl.addEventListener(ControlEvent.ACTION_TRIGGERED, handleAction); _ctrl.setActions("Stop", "Shock"); var _shock :Boolean; updateLook; function updateLook (o :Object = null) :void {   var isMoving :Boolean = _ctrl.isMoving; var orient :Number = _ctrl.getOrientation; var scene :String; if (isMoving){ _shock = false; }

if (_shock){ scene = "shock_" + (orient < 180 ? "right" : "left");;

} else if (isMoving){ scene = "walk_" + (orient < 180 ? "right" : "left") + (orient > 91 && orient < 269 ? "_back" : "");; } else { scene = "face_" + (orient < 180 ? "right" : "left") + (orient > 91 && orient < 269 ? "_back" : "");; }    gotoAndPlay(1, scene); } function handleAction (event :ControlEvent) :void { switch (event.name) { case "Stop": _shock = false; updateLook; break; case "Shock": _shock = true; updateLook; break; } }