Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

storing functions in one frame 1

Status
Not open for further replies.

kalimba

Technical User
Feb 5, 2001
11
US
I would like to create a set of functions and store them in one frame of my main timeline or in the timeline of a movie clip. However, I do not know how to call those functions from any timeline other than the one that they are stored in.

So my question is:
How do you call a function in a movieclip from a frame in another movie clip or from a frame in the main timeline?

thanks in advance
 
Pretty simple :) - when you are using the CALL actionscript, simply use an ABSOLUTE address to the frame you want to access - this cuts out the frustration of working out a relative pathe from where you are to where you want to get to.

I use the slash system (darn those dot addressing guys!), so for example, if your functions are in a frame in the main timeline labelled "function" (you NEED to lable the frame, and you can only have ONE function per frame), the target for the call function would be:

/:function

The "/" indicates the main timeline, and then you just add a colon and the frame label. If the function is in another movie clip, you could use:

/MCname:function

If you still don't get it (it's kinda awkward to explain), email me and I'll see if I can put it any better!
 
I still need help. This method does not seem to be working.
Let me list what I have tried:

movie clip with an instance name "test" has a frame labled "functions" in it's timeline.

here is the simple test function:

function moveLeft(thing){
setProperty(thing, _x, 0);
}

in the main timeline I have a single frame with a frame action that looks like this:

call(/test:functions)
moveLeft(box1);

on the stage I have a simple movie graphic with an instance name box1.

What am I doing wrong?

Thanks
 
It looks to me like an addressing problem. You are sending the name of the "thing" to the function in the movie clip TEST, so the function is looking for a movie clip called BOX1 inside the TEST movie clip. It should be looking in the main timeline (/).

That's all very confusing, so here's the deal ... try:

call(/test:functions)
moveLeft(/box1);

Let me know how it works out. If you want to email me personally about it, feel free. I'd be happy to help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top