Hi,
I'm using the rogue development object handles plugin to allow me to resize and drag n drop elements,
I want to be able to create a text area that automatically resizes to the same size as the object handle, which is ok if I code the element on th stage from the off and would do so like this
<oh:ObjectHandles id="object_handle" width="20" height="20">
<mx:TextArea width="{object_handle.width}" height="{object_handle.height}" text="test">
</mx:TextArea>
</oh:ObjectHandles>
However I want to create an oobject handle with a text area on the fly as and when the user requires, but I can't work out how to bind the width and height of the text area to that of the object handle so that it resizes with it!
I've tried this
ohNew = new ObjectHandles();
ohNew.id = "oh";
ohNew.width = 10;
ohNew.height = 20;
taNew = new TextArea();
taNew.id = "ta";
taNew.width = ohNew .width;
taNew.height = ohNew.height;
ohNew.addChild(taNew);
but it doesn't seem to work, any help would be appreciated,
Cheers
Tim
Try taNew.percentWidth = 100; instead of taNew.width = ohNew .width;
The code below will allow you to increase dynamic height of text area, you can not increase width dynamically.
You need to include import mx.core.mx_internal in project. If you look at any application like power point, word and so many they increase height based on text not width.
ohNew = new ObjectHandles();
ohNew.id = "oh";
ohNew.width = 10;
ohNew.height = 20;
taNew = new TextArea();
taNew.id = "ta";
taNew.width = ohNew .width;
taNew.height = ohNew.height;
taNew .addEventListeber(TextEvent.TEXT_INPUT,textinputEvent);
private function textinputEvent(event:TextEvent):void
{
ta.callLater( resizeText);
}
public function resizeText():void
{
taNew .mx_internal::getTextField().autoSize = TextFieldAutoSize.LEFT;
taNew .height = taNew .mx_internal::getTextField().height;
taNew .parent.height = taNew .height;
}