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 "?";
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.
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--
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).
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.
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.
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.
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.
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;
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
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..
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:
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..
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.
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();
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]
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.
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.
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.
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?
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();}