PDA

View Full Version : function in another MC


Cazz
01-09-2006, 05:51 PM
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

Cazz
01-09-2006, 07:08 PM
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

Cazz
01-09-2006, 08:41 PM
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();

Cazz
01-09-2006, 09:03 PM
Hmm no, that did not work :confused:

I attach a fla file

Cazz
01-09-2006, 10:06 PM
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

Cazz
01-09-2006, 11:17 PM
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

Cazz
01-10-2006, 07:21 PM
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();