ActionScript 3.0 :: Get Carriage Return & Line Feed?
Jul 4, 2009
How can I get the text from the textarea component along with the line feed & carriage return characters?
As now, I amusing the text to send email. But in email, it showing all in a line rather than multiline, which means carrriage return and/or line feed characters are missing. How can get them?
myNews=<FONT COLOR="#FFFFFF"><B>This is bold 24 point text</B><P></P><P></P>blah blah</FONT>
As i could read on macromedia 's web site:Use an empty pair of <P></P> tags to insert a line break. Use two pairs to insert a line break and carriage return.But this isn't working.
How do I convert a multiline of text from an input box into a single line of text except I would put a string of characters to replace the carriage return?
I am developing an admin panel for an flash site. One of the sections contains large amount of text containing Carriage Returns. It can look as this : John Doe was born in Athens in 1974. He studied at the Athens School of Fine Arts and he presented his first solo exhibition in 1996.
So from the text area the text goes to mysql and from mysql I generate an XML file. The problem is the xml file source is looking like this : John Doe was born in Athens in 1974. He studied at the Athens School of Fine Arts and he presented his first solo exhibition in 1996.
This way in flash the text has some big spaces between phrases and I dont like it. How to generate XML file to be like this : John Doe was born in Athens in 1974. He studied at the Athens School of Fine Arts and he presented his first solo exhibition in 1996.
If it's possible to restrict hard returns in text input fields? I've tried something like this: my_txt.restrict="^u0013", and a bunch of variations thereof, but nothing seems to keep the Enter key from doing it's thing. Second best would be to traverse through a string a user has entered and replace hard returns with a space or dash, but again I've had no luck looking for or I've tried entering text and hard returns into a dynamic textfield set to input, but when I try this: var n:Number = my_txt.indexOf(" ")... trace("n: "+n) //traces "n: -1"
How to remove a carriage return that's inserted mysteriously by flash. I have a text input box and it auto adds a enter key press carriage return. <IMAGE Names="Josh ">My imputed text</IMAGE></GALLERY> %20Names%3D%22Josh%26%23xD%3B%22%3EMy imputed text%3C%2F This is the mess of crap its auto inserting %26%23xD%3B%22%3E
I have an input TextField and have a KeyboardEvent.KEY_DOWN even listener on the stage to listen for the Keyboard.ENTER event. The event listener adds the entered text to an array or whatever, and then clears the TextField. The problem is that when the Enter key event fires and the TextField value is set to "", it leaves a carriage return in the TextField and the cursor positioned on the second line. WTF? I've been coding AS2 and AS3 for a LONG time and have never ran into this before.Example:
var myTextArray:Array = new Array(); stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); function onKeyDown(e:KeyboardEvent):void{
Trying to figure out why, and how to eliminate a line return I'm getting.
ActionScript Code: var myTextField:TextField = new TextField(); var css:StyleSheet = new StyleSheet();[code]....
The out is intended to look like this: This text should all be on one line, but is not.but looks like this: This text should all be on one line, but is not.There is something about the em tag (and others) that causes it to perform a line return.
In Flash I load the text content of the title attribute into a text field, problem is -- the prints instead of operating as a carriage return (new line).
Again, no access to the XML so changing the TextField to htmlText and adding a <br/> tag wont work.
why i cannot get the carriage returns and tabs stripped from my XML. I guess the only drawback at this point is that i cannot form my xml file nicely and am stuck placing all my node text on one line.
So far here is what i have tried without any luck;
ActionScript Code: var subXml:XML = new XML(); subXml.ignoreWhitespace = true; subXml = new XML(e.target.data);
[Code].....
I am otherwise at a loss as to why it's leaving the tabs returns etc. in my textFields when i populate them with the node data.
I am simply wanting to stop a user entering carriage returns in a TextArea. I have been experimenting with the 'restrict' property in the TextArea but cant seem to work it out.I have the following code:
<mx:Canvas id="cvs1" label="Panel 1" width="100%" height="100%" creationComplete"addEvtListnerOnPlaceText()" backgroundColor="#FFFFFF"> <mx:TextArea id="txtP1T1" x="10" y="176" text="{placeName}" width="210" textAlign="center" color="#DC0000" restrict="this is where I need some help"/> </mx:Canvas>
I've now managed to get something working:
private function addEvtListnerOnPlaceText():void{ txtP1T1.addEventListener(KeyboardEvent.KEY_DOWN, onKeyEventDown); txtP1T1.addEventListener(KeyboardEvent.KEY_UP, onKeyEventUp);
[code]....
The only issue now is that if you hold return down, it clears the first carriage return and then keeps adding as long as you hold it down. I need a way to stop this happening without just losing focus on the text area.
I've got an app where I'm grabbing the currently highlighted text from the user in a RichEditableText block and I've noticed that when the user highlights a selection after a carriage return that selectionActivePosition and selectionAnchorPosition return values that don't count the carriage return, even though when I slice the corresponding text with the retrieved values, it does take the carriage return into account and therefore returns a value shifted one character to the left for each carriage return appearing earlier in the text.
it's possible to restrict hard returns in text input fields? I've tried something like this:my_txt.restrict="^u0013", and a bunch of variations thereof, but nothing seems to keep the Enter key from doing it's thing. Second best would be to traverse through a string a user has entered and replace hard returns with a space or dash, but again I've had no luck looking for or . I've tried entering text and hard returns into a dynamic textfield set to input, but when I try this:
var n:Number = my_txt.indexOf(" ")... trace("n: "+n) //traces "n: -1"
I'm having some troubles with the use of interface and inheritance in AS3. I've done lots of OOP in the past and what I'm trying to do seems obvious to me, but doesn't work in AS3. The question is : Is it possible to override a function that return an Object of class A, and make it return an Object of Class B which extends A ? It seems not to be possible, since I'm getting a signature error in Flash, when compiling. For example, the following set of class do not compile (the code in function definition doesn't matter):
I'm trying to work out how to create a simple demo that works as follows: A ball falls from the top of the stage.Player is able to draw a line anywhere on the stage. The ball will bounce/roll along the line such that the player can guide it at will. I don't think the coordinate rotation will be a problem for me but I can't figure out how to transform a line drawn by the player into a hit detectable sprite -- or realkly any way that I can get those line coordinates into my coordinate rotation routine. To keep it simple, I'm just working on the first part of the problem, getting the line to where I can hit test or know its position.Here is my code so far:
in Flash CS4 I have static text like: Line1 and line2 It's in 9 point Arial Regular as a device font. If I set the line spacing below 3.9 the second line dissappears from the compiled SWF file. It still shows in the FLA file. The same thing happens at 6pt but NOT at 5pt or less.
Is it possible to load a text file using line breaks as a delimeter rather than having a &var= at the beginning of each line? Like by a for instance? I have a text file with about 1000 lines that I need to load/display.
I'm in the process of teaching myself the components of the CS4 Design Premium package using the Adobe Classroom in a Book series. I'm currently going through the Flash CIAB and i've started using the pen tool. The task involves creating a wave like design across the stage. Whilst this in itself is simple, the final instruction is to click on the first anchor point to close the shape. In the illustration, the closed shape seems to automatically extend around the stage, however when I click on the first anchor point, the line automatically connects between the two points in a straight line.
Am I doing something wrong? The next step is to fill this area, but with the straight line effect that I am getting, this becomes impossible. I should point out that the instruction states that the pen tool line should extend off the stage. I have done this, but even then on clicking on the first anchor point the shape is closed incorrectly.
I am trying to dispatch an event but not sure when I should do it to get the right results. The first event "submitClicked" is in the right spot and works great. However, the second event "dataReady" seems like it might be a problem. I need it to be dispatched after this.compiledFormData is set.Does AS3 wait for each line of code in a function to be executed before moving on to the next line?
// -------------------------------------------------------------------- public function submitForm() {
I am using Flex 4 and AS3 and I am trying to make it so that the user can draw a freehand line with the cursor - I have this part done.However, I also need the line to be a dashed line instead of one solid line like it is now. below is my code I am using. I have found some examples on how to do this, but they are all for straight lines, not for a freehand line.
When a Dynamic Multiple line text field is used in Flash CS3, it has a very annoying feature that auto inserts a line break at the end of inserted text. It also auto inserts a line break if no text is entered too.
I'm having a problem with this because the text is being saved from flash to a text file on the desktop. With every multi-line text field there's a nasty looking line break.
Any way of "turning off" this auto-line-break-at-the-end feature?
I need to replace multiple contiguous new line/line feed characters in flex with a single new line character.
Example:
The string
"My name is blah blah
My name is blah "
Should be converted to
"My name is blah blah My name is blah "
Hope the example makes it easier to understand.
I am using a component to render it.
I guess using regex would be the easiest way to do this, but still it would be great if people can point me out to references/examples to get this done with ease.
I am developing a white board application which allows the user to draw line with arrow head (some like Microsoft Word line with arrow feature). I am using graphics property along with lineTo() method to draw a line. Now i have to draw a angular arrow on the last point of line. I am drawing the arrow by connecting the points around last points. As 360 line can pass through this point and each line can have a different angle of arrow.