ActionScript 2.0 :: Replace Double Spaces And Enter Or Newline Into A Single Space?
Jul 26, 2009do u know how to replace double spaces and enter or newline into a single space
View 0 Repliesdo u know how to replace double spaces and enter or newline into a single space
View 0 RepliesI 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 using flex 4.5.
What I am trying to do is take a string of numbers and convert it into an array, while cutting out the non-digits. Here is the format:1.0000000e+000 1.3668423e+000 1.0000000e+000 1.3668423e+0001.0000000e+000 1.3668423e+000So it's basically: Space, Space, Digit, Space, Space, Digit, NewlineRight now I am using the following code (myString is a String, and dataSet1 is an Array):
var reg:RegExp = new RegExp("
");
myString = textLoader.data;dataSet1 = myString.split(reg);
[code].....
If I press ENTER while editing textfield a newline is inserted. How can I change ENTER on something else, for example CONTROL+ENTER or SHIFT+ENTER(i.e. SHIFT+ENTER inserts new line into textfield)
View 8 Repliesim new with regexp, so can i ask for some assistance
Using string.replace function what code that can replace spaces with comma
Input:The quick brown fox jumps over the lazy dog.
Output:The,quick,brown,fox,jumps,over,the,lazy dog.
For a multiple choice questions, I would like to format text like this :
[Code]...
I tried with 3 labels in horizontal layout for each lines but it doesn't work for the third case.Now I use tabStops for alignment, it work well, but I can't find how to replace spaces by dots in a proper way.
What would be the best way to simply take a string like
var myString:String = "Thi$ i$ a T#%%Ible Exam73@";
and make myString = "thiiatibleeam";
or another example
var myString:String = "Totally Awesome String";
and make myString = "totallyawesomestring";
I need a AS3 regular expression that allows me to find/replace in strings like these:
[Code]...
I want to be able to replace the spaces at the beginning (inside the > <) for other character. It shouldn't affect the number of character at the right of the spaces or the attributes in the value1 definition.
How would I restrict double space but still allow single space in a text box?
View 1 RepliesI'm using swfaddress which creates a page title in the browser based on what page your on in the flash site. The title comes from the name of a frame label. For example i have a frame label called "About Us" I've capitalised it and put a space between the words because this text is what's used in the page title on the browser and i want it to look good and to be able to be read properly.When the page is refreshed it comes up as: "about%20us" as the page title on the browser.The %20 is replacing the space in the word.Is it possible to replace the %20 with a space?
View 4 RepliesIs there any difference between single and double quoted strings in ActionScript?
View 4 Repliesi want to replace the ENTER Key by the function key F9.[code]
View 1 RepliesI would like to if someone to know why i have so big delay in my flash main file when I go to test the preloading bar with duble control enter... I have enable the status report file in flash wich say to me was I load a class (AS 3.0 Classes Export Frame) but i dont link any class in my file..
View 1 RepliesI know that datagrid can detect changes of single mouse click with
//add listener
myDataGridList.addEventListener(Event.CHANGE, myDataGridListChange);
public function myDataGridListChange(e:Event):void{
trace(myDataGridList.selectedItem.id);
}
but can they detect double mouse click?My purpose of doing this is that, if the user double click on a datagrid row, I need it to return me value of myDataGridList.selectedItem.id, so that I'm able to continue to proceed to the next stage of my game.
I have been programming in actionscript for three months and I am very new to a lot of the details. I was programming in java in which there is an important difference between 'hello' and "hello". So my question is: In actionScript is it the same to use 'Hello' and "Hello". If not what are the differences?
View 1 RepliesI am currently trying to modify a Polaroid Flash photo gallery template. Currently it is setup so that when the user double clicks on the thumbnail, the photo enlarge, when they double click again on it, it closes it down. I'm trying to get it so that they only have to single click to close the enlarged photo down, as supposed to double click. I have found the section of code that controls this, I've tried playing with the numbers, but I still cannot get it to work:
[Code]...
I've got some text coming in from a database. I get:
' " " instead of single and double quotes.
I'm not sure that all fonts even support left and right double quotation marks (?).
at any rate... is there a relatively simple way to resolve this? maybe scanning the strings for the character entities and replacing them with single or double quotes?
does anyone know if Flash can recognize the ASCII entity number (e.g. ') more readily than the ASCII entity name (e.g. &rsquo?? That may be a moot point as i would have to somehow convert/replace with the entity number anyways..
Is it possible to check a TLFTextfield for any underscores "_", then replace all underscores with spaces? I have looked around the web a bit, though sadly only found very few websites detailing how to create such a function.
I recently began using this function to gain the currentURL of the swf:
ActionScript Code:
var currentURL:String = String(ExternalInterface.call(" function(){ return document.location.href.toString();}"));
It appears that this function works in Firefox, but in other browsers seems to fall flat, would be useful to know why.
I have a couple of Sprites on my screen and I want to write a single event handler to handle the double click on any of those Sprites. The following approach works for every event type except DOUBLE_CLICK:
[Code]...
To make it work, because in my application I will have lots of Sprites. In my opinion, a single event and the target property are more efficient than hundreds of event listeners. Am I right or should add event listeners to every Sprite?
I am trying to remove / replace white space from a string in as3. The string comes from xml and than written into text field. To compare the strings I am trying to remove white spaces
var xmlSentence:String=myXML.SENTENCE[thisSentence];
var tfSentence=e.target.text;
var rex:RegExp = /s+/;
trace(xmlSentence.replace(rex, "-"));
trace(tfSentence.replace(rex, "-"));
That code outputs like this:
She-has a dog
-She has a dog
I also tried different rex patterns. The problem is that though there are spaces in both string -which are same- it finds only one space but not the same one in both strings.
I am making a little banner for my site that makes different offers based on geo location (zipcode). I have the code working pretty much except for a few elements I want.
1) I want the input box to say "Enter Zip Code" until the user clicks on the input box. Then it clears out and the user can enter their zip code. The text box at this point should only take in 5 digits and no more.
2) Instead of having to click on the button to submit the form I want the user to also have an option just press enter when they are on the input text field and it process the form.
I am using Flash CS5 with AS2
This is the code I have so far:
ActionScript Code:
Code:
TraceOutputFileEnable=1
trace('this is the begining of the code');
var nameText:String = "Zip Code";
[Code].....
can i define a flash event as double click or single click
View 3 RepliesI want to add a Single Clcik event and Double click event both on the same movie clip in as3 , its working but call both the event same time so how to fix it
View 1 RepliesNo matter what I try, I can't seem to fire the click event on the "default" button in an Alert control in a Flex 3.4 application.
[Code]...
A question on naming objects and nameing of strings. A string has quotations "I am a string"......Q.1 If i have a movieclip on stage like an empty movieclip and i wanted to refer to the object in my code as below. As an example my movieclip is called mc1.Do i use 'mc1' single quotes....
ActionScript Code:
image_url = image.attributes.url;
trace(image_url);
[code].....
I created a movie clip layer with five cars in it. Each car is a separate button that when clicked plays a sound and shows an animation. If the car is clicked again, the sound and animation disappear. If another car (car B) is clicked while the first car (car A) is playing the sound/showing the animation, car A's sound and animation disappear, but it takes a second click for car B's sound/animation to play/appear.
How can I write the code so when you click on car B while car A is playing, car A's sound stops and animation disappears and car B's sound and animation play and appear right away?
[Code]...
When my focus is inside the input text field, pressing CTRL+ENTER works but ENTER does not.Pressing Enter when my focus is anywhere BUT the input text field works just fine..My intention is to detect if ENTER key was pressed after the user fills out the field, but it seems to only work for CTRL+ENTER
ActionScript 3:
// works:
stage.addEventListener(KeyboardEvent.KEY_DOWN, enterHandler);
// ignored:
email.addEventListener(KeyboardEvent.KEY_DOWN, enterHandler);
[code]....
ENTER results in charCode == 0, whereas CTRL+ENTER is charCode == 13 email was created using the Text tool and set to "Editable"
Note: I am testing in Chrome and Firefox running Flash v10
I'm having some real trouble getting .replace to actually replace something. Here's my code...
[Code]...
I can trace both newFiles[i] and keywords[i][whatever], but the replace doesn't replace anything. The regex is valid as well. I'm using regexr to test it, and it works perfectly there... but will not for me and I don't know why.
In AS3, we can format textfield to a newline by using . And now I'm trying to find out how do I use tab spacing in AS3? I want to format my textfield to look like this:
[Code]...
I'm creating a Flash instant messaging application (through XMPP protocol) and run into a problem. It isn't that important but I was quite upset that I wasn't able to solve it and I want to know if their is a solution =D
I have a TextArea chat input and a button to send the text, the TextArea is multiline and so captures the Enter key to jump one line... What I need is to send the message with the Enter key and jump with a Ctrl+Enter combination... My ideas were to disable the bubbling of the Enter key, trap it, and then manually assign the Ctrl+Enter combination to jumping the line in TextArea but couldn't find how to do all this...