[fix it]how to init ClassA(inherite from Sprite) use SpriteBatchNode

how to init ClassA(inherite from Sprite) use SpriteBatchNode

  1. i have a class
    class ClassA :public cocos2d::Sprite
    {
    public:
    float speedX;
    *
    }
  2. i add many ClassA to screen, i find it use many memory/time, so i want to use SpriteBatchNode.
    but i find SpriteBatchNode, which is initWithFile (const char *fileImage, int capacity).

how to init with ClassA??

fix it:
1.
bool ClassA::init()
{
if ( !Sprite::init() )
{
return false;
}

if (this~~>texture != NULL)
{
//this~~>createWithTexture(this~~>texture);
this~~>initWithTexture(this~~>texture);
//this~~>setDisplayFrame(this~~>texture);
//CCLOG;
}
}
2. use:
SpriteBatchNode* batchNode = SpriteBatchNode::create;
this~~>addChild(batchNode);

Size s = Director::getInstance()>getVisibleSize;
for
{
float x = CCRANDOM_0_1*s.width;
float y = CCRANDOM_0_1s.height;
ClassA
o = new ClassA, x, y);
if )
{
o
>autorelease(); // public Cocos2d::Sprite 公共继承才行
}

batchNode->addChild((Node *)o);

}

Awesome!