Skip to main content
June 16, 2009
Question

Preloading IK Armature problem

  • June 16, 2009
  • 1 reply
  • 372 views

Hi.

I'm not especially gifted at actionscripting, but I adapted this for use in a geared mechanism in Flash CS4. It worked fine in beta, but now I have to preload it for deployment on my website. Using a simple preloader.swf as a wrapper seems to make the ik armature referenced in the code revert to type:authortime instead of runtime, meaning the scripted (user interactable) animation will not run. Using traces, I know that the point variable (pt) is being correctly generated, but the moveTo command is not firing.

For the purposes of comparison, I also called an swf of the above tutorial example into the same preloader and the same thing happened (so I know it's not any changes to the code I made). The publish settings of both the preloader and the called swf are identical.

Is anyone aware of any way around this? I can't find any documentation relating to preloading user-interactable IKBones, though I'm assuming it's something people have done successfully...

Thanks

This topic has been closed for replies.

1 reply

June 17, 2009

Found some adaptable code: http://www.mad.com.au/blog/?p=208

Actionscript for the preloader swf
import fl.ik.*;
import flash.display.*;

//load the bones swf
var request:URLRequest = new URLRequest("bones.swf");
var loader:Loader = new Loader();
loader.load(request);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, init);

//set up the vars
var boneClip:Sprite;
var myArmature:IKArmature;

function init(e:Event):void{
     //add the clip to the stage
     boneClip = Sprite(loader.content);
     addChild(boneClip);
     //set up IK
     IKManager.setStage(stage);
     myArmature = IKManager.getArmatureAt(0);
     myArmature.registerElements(stage);
     IKManager.trackAllArmatures(true);
}

The IK Armature has to be declared in the wrapper for it to be accessible at runtime.