, Jr. Member
This is my code for now, but I don’t know how can I use subclass similar to SkeletonClipNode in this function.
private function onAssetComplete(event:AssetEvent):void {
if (event.asset.assetType == AssetType.MESH) {
//grab mesh object and assign our material object
mesh = event.asset as Mesh;
mesh.castsShadows = true;
mesh.scale(6);
mesh.z = 200;
mesh.rotationY = -180;
scene.addChild(mesh);
//add our lookat object to the mesh
mesh.addChild(placeHolder);
} else if (event.asset.assetType == AssetType.SKELETON) {
skeleton = event.asset as Skeleton;
animationSet = new SkeletonAnimationSet();
animator = new SkeletonAnimator(animationSet, skeleton, false);
} else if (event.asset.assetType == AssetType.ANIMATION_STATE) {
var state:SkeletonAnimationState = event.asset as SkeletonAnimationState;
animationSet.addState(event.asset.assetNamespace, state);
state.addEventListener(AnimationStateEvent.PLAYBACK_COMPLETE, onPlaybackComplete);
}
}
private function onPlaybackComplete(event:AnimationStateEvent):void
{
animator.play(onceAnim, stateTransition);
}