Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" creationComplete="init();">
<mx:Script>
<![CDATA[
public function init():void
{
// how to inherit a known class from the Canvas "box0"?
var obj:Canvas = new Canvas();
obj.x = box0.x;
obj.y = box0.y;
obj.width = box0.width;
obj.height = box0.height;
obj.setStyle("backgroundColor",box0.getStyle("backgroundColor"));
Classroom.addChild(obj);
}
]]>
</mx:Script>
<mx:HBox id="Panel" x="0" y="0" horizontalGap="100" width="100%" height="200">
<mx:Canvas id="box0" width="200" height="100" backgroundColor="Red"/>
</mx:HBox>
<mx:HBox id="Classroom" x="0" y="100" width="100%" height="90%" backgroundColor="white">
</mx:HBox>
</mx:Application>
If I already know the class of box0 (Canvas), how can obj inherit it from box0?
Like obj.x,
I do not type the exact value of box0.x. Instead, I use box0.x.
How can I do the same in class?