Targeting mc's in an externally loaded swf

Hi,

I’m trying to target MC’s in a swf that im loading into my main swf in a holder mc called ‘holder’

In AS2 I would then target them by writing:

holder.myMc etc

but I can’t seem to target them properly in AS3 - If I ‘Debug > List Object’ my swf & all it’s clips are there but the path is:

holder.instance9.myMc

Where’s does the instance9 Come from?

If i try to include instance9 when targeting it flash tells me its an ‘undefined property’ & doesnt load the swf as normal.

function startLoad() {
 var mLoader:Loader = new Loader();
 var mRequest:URLRequest = new URLRequest(sitePlan);
 mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
 mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
 mLoader.load(mRequest);
}
function onCompleteHandler(loadEvent:Event) {
  holder.addChild(loadEvent.currentTarget.content);
 
}
function onProgressHandler(mProgress:ProgressEvent) {
var percent:Number = Math.round((mProgress.bytesLoaded/mProgress.bytesTotal) * 100);
 txt.text = percent.toString() + '%';
 
}
startLoad();
 
holder.p301.addEventListener(MouseEvent.CLICK, showToolTip);
function showToolTip() {
 trace('Plot 301')
}

Any tips??
Thanks in advance!

ps. I have just easked a similar question on the end of some one elses post but wanted to start a proper thread on it. Apologies if this is bad form!

instance9 is your loader class. The loader is actually a displayobject itself so there’s no need to use a ‘holder’. Just addchild the loader itself…

ok - so:
holder.addChild(loadEvent.currentTarget.content);
becomes:
addChild(loadEvent.currentTarget.content);
??
but how do I target the mc’s inside it?

just addChild(mLoader)

that’s enuf : )

Once it’s loaded you can access it’s children.

oh.

im now typing in ‘get children’ in google and not getting quite what I wanted!!! lol.

oh man, I dont think this AS3 is sinking in very quick.

…how do ‘access it’s children’ ?

I’ve tried to simplify it but I dont think Im getting it:


var request:URLRequest = new URLRequest("dalesview_work.swf");
var loader:Loader = new Loader()

loader.load(request);
addChild(loader);


loader.content.p301.addEventListener(MouseEvent.CLICK, showToolTip);
function showToolTip() {
	trace('Plot 301')
}

Basically Im tyring to load in a siteplan that has different plots in it - I’ve already been through the site plan & labelled each plot/movie clip as ‘p1’ ‘p2’… etc.

My main swf is just going to be the interface, loading in different siteplans - then showing tooltips with info over the diff plots.

I’ve got lots of XML stuff happening too & it’s the kind of thing i;ve done in AS2 but Im just not getting this child thing in AS3.

The above code returns an error: ‘access of possibly undefined property’ which I suppose is all the plots I’ve manually labelled?? Do i need to data type these in a loop?