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

delete myCountDown.onEnterFrame

Participant ,
Apr 10, 2013 Apr 10, 2013

How do I delete the onEnterframe. This is my code:

function myCountDown(){

//do something

}

RecLoad.onData = function(src) {

if (condition == true) {

_root.onEnterFrame = myCountDown; // works fine

}

}

Clear_btn.onRelease = function () {

delete myCountDown.onEnterFrame;  //does not respond

}

TOPICS
ActionScript
750
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 , Apr 10, 2013 Apr 10, 2013

use:

function myCountDown(){

//do something

}

RecLoad.onData = function(src) {

if (condition == true) {

_root.onEnterFrame = myCountDown; // works fine

}

}

Clear_btn.onRelease = function () {

delete _root.onEnterFrame;

}

Translate
Community Expert ,
Apr 10, 2013 Apr 10, 2013

use:

function myCountDown(){

//do something

}

RecLoad.onData = function(src) {

if (condition == true) {

_root.onEnterFrame = myCountDown; // works fine

}

}

Clear_btn.onRelease = function () {

delete _root.onEnterFrame;

}

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
Participant ,
Apr 10, 2013 Apr 10, 2013

Thanks Kglad.

Will that affect if there are more onEnterFrame functions running?

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 ,
Apr 10, 2013 Apr 10, 2013

you can only have, at most, one onEnterFrame per movieclip in as2.  so, if you used:

_root.onEnterFrame=f1;

_root.onEnterFrame=f2;

only the last executed one (calling f2 repeatedly) will exist.  the first (calling f1 repeatedly) is overwritten and replaced.

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
Participant ,
Apr 10, 2013 Apr 10, 2013

Thanks again.

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 ,
Apr 10, 2013 Apr 10, 2013
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