• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Function that does not function

Participant ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

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);   

     

TOPICS
ActionScript

Views

368

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 30, 2015 Jul 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

Votes

Translate

Translate
LEGEND ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

does trace have a wild card to show you every item on stage?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

No, but you might be able to use it in a loop where you use numChildren as the loop counter and then trace using the getChildAt() method...

for(var i:int=0; i<numChildren; i++){

     trace(getChildAt(i).name)

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

so I'm getting a lot of these which don't mean a lot to me. how can I get it with the name that I actually gave it.

instance1

instance232

instance236

instance240

instance42

instance50

instance58

instance60

instance66

instance116

instance105

instance119

instance122

instance246

instance248

instance250

instance606

instance607

instance608

instance609

instance610

instance611

instance612

instance613

instance614

instance615

instance616

instance617

instance618

instance619

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

How did you assign the names?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

mostly by actionscript linkage class in properties and then in var. some are permanent on the stage but i don't care to now if they are there since obviously i know where they are.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

Classes are not names.  If you do not assign them names then you will get the default names that you listed.  If you want to see the class names try the following instead...

for(var i:int=0; i<numChildren; i++){

     trace(getChildAt(i));

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

This one works. Thank you so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 31, 2015 Jul 31, 2015

Copy link to clipboard

Copied

LATEST

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines