You definitely can do that.

 

addChild() is the method to use.

 

I can't guess at what you are doing wrong without seeing what you are
doing.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Guy Morton
Sent: Sunday, February 25, 2007 8:03 AM
To: [email protected]
Subject: [flexcoders] Dynamically creating a text object

 

Hello. I'm stumped.

 

I'm creating some circles in AS and putting them on a Canvas that's
declared in my MXML file like so

 

var childCanvas:Canvas = new Canvas();

childCanvas.graphics.lineStyle(1, 0x333333, 1);

childCanvas.graphics.beginFill(0xCCCCCC,0.6);

childCanvas.graphics.drawCircle(200,150,7);         

childCanvas.graphics.endFill();

childCanvas.id = "myCircle";

childCanvas.toolTip = "I'm a circle";

 

mainCanvas.addChild(childCanvas);

 

This all works fine. However, I want to add some text next to the circle
(with AS) and I can't see how to do it. I've tried many ways and nothing
worked. It seems I can't add an instance of a text object as a child to
the canvas in the same way that I can a shape. How should I be doing
this?

 

Guy

 

 

Reply via email to