ActionScript 2.0 :: CS3 Adition Of Two Strings?
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
Similar Posts:
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
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
Jan 6, 2012
Can we convert numbers[ints] like 1,2 into 01 and 02 strings, i need to set these numbers as a text to a TextField.
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
May 12, 2011
Say I have something like this:
[Embed(source='../lib/images/image01.png')] var Image:Class
But I want to change that images based on another string like so:`
[code]...
But this gives me an error, is there another way to do something like this?
View 1 Replies
Oct 21, 2011
I'm trying to localize my Flex app, I have been able to setup the locale specifics and all the stuff inside MXML tags, that works pretty well, my question is, what about if I have for example:
[Code]....
How can I change with ActionScript those two strings to an other locale?
View 1 Replies
Jan 14, 2012
I'm creating a flash application, which loads a file from a server, and stores it in a string. I'm wanting to find the substring within that string, which is inbetween two known substrings.
Note. I don't want to do this with reg-ex as i'd like it to be easily reusable.
Ideally I'd like a function which i can re-use, by passing the beginning and ending substrings.
e.g. something along these lines..
function getSubString(start:String, end:String):String
Edit: There may be more than one instance of the 'start' and 'end' substrings within the string, i'm wanting it between the first instance of each.
View 1 Replies
Feb 8, 2012
is there a way to deserialize strings to objects in actionscript:i.e. var str:String = "{ id: 1, value: ['a', 500] }";should be made into an appropriate actionscript object.
View 2 Replies
Feb 3, 2009
Basically, I have a URL to a SWF, but I need to get some info to the SWF on load. So the FlashVars seemed like a perfect fit. the link+query string -> HTML page using SWFObject 2.x to embed the SWF ->JavaScript to use the "document.location.search" in order to get the query string.
Here's my HTML code:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
[code]...
When I leave the alert on in the HTML page, it displays the query string of
"grade=0&workmat=1&manipulative=2"
View 5 Replies
Jul 13, 2009
Here's my AS:
ActionScript Code:
var messages:Array =
[
"SWEATSHIRT",
[code]....
I have a text box called whatToClick which contains the words (copy and pasted) SWEATSHIRT. As such, that should trigger checkMask(), which checks if the clicked item is the same as the one in the text box. While running various trace commands, the string traces out exactly the same, capitals and all. But this always runs the else instead, which means the if isn't true. [URL]
View 4 Replies
Nov 14, 2010
I am working on a flash game that has 'waves' of soldiers kind of like the game Weapon.
what I am trying to do is randomize and array I have which contains strings[code]...
View 3 Replies
Feb 9, 2012
TypeError: Error #1034: Type Coercion failed: cannot convert "brick1" to flash.display.MovieClip.so I tried tracing e.target.name and it gave me the correct instance names for each movieclip, however when I try moving the object with then it gives me the above error.
ActionScript Code:
import flash.events.Event;
import flash.display.MovieClip;[code]........
View 6 Replies
Feb 27, 2012
[code]I have information coming in from an XML page. One of the childnodes is an ID. The numbers of the IDs go from 29 to 40. I'm trying to have 6 numbers randomly grabbed from the list, so I made a function to find a random number between a given "Low" and "High" numbers, then another to continuously add 1 if it's already one of the other numbers(I'm pretty sure the method of that part, I could have taken a short cut.)Where it says to trace the two numbers near the top of the find5RandomNumbers function, they trace 29 and 40. But near the bottom where it's told to trace all 6 items, they come back as "NaN."[code]
View 0 Replies
Mar 3, 2012
I want to search a dynamic text field through a search bar in As3, but I can't seem to find the code to "search". If you have any easy way to do this please tell me, in the mean time I found a tutorial but it's in Flash 5, and I have no experience in transforming as1 to as3, can anyone help me here is the code: (on the search button)
ActionScript Code:
on (release) {
msg = "";[code]........
View 1 Replies
May 1, 2009
Is there a way of checking all the strings in an Array in one time ex:
Code: Select allvar array:Array = new Array("string1","string2","...")
if(text_field.text == array[everything]){
doSomething()
}
I already tried "for(var i:Number = 0; i<=array.length; i++){ ..." it just doesn't work well enough enough.
View 2 Replies