Hi guys..
Im trying to load multiple SPINE animations and each store in an array.
Problem is that, i cant access loaded SPINE animations created as an array inside onAssetsLoaded function. Arrays are defined outside of onAssetsLoaded function, which is why im confused. Here it is..
var ANIMATION_SPINE=[]; //declared outside of any function
..then i load animated character like this,
PIXI.loader.add('character', spineJSON_filename).load(onAssetsLoaded);
..and onAssetsLoaded function looks like this..
function onAssetsLoaded(loader,res)
{
ANIMATION_SPINE.push(new PIXI.spine.Spine(res.character.spineData));
ANIMATION_SPINE[ANIMATION_SPINE.length-1].skeleton.setSkinByName( 'skin1');
ANIMATION_SPINE[ANIMATION_SPINE.length-1].x = 600;
ANIMATION_SPINE[ANIMATION_SPINE.length-1].y = 600;
ANIMATION_SPINE[ANIMATION_SPINE.length-1].skeleton.setSlotsToSetupPose();
ANIMATION_SPINE[ANIMATION_SPINE.length-1].scale.set(1.0);
ANIMATION_SPINE[ANIMATION_SPINE.length-1].state.setAnimation(0, 'walk', true);
GAME.stage.addChild(ANIMATION_SPINE[ANIMATION_SPINE.length-1]);
}
..after this, i see my character on the screen and its properly animated..however, i cant access ANIMATION_SPINE (i want to change animations, or skins, etc, in runtime) array outside of onAssetsLoaded() even its declared outside of any function..how to do this? How to store animations inside array from where i can access them globally ?? Thank you in advance guys.