const {ccclass, property} = cc._decorator;

@ccclass
export default class Test extends cc.Component {
    onLoad() {
        this.node.getChildByName("btnPlay").on("click", () => {
            cc.resources.load("spineTest/W/skeleton", sp.SkeletonData, (err: Error, skData: sp.SkeletonData) => {
                if(err) {
                    cc.error(err);
                    return;
                }
                let sk: sp.Skeleton= this.node.getChildByName("spineNode").getComponent(sp.Skeleton);
                sk.skeletonData = skData;
                sk.animation = "W1";

                sk.setCompleteListener(() =>{
                    cc.log("complete!!!!!!!!!!!!!!");
                });
            });
        });

        this.node.getChildByName("btnRelease").on("click", () => {
            cc.resources.release("spineTest/W/skeleton");
        });
    }
}
