Targeting parent movie clips from a externally loaded swf AS3

Okay I'm trying to target the containing movie clip of an externally loaded swf with AS3.

im still kind of new to AS3. so bear with me....

first parent being the root of the loaded swf. and the next parent being the movieclip that contains the loader.

working AS2: _parent._parent.bg._visible = "false";

tested AS3: parent.parent.bg.visible = 'false";
error: 1119: Access of possibly undefined property bg through a reference with static type flash.display:DisplayObjectContainer.

attached is the method i used for loading the swf.
//placer.loadMovie("flash/vortex.swf");
bg.visible = false;
//stop();
stop();

import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.text.*;

var f:String = "vortex.swf";
var tf:TextField = new TextField();

var loader:Loader = new Loader();
var container= new MovieClip();

function preloader() {
	
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);

var request:URLRequest = new URLRequest(f);
loader.load(request);

addChild(container);

}

function onLoadProgress (event:ProgressEvent):void {

var loaded:Number = event.bytesLoaded;
var toLoad:Number = event.bytesTotal;
var total:Number = loaded/toLoad;{
//preloader_mc.preloaderFill_mc.scaleX = total;
loadText.text = Math.floor(total*100) + "%";
//preloader_mc.ofBytes_txt.text = loaded + " bytes";
//preloader_mc.totalBytes_txt.text = toLoad + " bytes";
}
}

function completeHandler(event:Event):void {
container.addChild(loader);
}
preloader();
play();

Open in new window

LVL 2
CybervanesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

blue-genieCommented:
not sure where you want to do this but assuming your bg is on the main timeline and after your swf is loaded you want to show your bg

function completeHandler(event:Event):void {
      container.addChild(loader);
      event.target.content.parent.root.bg.visible = true;
}
0
CybervanesAuthor Commented:
i need to be able to target the background MC of the main swf from the child swf.
0
blue-genieCommented:
when what happens? i.e what event?
0
CybervanesAuthor Commented:
when the time-line hits frame 15
0
blue-genieCommented:
ok what you want to do is obviously possible but if you're going to be developing in AS3 you want to start using classes and multiple frames etc.

in frame 15 of your loaded swf

MovieClip(parent.parent.parent).bg.visible = true; //where bg is the instance name.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.