PDA

View Full Version : function call question


animus3
02-01-2006, 07:53 PM
ok.

my setup:
an FLA that loads a bunch of functions on first frame.
one of these functions is a closer function

my code for the closer function:
function closer() {
//for loop to cycle through and close clips
for (var i = 1; i<=140; i++) {
_root["page"+i].gotoAndPlay(2);
}
//removes clips from memory by moving clip timeline to empty keyframe
_root.columnLeft.gotoAndStop(2);
_root.columnRight.gotoAndStop(2);
_root.myCDMapText.gotoAndStop(2);
_root.cdMapState = false;
_root.myPlaceCheck();
}


my problem:
when I try to call the function from anything but a button flash igonores the command.

this works:

on(release){
_root.closer();
}

but this doesn't:
onClipEvent(load){
_root.closer();
}

and it doesn't work when called from root either:

(ie.) closer(); or _root.closer();
is ignored

any thoughts?

flashead
02-01-2006, 07:55 PM
where did you define the closer function?
unless you define in on the _root, you can't call _root.closer();
and you have to define it before you try to call it. which is probably why the onLoad didn't call it.
k.

animus3
02-01-2006, 07:56 PM
closer function is defined on the first frame of the main timeline
-t

flashead
02-01-2006, 07:59 PM
can you post a file? there's not much to work with here.

animus3
02-01-2006, 08:07 PM
the url's:

FLA: http://www.aagrating.com/example.fla
SWF: http://www.aagrating.com/example.swf

Note: it's a projector project meant to run on a client's end machine...not exactly web friendly, sorry.

-t

animus3
02-01-2006, 08:17 PM
thanks, i figured it out.

flashead
02-01-2006, 09:13 PM
post what you did to fix it.
if somebody stumbles on this thread in search of help, it's not going to be any good to them at this point.
thanks.
k.