Hello All,
I'm having a bit a of trouble adding TextFields created with actionscript to the TransformManager without getting a runtime error. Here's the code below.
// Creates Instance of TranformManager
var manager:TransformManager = new TransformManager({targetObjects:[], constrainScale:false, lockRotation:true, allowDelete:true, autoDeselect:true});
// Creates new TextField
function addTextBox(evnt:Event):void {
var textBox:TextField = new TextField();
var mc_children:Number = mc.numChildren + 1;
textBox.name = "textBox" + mc_children.toString();
textBox.appendText("" + textBox.name);
textBox.type=TextFieldType.INPUT;
textBox.wordWrap=true;
textBox.x = 100;
textBox.y = 100;
textBox.border=true;
textBox.addEventListener(MouseEvent.MOUSE_DOWN, setTextField);
manager.addItem(textBox);
textBox.setTextFormat(format);
mc.addChild(textBox);
}
The first TextBox I create works fine, I can scale, move, etc.. But when I create a second TextBox and try to scale that I get this runtime error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at gs.transform::TransformItem/reposition()
at gs.transform::TransformItem/scaleRotated()
at gs.transform::TransformManager/scaleSelection()
at gs.transform::TransformManager/updateScale()
at gs.transform::TransformManager/onMouseMoveScale()
at gs.transform::TransformManager/onPressScale()
I'm and experienced web developer but ActionScript 3.0 is new to me.
Can anyone tell me what I'm doing wrong?
Thanks so much for any help in advance.