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

setInterval passing parameters

New Here ,
Nov 08, 2006 Nov 08, 2006
I'm wondering if someone has an idea why this won't work....

//------------------------------
function example(){
trace(this);
}
example();

setInterval(example, 100);
//-------------------------------------

When I call function without setInterval it traces "_level0" , but when function is called with setInterval, function traces "undefined". ...

Does anyone have idea how to fix this?
TOPICS
ActionScript
274
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

Advisor , Nov 08, 2006 Nov 08, 2006
replace your setInterval call with its alternative syntax:
setInterval(this, "example", 1000);
this identifies the scope of the function being called. see livedocs
Translate
Advisor ,
Nov 08, 2006 Nov 08, 2006
replace your setInterval call with its alternative syntax:
setInterval(this, "example", 1000);
this identifies the scope of the function being called. see livedocs
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
New Here ,
Nov 08, 2006 Nov 08, 2006
LATEST
Thank You... you help me a lot...
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