View Full Version : function in another MC
I have a asfunction inside a movieclip that send information to a function in same movieclip
Now I like to move the receiver function in another MC but how do I make so asfunction can send information to the other movieclip that have the other function???
I try with movieclipsname.asfunction but that dont work
I have try asfunction:movieclipsname.MyFunc and asfunction:_root.movieclipsname.MyFunc
Now I have try asfunction:_parent._parent.movieclipsname.MyFunc and asfunction:_parent.movieclipsname.MyFunc
I forgot to tell that I have both in a scrollpane. (scroller and scroller2)
I have asfunction inside a MC and that connect to scroller2
the function is inside a MC and that connect to scroller
Hmm what is the address to another MC?
I have create a basic examplet, one MC (mc1) that have a button and one MC (mc2) have a function and a trace.
mc1
on(press)
{
exampel();
}
mc2
function exampel()
{
trace("Bye");
}
Artech
01-09-2006, 08:46 PM
depends on the pathing you use, in that last case if they were both on the main timeline you could just use
mc2.exampel(); // I assume you just mispelled "example"?
or you could use
_root.mc2.exampel();
Hmm no, that did not work :confused:
I attach a fla file
Very very strange.
This most be one of the most basic things in Actionscript and I can't get that to work :confused: :o
sophistikat
01-09-2006, 10:24 PM
give your circle mc an instance name of mc1 and your other mc an instance name of mc2
mc1.onRelease = function () {
mc2.example(); // u did spell example wrong
}
// outputs: Bye
Thanks
I can see now that I write example wrong :o
I forgot two important object
I have two scrollpane, I'm very sorry about I forgot that :o
I have now create a new fla file
The code most be in that two movieclip because in the first mc (mc1) I have a category menu (I use asfunction) so when I press a link at that menu it change the other menu (mc2)
The example I have attach have a asfunction and two scrollpane and two mc.
I have try this all day now so I have no idea how to make it work
I really dont now why it can be so hard to reach another function in another movieclip if I try to make it start from the root??
sophistikat
01-10-2006, 07:36 PM
i'll check your file but all you have to do is
// from MC1 to another MC2
_root.MC2.functionName();
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.