View Full Version : Inherit a class from an object?

08-05-2012, 07:59 AM
<?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();">


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;

<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 id="Classroom" x="0" y="100" width="100%" height="90%" backgroundColor="white">


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?