I would create a separate class for the armature(object).
Note: the code below worked with old versions of dragonbones; 4.x (untested).
Take Player.as for example, which could extend either of the following:
CitrusSprite, NapePhysicsObject or Box2DPhysicsObject
(or a custom class, which will extend one of the above in the hierarchy at some point)
public class Player extends Box2DPhysicsObject
{
private var armature:Armature;
private var armatureClip:Sprite;
public function Player(params:Object = null)
{
super(params);
armature = <someclassref>.dbFactory.buildArmature( "Player" );
armatureClip = armature.display.clone();
view = armatureClip;
WorldClock.clock.add( armature );
}
}
I can't confirm anymore whether you need the '.clone()' bit, test that yourself.
I'm assuming you already know how to do the initialisation of dragonbones,
and how to access the factory from an external class.
I was hoping to link the AS tutorial section I worked with a long time ago but it seems the dragonbones website has had a complete redesign, and some useful links are now broken. https://github.com/DragonBones/DragonBonesAS