Problem with actions: Too much recursion

Hi,

I am getting an error after running a series of actions and it seems that something it is going on with the Skew that causes an error from the simulator: too much recursion.

If I comment the skew actions the code runs. Anybody with a similar situation. Is Skew now ready yet to use?

  var actionFadeOut = cc.fadeOut(0.4);
  this.questionImage.node.runAction(actionFadeOut);

  var durationFlip = 0.25; 
  var scaleXaction = cc.scaleTo(durationFlip, 0.03, this.questionImage.node.scaleY);
  var skewAction = cc.skewBy(durationFlip,0,20);
  var waitAction = cc.delayTime(durationFlip);

  var callbackFunction = function() {
    console.log('inside callback');
    
    var actionFadeIn = cc.FadeIn(0.1);   
    this.blockImage.runAction(actionFadeIn);

    // skew and flipping effect
    var unskewAction = cc.skewBy(0.25,0,-20);
    var restoreWidthAction = cc.scaleTo(0.25,1.0,this.blockImage.node.scaleY);
    var flipAction = cc.spawn(restoreWidthAction,unskewAction);
    
    this.blockImage.runAction(flipAction);
  }

  var invokeCallback = cc.CallFunc.create(callbackFunction);
  var completeFlipAction = cc.sequence(waitAction,invokeCallback);
  var flipAgainAction = cc.spawn(scaleXaction,skewAction,completeFlipAction);

  this.node.runAction(flipAgainAction);

I don’t have much experience with JS but I think the problem might be with cc.spawn. What happens if you replace skewAction with something else?

The Spawn implementation recursively creates spawn instances for every set of 2 actions:

spawn(A,B,C) will expand to spawn(A, spawn(B, C))

Maybe this is the recursion issue you’re seeing

Hi,
yesterday I get too much resursion error. it was because of a null variable.

@almax27 thanks for the clue, I did not use the spawn and just triggered the actions with direct calls and the error is gone, below what I did if it helps anybody else. At least this works for what I need.

// fade out the block question
var actionFadeOut = cc.fadeOut(0.4);
this.questionImage.node.runAction(actionFadeOut);

  var durationFlip = 0.25; 
  var scaleXaction = cc.scaleTo(durationFlip, 0.03, this.questionImage.node.scaleY);
  var skewAction = cc.skewBy(durationFlip,0,20);
  var waitAction = cc.delayTime(durationFlip);

  var callbackFunction = function() {
    
    console.log('inside callback');
    var actionFadeIn = cc.FadeIn(0.1); 

    this.blockImage.node.runAction(actionFadeIn);

    // skew and flipping effect
    var unskewAction = cc.skewBy(0.25,0,-20);
    var restoreWidthAction = cc.scaleTo(0.25,1.0,this.blockImage.node.scaleY);
    //var flipAction = cc.spawn(restoreWidthAction,unskewAction);
    
    //this.blockImage.runAction(flipAction);
    this.blockImage.node.runAction(restoreWidthAction);
    //this.blockImage.runAction(unskewAction);
    
    console.log('end of callback');
  }

  var invokeCallback = cc.CallFunc.create(callbackFunction,this);
  var completeFlipAction = cc.sequence(waitAction,invokeCallback);
  // removed the spawn
  //var flipAgainAction = cc.spawn(scaleXaction,skewAction,completeFlipAction);

  //this.node.runAction(flipAgainAction);
  this.node.runAction(scaleXaction);
  //this.node.runAction(skewAction);
  this.node.runAction(completeFlipAction);