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

Linking Mc on stage with class Mc

Guest
Dec 18, 2014 Dec 18, 2014

Hello

I am trying to tell mc on stage to react to another one that is called by addchild and has a class name. I am doing this from the main timeline. How can I achieve this?

     if

     (this.currentFrame == 3) //Mc with class name that is on stage with addchild method. Called Mcl1//

     Mcl2.gotoAndPlay(1)   //Mc physically on stage with instance name//

Do I have to add enterframe events listener on the main timeline. (There is already one inside Mcl1 class code).

Any help is appreciated. Thanks.

TOPICS
ActionScript
305
Translate
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

Community Expert , Dec 19, 2014 Dec 19, 2014

if you want to do something when the current timeline reaches frame 3, yes you need to use a loop (like enterframe or a timer loop) to repeatedly check when the current frame is = 3.

eg,

this.addEventListener(Event.ENTER_FRAME,enterframeF);

function enterframeF(e:Event):void{

if(this.currentFrame==3){

Mcl2.gotoAndPlay(1);

this.removeEventListener(Event.ENTER_FRAME,enterframeF);

}

}

Translate
Community Expert ,
Dec 19, 2014 Dec 19, 2014

if you want to do something when the current timeline reaches frame 3, yes you need to use a loop (like enterframe or a timer loop) to repeatedly check when the current frame is = 3.

eg,

this.addEventListener(Event.ENTER_FRAME,enterframeF);

function enterframeF(e:Event):void{

if(this.currentFrame==3){

Mcl2.gotoAndPlay(1);

this.removeEventListener(Event.ENTER_FRAME,enterframeF);

}

}

Translate
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
Guest
Dec 20, 2014 Dec 20, 2014

Thank you!

Translate
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
Community Expert ,
Dec 20, 2014 Dec 20, 2014
LATEST

you're welcome.

Translate
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