PDA

View Full Version : executing a function in onEnterFrame



javadi82
July 17th, 2003, 01:41 AM
A function has to "run"(execute) inside the onEnterFrame event method but the function does not seem to run when called. Why?

Example:

_root.onEnterFrame()=function(){
if(something==true){
performFunction();
}
}

function performFunction()
{
}

blah-de-blah
July 17th, 2003, 01:54 AM
shouldn't it be

this.onEnterFrame = function() {

or maybe

_root.onEnterFrame = function() {

There shouldn't be the () after the onenterframe...

javadi82
July 17th, 2003, 03:00 AM
sorry that was a typo.there is actually no "()" in the code.

e.s.x.s
July 17th, 2003, 04:46 AM
actually,there is no mistake in the code. but you can use
if(something){
}
instead of

if(something==true){
}
..
and u can place

function performFunction()
{
}

before

_root.onEnterFrame()=function(){
if(something==true){
performFunction();
}
}

e.s.x.s