获取预加载图片

有个文件夹都是帧动画的小图,我能的是自动合图,我要怎么用代码生成这些帧动画
var clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, this.animFrameCount);
clip.name = animName;
clip.wrapMode = cc.WrapMode.Loop;
this._anim.addClip(clip);
this._anim.play(animName);
这里的spriteFrames怎么用代码生成

资源放到resources,获取对象。

cc.loader.loadRes(“test assets/sheep”, cc.SpriteAtlas, function (err, atlas) {
var frame = atlas.getSpriteFrame(‘sheep_down_0’);
sprite.spriteFrame = frame;
});

resources 里的资源怎么加入自动加载资源里,游戏最开始的时候加载