Actionscript :: Remove Part Of A String?
Sep 14, 2011I want a simple function that can remove part of a string, eg:
var foo="oranges";
trace(removeStrings(foo,'rang'));
I want the above output as 'oes'.
I want a simple function that can remove part of a string, eg:
var foo="oranges";
trace(removeStrings(foo,'rang'));
I want the above output as 'oes'.
so I have a string "bla dla dla vre bla 54312" I want to turn it into "bla dla dla " by saying something like
function(string, "vre");
how to do such thing?
The background of the png images is transparent but is not actually transparent if I load the png with transparent background and add into a sprite. The transparent part also can receive the mouse event so I wanna know how can I remove these pixels?
View 5 RepliesI have a string:"newImageContainer_mc_0"
And I only want the 0 at the end, how do I strip the String so that I only take from it a character or a group of characters?
I am currently storing the items of this array as a variable. thats cool, but what I want to do is remove the b so I get 1 2 3 4 5 6 7 8 9 10 instead of b1 b2 b3 b4 etc.
Code:
buttonArray = [Enter_me.b1, Enter_me.b2, Enter_me.b3, Enter_me.b4, Enter_me.b5, Enter_me.
I have a flash movie in which I've created something that functions similarly to a calculator. When the user clicks a button, depending which button was pressed and in which order, a series of movie clips is displayed from left to right in specific positions, using addChild. I have a button on the calculator which I would like to have function similarly to a 'clear' button on a real calculator. When clicked, it would remove only the movie clips that were displayed by clicking the calculator buttons. how I can remove only the movieclips that are part of the calculator display? Here are some
code samples.
var mcSelection:MovieClip = new MovieClip();
//check to see how many times a calculator button was clicked
function checkTime()
{
[Code].....
I've tried different variations of removeChild and removeChildAt, but either parts of the calculator are getting removed, or I remove the parts of the display one clip at a time instead of all together, or I get out of range errors. How do I target a certain range of movieclips to remove? Do I need to assign a specific range of levels when the new movieclips are added and then remove that range? It will be different number of clips and combination of clips every time.
So my string is something like "BlaBlaBlaDDDaaa2aaa345" I want to get rid of its sub string which is "BlaBlaBlaDDD" so the result of operation will be a string "aaa2aaa345" How to perform such thing with actionscript?
View 1 RepliesI've been writing an AS3 app and dealing with weird behavior from Flash Player 10. It seems to ignore certain errors instead of alerting them (compile time or dynamic).
Blank FLA with this: ActionScript Code: trace("Key pressed: " + String.fromCharCode(0) + " (code: " + 0 + ")");
Will output "Key pressed:" and nothing else. It doesn't output the rest of the string. It seems to get stuck on the String.fromCharCode(0) part, but doesn't throw any errors. Anything higher than 0 works of course. That's extremely annoying and hard to debug. It also happened when I was accessing a class member I didn't initialize, I had no idea why it compiled and ran, but had the wrong output.. it took a while to track down. It also happened to me when using addEventListener, when I tried to access the class "this" from inside the inline function, but instead of throwing any errors it just ignored it and broke the app. It acted like it just stops running the code when it encounter that, I would get traces from before the problem code, but none afterward (and it wasn't frozen). Kind of like a thread crashed.
i made two movies clip movie named (masK_mc) and the other named (over_mc) what i need to do i need when i start drag with (over_mc) and when i moved over the (mask_mc) i need the part of mask_m which moved over by (over_mc) removed and show the bacground of (mask_mc) i made the part of drag and over but i need to know how i can remove part of movie clib when i over by over_mc
View 0 Repliesi want my fash file to be full screen and to only showthe swf how do i loose the top parti'm trying
fscommand("fullscreen", true);
fscommand("showmenu", false);
I had to check a text input from a user to se if is inside an array, the array contains single words with possible answers. What I need to know is; if somebody for example type the "sky is blue" and the array contains "blue", I want it to recognize it even is there's more words in the given string that are not in the array.
View 8 RepliesIs there a possibility to tell flash, that he should ignore a piece of code out of an xml file.I'm asking this becouse our programmer generates dynamicly xml's.these contain a piece of code that makes that flash doesnt want to read our xml.Maybe I could tell flash to ignore this specific string?
View 1 Repliesthis is how i am adding information to a pop up e mail. how do i do the opposite of this and take this away from the e maili tryed changing the add to delete but it did not seem to work.
on (release) {
_root.Options = _root.Options add "Please put me on your mailing list" add ", ";
}
[code]....
how would I accomplish removing the <a href></a> tag from the following string and just leave the link text?
ActionScript Code:
var str:String = "<text><a href="event:http://www.google.com?tracking=123>Go to google</a></text>";
so that the end result looks like the following...
ActionScript Code:
"<text>Go to google</text>"
I was up too late and my brain hurts.
i have some strings with numbers "txt_r1" or "txt_ty67" and i want to remove the numbers. numbers always at the end but can be different lengths.have tried using substring which can get me the end numbers, but I'm looking for a method to remove any numbers in a string.
View 1 Repliesif i have this, for example:<font color="#9378FE" size="28">LOREM DOLOR IPSUM SIT AMET</font>how do i remove any occurence of html tags?so that i am only left with:LOREM DOLOR IPSUM SIT AMET
View 5 RepliesI have a string in a variable called lets say "mcName". I want to loop through and remove all the numbers in it. there is always a number at the end but it could be 1, 2 or 3 digits long so i can't just slice the last letter.
View 3 RepliesI'm trying to strip the name of a movieclip to just the number so that I can use it as a parameter in a function. The name of the movieclip is mcThumb6 and there are 8 different clips that are numbered 1 - 8. I'm trying to use the .split method to remove the mcThumb and just have the "6" remain. The movieclips all have rollover functions. The rollover event strips out the string and then will call a function using the number (based on which movieclip was rolled over). This is working except when I trace out the new value it adds a comma in front of the number -- i.e. the output looks like this: ,6 instead of just 6.Does anyone know where this comma is coming from?
The code:
mcNav.mcThumb6.addEventListener(MouseEvent.ROLL_OVER, thumbOver);
function thumbOver(e:MouseEvent):void
[code].....
I'm trying to replace numbers in a person's name, but cannot seem to get the syntax correct. Below is what I thought would work.
Code:
var name:String = "BabeRuth27";
var regEx:RegExp = new RegExp("/[0-9]/");
var noNumbersName:String = name.replace(regEx, "");
I'm trying to replace numbers in a person's name, but cannot seem to get the syntax correct
Code:
var name:String = "BabeRuth27";
var regEx:RegExp = new RegExp("/[0-9]/");
[code].....
Is there a simple inbuilt function in AS3 to remove spaces in a String??
View 3 RepliesI want to search a TextArea component (flex) to see if there are any lines containing "?". If there is, the whole line will be removed.[code]
View 3 RepliesI have used flashvars to send a URL query string to my movie, though I need to filter the string to remove one of the variables.For instance, I am trying to remove 'var2' from: var1=aaa&var2=bbb&var3=ccc..However, the query string is not the same every time. For instance, sometimes 'var1' may equal 'aad', 'var3' may equal '183', etc.So basically what I need to do is, regardless of what is contained in the string, always filter out 'var2'.
View 1 RepliesI'm currently searching google whilst I ask this - I just couldn't find anything on my initial searches.Are there any quick ways to remove all non-numeric characters from a string?For example my string would contain:
'code: 1234'
I would wish to remove the 'code: ' part from the string just leaving '1234'.
I need to remove the text from a string ie "C99X"or "B53" and leave the numbers. Which is the best way to do this?
View 2 RepliesI have to send a string from flash and I need to format it correctly. I'm going to use the restrict property too. Heres what I'm looking to achieve.
1. Remove and commas
2. If there are more than 2 characters after the period, round it the nearest number. Im guess for a minute you have to turn the string into a number then back to a string when processed.
ActionScript Code:
var badStr1:String = '1,000,000';
var badStr2:String = '1,000.98965';
I have an array of characters that for some reason is adding commas in between all it's characters.So if:
array[0] = undefined;
array[1] = "b";
array[2] = "a";
[code]....
I have a multiline textfield were users can type text. I split the text in words so I can compair them to see if they are a certain word. Some words don't pass the if statment even if they are the same (at leased to me). I found out it's because these words have a hard return in front of them. I need to remove the hard return, but I can't find out how. I tried to split the string on " ", but that doesn't work.
View 3 RepliesNed fantastically answered the question of how to add currentLabel to String = "currentLabelString"
[Codoe]....
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.