how do I nest movieclip through code

petersego
petersego used Ask the Experts™
on
I have a movieclip-container, where i want a loader nested - both created through code - see codesnippet.

How do I nest the loader insíde the movieclip - the code below doesnt work..
var myLoaderCon:MovieClip = new MovieClip();
myLoaderCon.x=20;
myLoaderCon.y=100;
myLoaderCon.width=100;
myLoaderCon.height=100;
addChild(myLoaderCon);

var myloader:Loader = new Loader();
var image:URLRequest = new URLRequest("http://www.helpexamples.com/flash/images/image1.jpg");
myLoaderCon.myloader.load(image);
myLoaderCon.myloader.x=0;
myLoaderCon.myloader.y=0;
myLoaderCon.myloader.scaleX = 0.75; 
myLoaderCon.myloader.scaleY = 0.75;
addChild(myLoaderCon.myloader);

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
If your movie clips are smaller in size better you may use silverlight media application.

Author

Commented:
This is a flash as3 question
Top Expert 2009
Commented:
if i understand the question correctly
shouldn't it be

myLoaderCon.addChild(myloader);
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Yes, the above attempt was just one of many.
Ive also tried to do it like this, but with no luck.
var myloader:Loader = new Loader();
var image:URLRequest = new URLRequest("http://www.helpexamples.com/flash/images/image1.jpg");
myloader.load(image);
myloader.x=0;
myloader.y=0;
myloader.scaleX = 0.75;
myloader.scaleY = 0.75;
myLoaderCon.addChild(myloader);

Is it at all possible to nest a loader?
If I just
addChild(myloader);
the image turns up perfect.

Author

Commented:
Okay, my mistake.
I shouldnt have given the movieclip width and height.
I close the question....
You should use this code to get it running:


var myLoaderCon:MovieClip = new MovieClip();
myLoaderCon.x=20;
myLoaderCon.y=100;
myLoaderCon.width=100;
myLoaderCon.height=100;
addChild(myLoaderCon);

var myloader:Loader = new Loader();
var image:URLRequest = new URLRequest("http://www.helpexamples.com/flash/images/image1.jpg");
myloader.load(image);
myloader.x=0;
myloader.y=0;
myloader.scaleX = 0.75; 
myloader.scaleY = 0.75;
myLoaderCon.addChild(myloader);

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial