Skip to main content
deborahb44958436
Inspiring
July 30, 2015
Answered

Function that does not function

  • July 30, 2015
  • 1 reply
  • 710 views

I'm terribly frustrated  the moment. This script worked until it didn't and I have no clue as what is wrong with it. The parts that doesn't work are the one that in bold. it's a basic condition that look for an item on stage and then go to the function should the item exist.  It works fine for a while  but then it stop responding to this condition anymore. I traced the object to make sure that it's on stage and it was on stage at the time of the test but still it just refused to go to this function. It should go to function first7Move3();  when yesh7bomb20 is on stage. all other conditions works just fine. Any clue as what's wrong? My sans is that it remembers a deleted code somehow because at one point I had removeChild (yesh7bomb20); in the first7Move3(); function but I had deleted that code . a bug maybe? how to go around it?




if (add7bigGrayBall4.currentFrame == 30) {     

  if (yesh7bomb17.currentFrame == 91) {   

    gotoAndPlay(139); 

  } else if (stage.contains(yesh7bomb20)) {   

    first7Move3();

  } else if (stage.contains(yesh7bomb16)) {   

    first7Move2(); 

  } else {   

    first7Move1(); 

  }   

} else {     

  add7bigGrayBall4.gotoAndPlay(1);   

}     

     

     

function first7Move2(): void {     

     

  removeChild(yesh7bomb16);   

  addChild(yesh7bomb17);   

  yesh7bomb17.x = 321.30;   

  yesh7bomb17.y = 109.85;   

  yesh7bomb17.gotoAndPlay(1);   

  if (stage.contains(yesh7Buket1a)) {   

    removeChild(yesh7Buket1a); 

  }   

  if (stage.contains(yesh7bomb3)) {   

    removeChild(yesh7bomb3); 

  }   

}     

function first7Move1(): void {     

     

  addChild(yesh7bomb16);   

  yesh7bomb16.x = 321.30;   

  yesh7bomb16.y = 109.85;   

  yesh7bomb16.gotoAndPlay(1);   

  if (stage.contains(yesh7Bucket_Cover2)) {   

    removeChild(yesh7Bucket_Cover2); 

  }   

  if (stage.contains(yesh7bomb2)) {   

    removeChild(yesh7bomb2); 

  }   

  if (stage.contains(yesh7gBall16)) {   

    removeChild(yesh7gBall16); 

  }   

}     

     

function first7Move3(): void {   

  addChild(yesh7bomb19);   

  yesh7bomb19.x = 321.30;   

  yesh7bomb19.y = 109.85;   

  yesh7bomb19.gotoAndPlay(1);   

 

}     

     

     

trace(yesh7bomb20);   

     

This topic has been closed for replies.
Correct answer Ned Murphy

Try using the trace function before that conditional to see if the value you expect for stage.contains(yesh7bomb20)  is what you think it is...  trace(stage.contains(yesh7bomb20));

If it woes what is expected then do similar checking inside the function that it leads to calling

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
July 30, 2015

Try using the trace function before that conditional to see if the value you expect for stage.contains(yesh7bomb20)  is what you think it is...  trace(stage.contains(yesh7bomb20));

If it woes what is expected then do similar checking inside the function that it leads to calling

deborahb44958436
Inspiring
July 31, 2015

Ok got it. turns out there was another similar object to the yesh7bomb20 doing similar but not identical thing and  I had to alter between them both. so I just had to insert another condition to cover the other object.

Thank you for your help. great tip.

Ned Murphy
Legend
July 31, 2015

You're welcome