I have created a custom AS component "DragObject" based on Canvas.
The idea is that ultimately users will be able to put whatever they
want inside this ontainer and it will handle most of the code of drag
and drop for them.
However, when I put another (100 x 100) Canvas inside this component
just to test it out, the width and height of my component are 0, so
it doesn't show up on stage. I used the super() method in my
constructor, so I expected my component to behave like a Canvas in
that it should automatically be sized around its children.
Here is the AS for my class:
package elearning
{
import mx.containers.Canvas;
public class DragObject extends Canvas
{
public function DragObject()
{
super();
}
private var _desc:String = "Untitled Draggable
Object";
public function get desc():String{
return _desc;
}
public function set desc(descTxt:String):void{
_desc=descTxt;
}
override public function toString():String{
return("DragObject " + _desc);
}
}
}
Thanks!