PDA

View Full Version : Calling code to instances


JeT
01-15-2004, 06:12 AM
Hey all, I've got a large segment of code, that is currently on many instances. Is there a way I can have all the code stored in say, a keyframe, and then call it from the instance? like say 'call movement()' or something like that? is that the function thing?! i really dont know how to apply it. can someone help me?

many thanks!!

Ian Jones
01-15-2004, 12:46 PM
certainly is a good use for functions or perhaps even classes. Check www.actionscript.org for more info.

Maxx
01-15-2004, 03:30 PM
The way I usually set it up is as such - in your main timeline (usually frame 1), create the function that includes the code you need to run from each instance. On each instance, use a "_root.function(variable);" call. This will direct the code to look in the main timeline for the "function" function and pass it the "variable" variable, if necessary. And, to second Ian Jones's thought - hit actionscript.org. It rocks over there, what with the snippets and tuts and forums.

HTH

CGTalk Moderation
01-17-2006, 04:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.