CCObject* CCHierarchiesAnimate::copyWithZone (CCZone* pZone)
{
    CCZone* pNewZone = NULL;
    CCHierarchiesAnimate* pCopy = NULL;
    if(pZone && pZone->m_pCopyObject)
    {
        //in case of being called at sub class
        pCopy = dynamic_cast<CCHierarchiesAnimate*>(pZone->m_pCopyObject);
    }
    else
    {
        pCopy = new CCHierarchiesAnimate();
        pZone = pNewZone = new CCZone(pCopy);
    }
    
    CCActionInterval::copyWithZone(pZone); // call super class init once
    pCopy->initWithName(_animationName.c_str(), _spriteAnimationName.c_str()); // call super class init twice ??
    CC_SAFE_DELETE(pNewZone);
    return pCopy;
    
//    if (pCopy->initWithName(_animationName.c_str(), _spriteAnimationName.c_str())) {
//        CC_SAFE_DELETE(pNewZone);
//        return pCopy;
//    }
//    else {
//        CC_SAFE_DELETE(pNewZone);
//        return NULL;
//    }
}
CCHierarchiesAnimate* CCHierarchiesAnimate::createWholeAnimation (const char* spriteAnimationName) {
    CCHierarchiesAnimate* ret = new CCHierarchiesAnimate();
	if (ret->initWholeAnimation(spriteAnimationName))
	{
		ret->autorelease();
		return ret;
	}
	CC_SAFE_DELETE(ret);
	return NULL;
}
NS_CC_EXT_BEGIN

#pragma mark - CCHierarchiesAnimate

CCHierarchiesAnimate* CCHierarchiesAnimate::create (const char* animationName,
                                                    const char* spriteAnimationName) {
    CCHierarchiesAnimate* ret = new CCHierarchiesAnimate();
	if (ret->initWithName(animationName, spriteAnimationName))
	{
		ret->autorelease();
		return ret;
	}
	CC_SAFE_DELETE(ret);
	return NULL;
}