PDA

View Full Version : AS Paths and stuff (MX)



Raydred
November 22nd, 2002, 12:34 PM
Ok im having troubles with my paths to things.

I am using relative path, im trying to set a variable from one MC to another..


Heres how i have it structured..


MainMC --
|
----- MC1
|
----- MC2



Now i want to set a variable from MC1 to MC2

But for whatever reason its not working.

And yes i have the instance named, and its on the same layer..

hmm.. any ideas?

Raydred
November 22nd, 2002, 01:42 PM
wow either, i Make no sense, or i post some pretty advanced stuff that no one knows of lol =)

I think i make no sense lol.

h88
November 22nd, 2002, 01:54 PM
Did u try this:


_parent.MC2.h88 = 12

h88
November 22nd, 2002, 02:04 PM
When u test the movie, and list the variables, the output would be:


Level #0:
Variable _level0.$version = "WIN 6,0,21,0"
Movie Clip: Target="_level0.MC1"
Movie Clip: Target="_level0.MC2"
Variable _level0.MC2.h88 = 12

Notice that h88 variable had been succesfully declared and set to 12. And offcourse it was set in MC1 by the code above.

yours,
h88

Raydred
November 22nd, 2002, 02:43 PM
ok, a little further..

Now this is a movie that will be loaded in..

now _root is the Main movie, and not the movie loaded in.

does _parent. Refers to the movie loaded in the main movie?

h88
November 22nd, 2002, 03:14 PM
_parent Property specifies or returns a reference to the movie clip or object that contains the current movie clip or object. The current object is the object containing the ActionScript code that references _parent. Use _parent to specify a relative path to movie clips or objects that are above the current movie clip or object.

Raydred
November 22nd, 2002, 03:44 PM
ok..

I understand that a little better now..


Ok, now what if you want to access or set information from a movie clip above that one (in the hierarchy structure.)

ex:

_root.thisMc.insideMc
thats the one i want to give info to.. (in a variable)

and its comming from

_root.thisMc.insideMc.myMc;

so i want to do something like this..

thisMc.newVar = myMc.SomeVar;

i can do that only if i use.. _root.

But i need those paths to be relatvie.. is that possible?

the reason i ask is im creating a flash thing that dynamically loads movies into it, and i need to reference stuff correctly in order to work.. i need the loaded mc to be pretty much indepentant and relative. =)

h88
November 22nd, 2002, 04:27 PM
Umm, can u rephrase that, i really can't get what your trying to achieve, anyways, this should work, _parent should be used when u try to access relative path, or accessing an absoulute, like:


_root.MCParent.MCChiled.MCSubChiled.h88 = 23123

Try experimenting with the above code and the last post too, and tell me how it goes!

yours,
h88

Raydred
November 22nd, 2002, 04:52 PM
im looking for something more like..



../../myMc.My2mc

../ meaning go up one level in the hierarcy.. just not sure how to do that.

h88
November 22nd, 2002, 04:57 PM
../../myMc.My2mc

_parent._parent.myMC.My2mc

Raydred
November 22nd, 2002, 05:03 PM
oh ok cool =)
thanks alot ! =)

h88
November 22nd, 2002, 05:04 PM
No problem. :)

PS. What a no. of posts u got Raydrad, 784392011.983, i wish i got the same number.