Need help with setInterval

Hi

I have some problems applying a setInterval. I just wrote some code to create my menu on the stage. I’d like every menu-item to eppear with an interval.

Can some1 help me

Here is my file.

thanx in advance
scarlac

Hi

Thanx for correcting and adding code to it. I really appreciate. I started a few weeks ago with actionscript and it is going pretty well.

But I have a questions about it.

I don’t understand exactly why you are using that stg variable

Thanx in advance
scarlac

The reason i use stg variable is this:

var stg  = this;

var nIntfInMenu = setInterval(fInMenu, nSpdfInMenu);

function fInMenu(){
            trace(this)
}

If you run and try to trace previous, you will notice that you lost the refference to .this and it traces [COLOR=Red]undefined[/COLOR]. Also for anything else EXCEPT _root you get [COLOR=Red]undefined[/COLOR]. Now i think the reason to this is, because [COLOR=SeaGreen]setInterval[/COLOR] function works in different way than any other frame-dependant actionscript. But i am not sure, so anybody please enlighten me :). I am only sure, that i loose the refference to relative paths inside the movie.

Now as mentioned, you can use the absolute addressing: _root to refference previous, without using variable stg [from stage:P]. But i personally dont like using _root, because if for ex. i decide once that my .swf file will be preloaded into some other .swf-file [which will become it’s parent and also _root for everything inside] i would have to manually rewrite the code for its child :smiley:

Please ask if you didnt get something/i was unclear. Enjoy!