ActionScript 2.0 :: Adding Values Of 2 String Variables Together?
Aug 23, 2010
I meant to call it "Convert a value to a variable".Using CS3, AS2:If I have a variable that's a string value = the name of another variable, can I extract the value and then look for the extracted value's matching variable name to get it's value?[code](Assuming I don't know the value of box) How would I get the value of "box" out so I could search for the value "color" as if it were a variable? I need to convert a value to a variable name is what i'm getting at.
View 4 Replies
Similar Posts:
May 17, 2009
I meant to call it "Convert a value to a variable". Using CS3, AS2: If I have a variable that's a string value = the name of another variable, can I extract the value and then look for the extracted value's matching variable name to get it's value?
Ex:
color = "blue"
box = "color"
(Assuming I don't know the value of box) How would I get the value of "box" out so I could search for the value "color" as if it were a variable? I need to convert a value to a variable name is what i'm getting at... I think.
View 21 Replies
Nov 20, 2007
is it possible to add the values from a string to an array?For example my string looks like this:
var bookmarks:String = "book1, book2, book3";
And I need to add these values to the end of an array?
View 2 Replies
Aug 12, 2009
So I'm loading a variable into my .swf from PHP (using loadVars) and adding two loaded variables together. However, when they are added they "add on" to eachother.
Example:
varOne = 1
varTwo = 3
varOne + VarTwo = 13 (????)
I was thinking the variable may think it's a string, but I don't know how to declare the variables sent in from PHP.
[code]...
View 1 Replies
May 4, 2010
I need to be able to pass some variables FROM flash and append it to the end of my address. I assumed that if I used LoadVars, I can append the vars to the end of the string like this:
ActionScript Code:
send_btn.onRelease = function ()
{
var my_lv:LoadVars = new LoadVars();
[Code].....
View 4 Replies
Mar 16, 2002
If i have an ASP page that is returning variables (and I can see them in the debugger) how do i consentrate a string to call that variable?
ie:
variables being returned are named:
"res1", "res2", "res3"...etc
for (var i = 0; i < 10; i++) {
[Code]...
View 4 Replies
Jul 30, 2010
I have a list of strings that I add to an array, then attempt to set those values in a for-loop using data that I read in. The array gets updated, but the values the array contains do not. I also have an array of buttons that I update this same way that works great, but strings don't seem to work the same way. I have tried moving the string array to give it full scope, and still nothing...
public class test extends Sprite
{
// Declare a list of strings
protected var title0:String = undefined;
[Code]....
View 1 Replies
Jun 20, 2009
I'm trying to figure out which is more efficient in terms of memory and speed. What I'm doing is having a series of messages loaded to the screen. Is it just faster to write them in string variable or in an XML document which is more versatile in terms of editing and adding on to the document.
View 1 Replies
Apr 5, 2011
Haw can i add Array of value which user inputs. i just started learning and this is what i could do as of now
public function get Values():Array
{
return _values;
}
[Code]....
View 2 Replies
May 10, 2006
I am putting together a game where you fly a plane by pressing the arrow keys.
They acritionscript below handles that nicely. But I want to add boundaries so the plane will stay on the stage and not fly off it...
But I haven't been able to accomplish without bringing the plane movement to a complete stop.
adding the xposmax = 500 & yposmax = 300 to my actionscript. So the plane will stay inbetwenn x (0-500) and y (0-300).
gravity = 0.1;
fall = 0.1;
xpos = 0;
[Code]....
View 2 Replies
Oct 8, 2009
i also tried with leaving the == true off - adds to zero The code files are at [URL]
New Code
Code:
substance.text = myVars.substance;
sum.text= myVars.sum;
score.text = Score;
[Code].....
View 1 Replies
Dec 24, 2010
I'm just wondering if it is possible to use a string values as a way to use the addEventlistener function.[code]...
View 5 Replies
Sep 1, 2011
I'm trying to get the values contained in the following XML
<user>
<id type="integer">122</id>
<name>newuser</name>
<email>newuser@user.com</email>
<created_at type="datetime">2011-08-31T19:16:52Z</created_at>
[Code] .....
But in the debugger I can see that the vars XMLNAME< XMLEMAIL & XMLPoints are all being created but they are empty strings. How can I navigate to their values?
View 1 Replies
Jan 28, 2010
Something so simple, yet i want to slit my wrists.
i pass a variable into my querystring: "eof=true"
so in my html it looks like "filename.swf&eof=true" in the few places this is required.[code]...
View 3 Replies
May 11, 2010
How can I add a string values to an array
for Example
var abc:String = "my name is salim"
I just want to add four words my,name,is,salim into an Array.
View 2 Replies
Apr 21, 2011
I am trying to find the sum of one column's timings which is like '00:00:00' format. I am splitting the time string at ':' and storing into an array. Then trying to add array1[1] value to array2[1] value. Here I'm not getting type casting logic. I'm getting an error when I give int(array2[1]) += int(array1[1]) .
View 2 Replies
Oct 8, 2009
i also tried with leaving the == true off - adds to zero The code files are at [URL]
New Code
Code:
substance.text = myVars.substance;
sum.text= myVars.sum;
score.text = Score;
[Code].....
View 0 Replies
Jan 21, 2010
Right now I have a drag and drop exercise that will output a value based on the drop positions of 2 points. What I would like is to be able to add a button that basically has a whole new set of outputs based on the same drop positions. Here is an example. If I place an object on drop target 1 and 3. The output says something like "good job". Now if I click a button and place and object on 1 and 3 the output would say "try again". I hope this makes sense. I would also like the ability to add more than one button.
View 2 Replies
Dec 13, 2010
I'm trying to find a way to manipulate an array; well, two, actually, but I suspect one solution will fix both.
I have an comma-seperated string of numbers pulled from an xml file, that correspond to the correct answers in a multiple-choice exam app I'm working on. The numbers will always appear low to high, but there could be any number of them up to a maximum of 10, for example:
1,3,5
2,3,5,7,8
1,2,8,9,10
I've seperated the list out into an array, but what I'm eventually going to need to do is to compare this array with another array containing the user's answers. The array of their answers won't necessarily have the same number of values as the array of correct answers.
So, I'm thinking one way round this would be to add zeros in between the numbers in each array, so that they will both have the same number of values. To re-write the example arrays above, these would be manipulated to:
1,0,3,0,5,0,0 (for 7 possible answers)
0,2,3,0,5,0,7,8,0 (for 9 possible answers)
1,2,0,0,0,0,0,8,9,10 (for 10 possible answers)
I can then follow the same process for the array of user's answers (which could be almost anything, but will be limited to the maximum number of responses, i.e. 7 for the first array in the above list), and then run a function to compare the two arrays, which will, after adding the zeros, have the same number of values.
I've made several attempts at this, but keep getting tangled up in loops and if statements... I'm not exactly an Actionscript ninja, as you may have guessed by now!
how I can approach the above, or know of an existing script that will do what I'm after?
View 9 Replies
Sep 2, 2005
I have a movie that contains a series of radio button groups, which each have their own accompanying dyn text box. When a certain radio button is selected, a pre-determined value is loaded into each respective groups' text box, via "onRelease".
Now, I can get these values to appear fine in each text box, but I then have a fourth text box (amount_total), into which I want to have the sum of all the previous text box's values.
I have a submit button with the following actions on the first frame of the timeline:
onSubmit = function (){
_root.amount_total = Number(_root.total_surf) + Number(_root.total_music) + Number(_root.total_video);
}
Now, when I hit the submit button NaN is returned.
View 2 Replies
Sep 18, 2006
I'm not a programmer but have been using Flash for awhile. This is my first heavy dive into variables.I'm putting together a Quiz game where I pull the information from a txt file. I can get everything to display and work fine except for the adding of a total score.I have a series of values in a text file and load it into my movie. Depending upon what button I push, I want to take the value and add it to the total score. The next button I push I want it to add that value to the new total score.
View 3 Replies
Sep 20, 2009
how do i go about adding the values of array items together? basically i have an array of randomly sized rectangle sprites and i want to find their total length (as if they were lined up end to end)
View 3 Replies
Feb 3, 2010
When you want to split a string in to an array, seperated by the letter "e" for example. So string: 0e5e8e7 would become 0,5,8,7..[code]Is there a way you could split a string by multiple values? So instead of it splitting the string when it comes across "e", could you have it split when it comes across "e", or another character.
View 5 Replies
Aug 17, 2009
if I read a string from an external file, for example "51,42,7"
how would I break apart the string into a bunch of values?
View 1 Replies
Oct 10, 2009
i am trying to tell flash to put some text on a dynamic textfield on stage based on some variables written on the URL in the browsers address bar, sort of like how PHP uses $_GET.so for example, i have a file called "embed_page.php" and embedded in it is a swf file called "dynamic.swf"UrL>..trace("name is: " + n + " and color of choice is: " + c + " and gender is: " + g);if only i could get access to the URL in the address bar, i could play around with indexOf and slice to get the values i want...
View 1 Replies
Dec 26, 2009
I have 7 Dynamic Text Boxes, each with a numeric value.. I need to add them together.
Total = (ST2 + DO + GA + BO + CT + HT + TI);
This makes it 0000000 (Assuming each Dynamic Text had a 0 in it)
Total = (ST2 ++ DO ++ GA ++ BO ++ CT ++ HT ++ TI);
Gives errors. How do I do Simple Addition? It's been so long.
View 1 Replies
Mar 13, 2008
I have a flash file which loads in vars from director. It then adds the values to a graph. The amounts from the string are inputed into text fields. the fields are named energy, waste etc. I want a textfield to output whichever sections that are over 5 saying "well done, you have excelled in water, energy...... I have got this working but am stuck on this bit: I am wanting to add an "and" before the last item, so it outputs as "well done you have excelled in water, waste and energy". Also if only one item is over 5 it wont add the "and". This probably doesnt make any sense, heres my code anyhow:
Code:
var summary_results = "2000,6,3,10,8,6";
var txtFields:Array = [Total,Energy,Waste,Water,Food,Transport];
var excelledItems:Array = [];
var theValues:Array = summary_results.split(",");
for(var i=1;i<theValues.length;i++){
[Code] .....
View 1 Replies
Apr 9, 2008
I have 3 dynamic text boxes on the main movies stage that are getting their values from an externally loaded swf. If statements within the external movie loads the values from an xml file depending on which action is selected by the user. Now I have a fourth text box that needs to gather all the values that are loaded in the other 3 and add them together...placing zero if nothing is loaded. I have done various code tests...I get either NAN or _level0.total ...total is the instance name of one of the boxes, I am trying to access.
View 2 Replies
Aug 1, 2010
Im making 6 buttons all with different values. When you press one button the number that button holds will show up in 2 dynamic textfields.In the first field the numbers will come upp in a list form, one under another.and in the second textfield the number that the buttons have will add up.I have tried for some days now but cant come up with anything that worked.Haved tried with thisfor one button:
totalsum.text += Number(totalsum.text) + 22;
and this for the next:
totalsum.text += Number(totalsum.text) + 33;
[code]......
View 3 Replies
Jul 12, 2011
I'm having a hard time wrapping my head around this problem. I have 2 unsorted arrays that need to be compared, array2 must contain all elements of array1 and array2 can any number of extra elements without affecting the result. I don't see any benefits from sorting the arrays and comparing the string values as array2 can have extra information causing noise.
[Code]...
View 5 Replies