title: cocos2d-x v3 sprite animation issue
body: <p>I have a little <strong>cocos2d-x v3</strong> Windows project and I want an animated sprite. The sprite I have in an object named Worker with other parameters. To run the animation I tried the following, but it always gives a segmentation fault:</p>
  
  <pre><code>//worker.cpp:
  
  ...
  
      void Worker::initAnimationWalk() {
          spritebatch = cocos2d::SpriteBatchNode::create("robo.png");
          auto cache = cocos2d::SpriteFrameCache::getInstance();
          cache-&gt;addSpriteFramesWithFile("robo.plist");
          worker = cocos2d::Sprite::createWithSpriteFrameName("robot1.png");
          //spritebatch-&gt;addChild(worker);
  
          Vector&lt;SpriteFrame *&gt; animFrames(3);
  
          char str[100] = {0};
  
          for(int i = 1; i &lt;= 3; i++) 
          {
              sprintf(str, "robot%i.png", i);
              cocos2d::SpriteFrame* frame = cache-&gt;getSpriteFrameByName( str );
              animFrames.pushBack(frame);
          }
  
          animation = cocos2d::Animation::createWithSpriteFrames(animFrames, 0.2f);
      }
  
  cocos2d::Animation *Worker::getAnimationWalk() {
      return animation;
  }
  
  ...
  
  //Worker.h
  
      #ifndef __WORKER_H__
      #define __WORKER_H__
  
      #include "cocos2d.h"
      class Worker
      {
      public:
          ...
          void initAnimationWalk();
          cocos2d::Animation *getAnimationWalk();
      private:
          cocos2d::Animation *animation;
          cocos2d::Sprite *worker;
          cocos2d::SpriteBatchNode *spritebatch;
      };
  
      #endif
  
  //Now i want the animation in my scene: 
  //HellowWorldScene.cpp
  
      void HelloWorld::setMyAction() { //all Worker Objects in an vector
          vector&lt;Worker&gt;::iterator it = workerVector.begin();
          for(int i = 0; i&lt;workerVector.size();i++) {
          it-&gt;getWorker()-&gt;stopAllActions();
                                  auto actionAnim = Animate::create(it-&gt;getAnimationWalk());
                                  if(it-&gt;getWorker()-&gt;getPosition().x &gt; 0.50*2*p.x) {
                                      auto action = cocos2d::MoveTo::create(it-&gt;getSpeed(),Point(0,it-&gt;getWorker()-&gt;getPosition().y));
                                      auto sp = Spawn::createWithTwoActions(action, actionAnim);
                                      it-&gt;getWorker()-&gt;runAction(sp);
                                      it-&gt;getWorker()-&gt;setFlipX(true);
                                  } else {
                                      auto action = cocos2d::MoveTo::create(it-&gt;getSpeed(),Point(2*p.x,it-&gt;getWorker()-&gt;getPosition().y));
                                      auto sp = Spawn::createWithTwoActions(action, actionAnim);
                                      it-&gt;getWorker()-&gt;runAction(sp);
                                      it-&gt;getWorker()-&gt;setFlipX(false);
                                  }
      }
      it++
      }
  </code></pre>
  
  <p>Any help?</p>