-
[RESOLVED] Text tool in drawing app - need help URGENTLY!!!!
I've created a drawing application with a text tool and everything works fine, but I can't figure out how to keep written text on a stage when a text field loose a focus.
I've created a function that add a new text field to the canvas and declare it as "input" and another function that onKillFocus change the type of that text field into "dynamic".
Now, I know that I should somehow store written text into a new var so to be able to keep it on canvas when a new text field is created - but I don't know how!
THE PROBLEM: each time a new text field is added the old one clears, so there's not text on the screen (canvas)!!!
I've attached .fla document, so please if anyone would be so kind and spare some time to see it and help me to find the solution!
A.M.Vuković
Last edited by avukovi4; 12-18-2010 at 01:04 PM.
Reason: Got the answer
-
Code:
function addTextField() {
//kreiraj text field tamo gdje se klikne s mišem
var myPointX:Point = new Point(pointX_mc._x, pointX_mc._y);
var myPointY:Point = new Point(pointY_mc._x, pointY_mc._y);
var uni:Number = paintClip.getNextHighestDepth();
var newTextField = paintClip.createTextField("writingText"+uni,uni,_xmouse,_ymouse,myPointX.x-_xmouse,myPointY.y-_ymouse);
//kreiraj novi text format
var my_fmt:TextFormat = new TextFormat();
my_fmt.size = 25;
my_fmt.font = "Arial";
my_fmt.color = parseInt(selectedColor);
//dodaj text format na text field
newTextField.setNewTextFormat(my_fmt);
//dodaj svojstva na text field
//newTextField.border = true;
newTextField.multiline = true;
newTextField.wordWrap = true;
//---------------------------
return(newTextField);
}
-
Dear dawsonk I can't thank you enough!
Silly me - I thought that I should somehow add a variable and store a text from the input text field into it and didn't realize that the problem is, in fact, in stacking order and that's why I should have add a var (uni) to have a unique text field with unique name and unique stacking order each time text tool is selected!
It's always a pleasure to have an opportunity to learn something new!
Once again, thank you!
Alex
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|