Referrencing Objects in Different Levels

Hi,

Can someone Please help me out with how to reference objects in different levelts

There’s The Main Scene and two movie clips in the timeline

Movie Clip (loading_mc)
Movie Clip (scrolling)

how do we call for something in “loading_mc” from “scrolling” and visa versa

What im after is to remove a child added by “scrolling” using a script in “loading_mc”

Plzzz im stuck!!

Use parent to access the main scene then reference them from there.

the parent and child is a bit confusing to me still… so if you can write a piece of code that would help me better… Sorry for the fuzz im new to AS3

If you were in loading_mc, you would write parent.scrolling.

Thanks mate… what i herd was that we cant use names to refer movie clips in AS3 but i will try this… This all worked fine in AS2 but im trying to migrate to AS3 and having some issues

[QUOTE=flashhash;2355574]Thanks mate… what i herd was that we cant use names to refer movie clips in AS3 but i will try this… This all worked fine in AS2 but im trying to migrate to AS3 and having some issues[/QUOTE]
Whoever told you that is wrong.

All i get is this

1119: Access of possibly undefined property scrinside through a reference with static type flash.display:DisplayObjectContainer.

This is line of code i want to correct

“parent._scr.removeChild(thisMC);”

_scr being the instance name of the movie clip

ok i got that to work…

it should actually be MovieClip(root)._scr.removeChild(thisMC);

but now im getting an argument error saying the Caller is not the parent of the Display object.

can someone tell me the the way to removeChild(thisMC) from the other movie clip

I’m not sure I understand your setup, but try this:

parent.removeChild(thisMC);

I’m not sure if this helps, but if you can add the movie clips in the first place by making an instance of them (using their class Identifier in the Linkage properties). That way you can just type "removeChild(name of your instance) and since you added it through that class, it will disappear.

I’m not sure personally how you would do a pre-existing class, perhaps you need an instance name and linkage properties set up.

UPDATE: Yea, that worked for me. I had a pre-existing movie clip on the stage. I set up it’s linkage properties, and gave the instance on the stage a name. Then I simply did, removeChild(instancename).

Here’s my example. I have a movie clip object that is on the stage. The name of the movie clip in the library is menuBar. I set up the linkage properties (so my document class can see it). I then set the object on the stage to the instance name “thisMenuBar”. Here is what my document class, Document.as, looks like:

Man, this site’s advanced mode and Firefox3 on my mac are not playing nicely… sorry this isn’t code formatted,

package {
//import flash.geom.;
import flash.display.
;

public class Document extends Sprite {
	public function Document() {
		removeChild(thisMenuBar);
	}
}

}

Thanks i finally figured out how to do it… i had to create a function in the MovieClip “scroll”

function _unLoad():void{
SoundMixer.stopAll();
thisLoader.unload();
MovieClip(root).removeChild(thisMC);
}

and call that function from the other movieclip “loading_mc”

but that lead to another problem…

 i'm calling thisMC from both MovieClips so i need to find out how to refer to the caller..

btw im not using classes… i need to start doing that… my code’s getting complicated

Did you try:


thisMC.parent.removeChild(thisMC);