ActionScript 2.0 :: Substituting Characters From Strings?
Jul 8, 2004
I'd like to know how to substitute characters of strings.Let's say I have...
my_str="Hello, Johny!, hello Dolly!";
I want to substitute all "!" characters to "?". How do we do this?I am assuming that first we need to know the character position of the character we want to get rid of.(we would loop this whole 3 step process until no more "!" characters were found in the string)1 my_str.indexOf("!"); returns 12 2) Now...how do I delete that character?3) The next step from there would probably be to use one of the methods String.substring() or String.slice to introduce the new character "?";
View 2 Replies
Similar Posts:
Jul 8, 2004
I'd like to know how to substitute characters of strings. Let's say I have...
my_str="Hello, Johny!, hello Dolly!";
I want to substitute all "!" characters to "?". How do we do this?
I am assuming that first we need to know the character position of the character we want to get rid of.
(we would loop this whole 3 step process until no more "!" characters were found in the string)
1) my_str.indexOf("!"); returns 12
2) Now...how do I delete that character?
3) The next step from there would probably be to use one of the methods String.substring() or String.slice to introduce the new character "?";
View 2 Replies
May 6, 2010
what's the easiest way to cut string in Flex ?I mean, I have a sequence of urls, I want them at most 60 characters length. If they are longer they should be cut and "..." should be added at the end.
<mx:LinkButton label="{bookmarksRepeater.currentItem.name}" click="navigateToURL(new URLRequest(event.currentTarget.label.toString()))" />
View 2 Replies
Aug 11, 2006
I am working with strings that need to retain the details of line returns as they were typed in and also characters such as speech marks (they will contain ascii art). I have looked at using the escape function but this doesn't seem to work--
[Code]...
View 1 Replies
Jan 4, 2011
I have a Flash file which contains some dynamic text boxes. ActionScript is being used to fill these boxes using strings. However, I can't seem to get Chinese characters to appear properly. I've tried the actual unicode character as well as their unicode-escaped equivalent but when I export the movie, nothing shows up (blank - it was assumed that the characters are not even present).
View 3 Replies
Apr 3, 2012
If I load a txt file into my flash movie using the following...
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void {
[Code]....
I get my text imported and it splits it every time the letter 'a' is found. That's fine.
How would I go about counting the number of times that 'a' or 'and' (for example) featured in the text?
View 2 Replies
Jul 1, 2011
I'm trying to set the text of a TextArea with some text containing forbidden characters. I'm trying to set the text as <meta charset="utf-8"> and there is of course a problem with the "'s. I think it's something like this <meta charset="utf-8">, but obviously this doesn't work.
View 1 Replies
Sep 8, 2010
I have some .swf files I want to use in an iphone app for menu changes etc. I have tried to loop through the images(200) to get the same effect, but it doesnt seem to be to my benefit.
[Code]...
View 4 Replies
Aug 24, 2009
I work on AS3 one week, and then take a break for a few weeks, then work on it a day, take a break, etc.. So I forget some of the basics, and need refreshers. I think I need to stop taking breaks.
Problem: I push multiple strings into an array, and some of the strings are the same.
Code:
var myArray = new Array();
myArray.push (Snivvle);
myArray.push (Kirupa);
myArray.push (Snivvle);
I want to find out which element positions "Snivvle" hogs up. We can see that it would be using element 0 and 2, and if we do an "indexOf" we would only get to see element 0, and doing a "lastIndexOf" we would only see element 2. How do I find out ALL of the element positions "Snivvle" is located in, so that it returns: element 0, element 2.
View 2 Replies
Jan 8, 2010
Many people install an add on to their browser - such as Flashblocker, or FlashOff - in order to stop annoying advertisements from auto-running. Is it possible to detect that this has been done, and then (obviously) use JScript to put up an alternative if this is the case?
If you cannot do this, then there is really no point to using Flash's higher functions, because the majority of users will see them only if they click a gray panel with a hopeful button in the middle of it. Flash becomes merely a decorative bolt on for web applications.
View 3 Replies
Sep 14, 2010
i would like to make my code easier to read by replacing long paths with variables, or something similar. in my code, i can target an instance many times, but the instance can have a lengthy path deep within the display list. for example: myButton instance could be located at myButtonsPanel.section2.redArea.myButton, or something like that. is it possible to substitue this long path as a variable or constant? something like: var myPath = myButtonsPanel.section2.redArea; therefore, calling the instance would be: myPath.myButton;
View 1 Replies
Aug 17, 2009
I am having issue with my created flash, it can't handle chinese characters? is there some way i can handle this thru code? or should there be any font or language pack installed
View 3 Replies
Aug 23, 2010
1) Each field in the form only allows 3 characters and no special characters such as @ _ ! . , etc... 2) When the user goes to the next field in the form, the previous field appears blank but the when clicking on that again, the original text appears. 3) When submitting the form, it just keeps saying "in progress" and never shows the confirmation text nor does the email get sent. There is an HTML file included with this form but I am not sure if I need to put that in as I have embedded this form into an SWF file so I don't think I need that code but let me know if I am wrong about this. I am posting both the AS code and PHP code below..
[Code]...
View 2 Replies
May 30, 2010
My problem is that all my accentuated characters are displayed as weird iso characters. Example :© is displayed %E9 I send a string to my php file :
[Code]...
View 4 Replies
Mar 11, 2010
i know, that i have to CAST them... but how?add (adition) two strings...
a:String = "20";
b:String = "10";
c:String = a+b;
I get c=2010 and not 30 as i expected...i guess i have to cast, but how?
View 1 Replies
Mar 30, 2010
how to format strings better and pad for leading zeros.here's the code:
var dt, timeint;
dt = new Date();
var TimeText:String;[code]...............
View 6 Replies
Jan 29, 2011
I'm trying to solve an Actionscript problem using E4X.I have an XML like this one:
<root>
<person firstname="john" lastname="doe" age="21" />
<person firstname="jayne" lastname="doe" age="35" />[code]....
I want to have just one function search() that takes three parameters (firstname, lastname, age) and return an XMLList. So the result could look like this:
var result:XMLList = xml..person.(@firstname == firstName && @lastname == lastName && @age == age );
But I don't want to use all three parameters all the time. I would like to have a function that uses a 'wilcard' if the parameter is NULL. So if the wildcard would be "*" the function could look like:
searchPerson( firstName:String ="*", lastName:String = "*" , age:String = "*") {...}
so that I would only pass 'John' for the firstName I'd get the first and the third node in return.
View 2 Replies
Jun 26, 2003
i have a .txt full of words (strings) devided by lines and separated with ; and i want to be able to load 1 random line and the first string of it..xALI;DALI;IDEAL;DELIRAREDIAL;REPELIDAAMO;MATO;MORTA;MOSTRA;MAESTRO;BATERMOSi want to be able to load "ALI" for example. and then load DALI etc etci used loadvariablesnum to load the text, but maybe that shouldn't be the best option..
View 7 Replies
Jun 3, 2002
which characters need to be encoded for PHP and SQL, and how to do it?
View 2 Replies
May 26, 2009
I'm doing the finishing touches on my games. I want to keep track of and display the level (waveCount) and display it in a dynamic text box. However, AS isn't allowing me to convert the number into a string.
[Code]...
View 1 Replies
Mar 11, 2010
Here we go... i know, that i have to CAST them... but how? The idea is to add (adition) two strings...
a:String = "20";
b:String = "10";
c:String = a+b;
I get c=2010 and not 30 as i expected... i guess i have to cast, but how?
View 1 Replies
Apr 15, 2005
I have a texfield in which I would like to display to strings. Right now, I can only use one of the strings by doing:myTextfield.text = str1
View 3 Replies
May 26, 2009
I want to keep track of and display the level (waveCount) and display it in a dynamic text box. However, AS isn't allowing me to convert the number into a string.
PHP Code:
private var waveCount:Number = new Number();
private var waveOutput:String = new String (waveCount);
private var waveWord:Sprite = new WaveWord();
[code]....
View 5 Replies
Jul 5, 2009
I would like to compare a string variable to multiple strings. Is it possible?I wrote a pseudo code of my own which doesn't cause an bug/error report,but it doesn't seem to work properly either:[code]
View 3 Replies
Dec 2, 2009
I'm making a typing game that focuses on developing typing speed and accuracy. In part of this game, the user has to type a given word in a certain amount of time. If the user types the whole word within the time limit, the timer stops and it results in 100% accuracy for that word. However, if the user does not type the word within the time limit, I want to compare the typed word to the given word and find out how many errors they made.
I found this to be a lot more complicated that I had expected it to be. Fore example, if a letter was accidentally skipped or an extra letter was added, it will make all following characters seem wrong, even though the user only made one mistake.
How do I go about comparing the two strings?
View 3 Replies
Dec 27, 2010
If I remove the variables and just type in the path name, the file does play. So there's no other error in this piece of code. I just can't seem to figure out how to create that filename from variables.
EDIT: I should point out more clearly its about the line = public var soundRequest:URLRequest = new URLRequest("sounds/" + Champ + soundType + ".mp3");
I get a 2044 unhandled ioerrorevent error and a 2032 stream error.
[code]....
View 9 Replies
Apr 6, 2009
I have the following:
function ShowSlide(event:TweenEvent) {
m= getChildByName("tag"+slideIndex+"_mc");
m.visible = false;
if (slideIndex < 4) {
slideIndex++;
[Code] ....
And I want to do for "tagInitW" the same thing I do for "m" being given that I already have "created tag1InitW", "tag1InitH", "tag2InitW", "tag2InitH..." So is there anyway I can dynamically target a variable? This was easy in AS2, but because of the strict dataType the vars have in AS3, I can't do it like I was doing it in AS2.
View 4 Replies
Dec 29, 2009
I am building a textField object that will contain new line character." " does not appear to work. All that it has been doing is trunctate the text string to the first occurance of the " ". Does Action Script use Unix new lines; (line feed)? Javascript does, as well as other scripting languages I have been using, regardless of the platform. It needs to occur within double quotes; " rather than ' ', other wise it is rendered literally. How do I enter new lines into Action Script text strings?
View 3 Replies
Nov 14, 2010
im trying to apply a language using AS3,all other textfields are changed except the buttons. Is it becuz the buttons have more than 1 frame?
View 1 Replies
Nov 14, 2010
I am programing a flash page but writing function to send two stings at the same time? In my case, I would send backwardH and backwardLI have has tested all three options, but there is no error but either backwardH or backwardL movieclipet gets affected, not both at the same time though I would like both to be influenced at the same time. For example if I click button_1 then movieclip_1 and movieclip_2 would play. And if I click button_2 then just movieclip_1 would play.
//Option1
family.margeAS3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void{
direct = "backwardH", "backwardL" ;margePa.play();}
//Option2
family.margeAS3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void{
direct = "backwardH" + "backwardL";
margePa.play();}
//Option3
family.margeAS3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void{direct = "backwardH";
direct = "backwardL" ;margePa.play();}
Swf file 1,2mb : [URL]
Fla file 3,5 mb (messy) : [URL]
View 7 Replies