ActionScript 2.0 :: Add Something Inside The Middle Of The String
Oct 20, 2009
I have a string such as image.jpg
I want to add another short string inside it... (for example : 01 or something). But this short string always has to apear just before the dot, like:
image01,jpg
picture01.jpg
photo01.jpg
I already found out how i can add a string inside it... but when the first string is longer the second string ofcourse doesn't show up on the right place..
Is there a way to take out a part of the text in a string? Like start 7 characters inti the string and end 2 from the end of string. Something like: string="hello how are you today?"; So when done weare done with it the things left in the text is: "how are you toda".
I have a string that contains a full name input, and I would like to spilt them into 2 parts and save them inside an array, first name and last name. How do I do it with string.split? My current code is myNameArray = str_adminInput.split(" "); This code only works if the names are : Jack Lee, June Poh. This code does not work if the names are: Lee Tok Kong, Tan Beng Seng.
I really need to reference the variable while INSIDE the onRelease function, because I need to apply some actions based on how many times the button has been pressed.
Is there a way to search for a piece of actionscript code inside the whole of the fla? I have a project with multiple library movieClips that contain actionscript and I was wondering if its possible to search the whole fla for a specific as3 piece of code?
I need to find all url's inside string ex. "abc [URL]. I have tried few regeps but they worked only if all string was url, otherwise regexp has no matches. I would be gratefull fo a clue or working regexp.
infowindowoptions class within the google map api for flash and I want to have some html ( a link ) within a string value. the html has a pair of quote marks inside the string. How can I have the quote marks inside the string without causing an error?here is my actionscript
import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapType;import com.google.maps.InfoWindowOptions; var map:Map = new Map(); map.key = "ABQIAAAAN14ojD-qIiaujbXTJI-SnhQEt6AsiatPjWK1t6pg54rIwsH2LxSmsfrHffLA
Now one of the functionality that's added to the player is the "Transcript Button", which shows subtitles in a small window.Well, what I've done is added text on keyFrames of the main timeline,so if the audio says "Hello good evening, welcome,....", I've made a new layer above the audio layer and during that particular part of audio I've added the text on the new layer in a keyFrame.I've done this for the entire timeline.I've used enterFrame and accessed this String value and displayed it in the small window.Everything seems to work well.But if a certain movieClip popup is added on the timeLine, which has its own audio.o necessarily I'll have to add the text to this movieClip as well, but I cant access the text, i.e, display it in the small window.Also I've tried using a global variable like this,...
I'm having an issue with RegExp. I have a string variable equal to "1 + 2 + 3 + 4". I'm trying to use RegExp to replace that string inside another string, however the plus signs are causing it to not be recognized. If I take the plus signs out, it works. If I replace the plus signs with minus signs, it works. I know + means something in an expression, is there a way I can get flash to ignore it and keep the + sign in there?
I have an object with an Array of objects inside. Each object has a name property. To scope it directly I would use:
ActionScript Code: obj._arrayOfObjects[0]._object name; // trace returns the first object's name in the array if you understand this so far then here is an easy question for you.
I am working on a simple video game where, when a randomized character is struck, an "explode" function kicks in creating an "explosion" unique to that randomized character. The difficulty is that when this._name is passed through the function, the movie clips have numbers assigned/attached to them. Here is the basic code that is found inside a class (foe.as)[code]...
I have an object which needs to be added to an array, but when it is, it doesn't show the string inside. However, when I alert the exact same object, I get the result I'm looking for.
Here's my code. newArray.push(obj.responseData.results[i].phoneNumbers[0].number); alertMe(obj.responseData.results[i].phoneNumbers[0].number);
The first line shows nothing in that location in the array, and the second pops up a phone number, just like I'm after.
How to compare a string with strings inside an array for a match? I have a file in which each sentence (or word) (generally string) is present in a new line. Opened the file and read the contents to a string.
Code: private function readHandler(event:Event):void{ _str = _readStream.readUTFBytes(_readStream.bytesAvailable); _strArray = _str.split(" "); //contains each string that appears in a new line _length = _strArray.length; [Code] .....
But this doesn't work. Seems like if(_input == _strArray[i]) never gets executed even if they are equal. What might be the problem. Is there some better way to so it?
For my calculator i am having trouble storing a number inside a string variable.
Calculator, Layer 'actionscript', Frame 1, Line 1441061: Call to a possibly undefined method append through a reference with static type String.
Code: var currentNumber:String =""; function pressNumber(e:MouseEvent):void{ display_txt.appendText(e.target.num); currentNumber.append(e.target.num);//error here }
I want to alter the text color inside a string that has some HTML tags using regular expressions.My question is how can I alter the letters only of the text between html tags and not inside the html tagsI am using something like this:
ActionScript Code: var exp:RegExp = new RegExp(textfield.text,"i") str = str.replace(exp, "<font color='#FF0000'>$&</font>");
I know that there is no such function as getElementByName in Flex but I also now that you can do this["object_id"] to get the element of the application u're in.What about getting an element inside another element?I've tried making element["id"] ? But in my try-catch it always runs the "catch" part..how do I get an element inside another element just having it's id in dynamically created string form?
Now, when it scales, it scales from the movieclip var registration point of 0,0. So when it scales, it appears to grow in two directions (down and to the right)Is there a way to have it scale from the center of the box so that it scales equally in all 4 directions?
I have a big mp3 file (about 100MB). Is it possible to load, play the sound from the middle without waiting to load the first half? (like on youTube it loads and play the file from where you click on the seekbar).
Is it possible to test my movie/scene from a specific position in my movie?
When I make subtle changes, I don't always want to preview my movie from the beginning, and when the movie gets long, it takes a while to make small changes when I have to preview my movie every 5 seconds.
So is there anyway to preview my movie from a certain spot in my animation?
How do I make an mc constantly rotate? I know this must be simple but i dont know how to do it. I just want it to rotate around its middle. How would i do this?
I'm making a gallery, everything is fine but when it loads a smaller or bigger image, the image doesn't appear in the middle.so, how to set the picture to be appear in the middle of the stage always????
I know how to calculate the distance between two movieclips, but I want to know how do you keep a movieclip centered between two movieclips? For example, three movie clips evenly spaced out in a row. I drag either movie clip on the end and the one movie clip in the center positions it self to be in the center x and y wise.
how can i middle a text in the Textfield that is 100px by 100px so that when i have 1 line its in the middle, when i have 2 lines its in the middle as well check attachment. when i do it right now it is always on the top i basically would need the same as when i have a HTML table by default so it is horizontal in the middle.