elinaf
07-03-2009, 09:38 AM
Hello,
I' m a newbie in actionscript and i have an issue with textarea. I have a canvas and i want to place textareas on it randomly. The textareas are placed on the stage through a button. When i release the button for the first time everything works just fine! The size is ok, the textarea is editable as i want it, etc.
My problem starts when i'm trying to create more textareas. On the second textarea, the first one disappears(and i want them all on the canvas)and there are two textareas that appear on the canvas, a very small one and one in the desirable size, but none of them are editable!!!
On the third release of the button(third textarea) i have the small and the large textareas as in the last step, BUT now the large textarea is editable again...
I have been working on this thing for a long long time and i have absolutely no idea of what i am doing wrong. If someone could help me out with this i would really really really appreciate it!!
This is my code:
plusText.onRelease = function() {
addText();
};
function addText() {
canvasClip.createEmptyMovieClip("texta",canvasClip.getNextHighestDepth());
canvasClip.texta.createClassObject(mx.controls.Tex tArea, "textArea", canvasClip.getNextHighestDepth() , {editable:true, html:true, wordWrap:true});
canvasClip.texta.textArea.setSize(150,225);
canvasClip.texta.textArea.move(109,50);
canvasClip.texta.textArea._x = random(200);
canvasClip.texta.textArea._y = random(200);
myArray[currentPage].addTreeNode("text_" + textID, canvasClip.textArea);
pages[currentPage].push(canvasClip.texta.textArea);
textID++;
}
Thx a lot!
I' m a newbie in actionscript and i have an issue with textarea. I have a canvas and i want to place textareas on it randomly. The textareas are placed on the stage through a button. When i release the button for the first time everything works just fine! The size is ok, the textarea is editable as i want it, etc.
My problem starts when i'm trying to create more textareas. On the second textarea, the first one disappears(and i want them all on the canvas)and there are two textareas that appear on the canvas, a very small one and one in the desirable size, but none of them are editable!!!
On the third release of the button(third textarea) i have the small and the large textareas as in the last step, BUT now the large textarea is editable again...
I have been working on this thing for a long long time and i have absolutely no idea of what i am doing wrong. If someone could help me out with this i would really really really appreciate it!!
This is my code:
plusText.onRelease = function() {
addText();
};
function addText() {
canvasClip.createEmptyMovieClip("texta",canvasClip.getNextHighestDepth());
canvasClip.texta.createClassObject(mx.controls.Tex tArea, "textArea", canvasClip.getNextHighestDepth() , {editable:true, html:true, wordWrap:true});
canvasClip.texta.textArea.setSize(150,225);
canvasClip.texta.textArea.move(109,50);
canvasClip.texta.textArea._x = random(200);
canvasClip.texta.textArea._y = random(200);
myArray[currentPage].addTreeNode("text_" + textID, canvasClip.textArea);
pages[currentPage].push(canvasClip.texta.textArea);
textID++;
}
Thx a lot!