[Extendflash] Problems converting text into actionscript

Jeffery Taylor xenon_16 at hotmail.com
Wed Nov 9 15:07:45 PST 2005


Hello, I'm trying to take a static text selection and put it into an 
actionscript as a variable. In Flash MX's normal mode, if you pasted text 
into the string line it would paste in one line, with \r replacing returns. 
If I try to do this in 2004, I have to manually go in and delete the return 
and put in the \r. I'm trying to automate this task. So part of the code is:

// sets the variable for the current frame
	var curFrame = fl.getDocumentDOM().getTimeline().currentFrame;

//sets the selected text to a variable and puts it in the output panel
	var frametext = fl.getDocumentDOM().selection[0].getTextString();
	fl.trace(frametext);

//puts the text into as
	fl.getDocumentDOM().getTimeline().layers[0].frames[curFrame].actionScript = 
'text="' + frametext + '";';

The problem I run into is that it pastes just like it reads in the document. 
So I get this on the actionscript frame:

text="SAMPLE TEXT

Text:
  -    Text
Text";

Is there a way to tell flash to put it into actionscript in this format?

text="SAMPLE TEXT\r\rText:\r  -    Text\rText";




More information about the Extendflash mailing list