ActionScript 3.0 :: Concatenate Dynamic Variable?
Dec 23, 2009
I'm starting out with AS3 and migrating some old code. I have several dynamic variables in AS2 but they are using _root which isnt available in AS3.How would I go about switching the following variable to AS3? I have at least a dozen different variables similar to this one.
Code:
for (i = 0; i < (k-1); i++) {
pivot = _root["AI"+i][i][i]; // existing AS2 code
[code]......
View 3 Replies
Similar Posts:
Jul 19, 2006
I'm trying to achieve something i thought would be extremely easy, but i can't get it to work!
[Code]...
View 1 Replies
Nov 24, 2007
How do I concatenate variable names in AS3?Something like this:
for(var i:int=0 ; i<5 ; i++) {
var "myVar"+i:Array = new Array();
}
View 5 Replies
Nov 20, 2007
I'm trying to concatenate a name and variable number. Then trace it, so answer3 should output from my loaded xml data "water". Instead all I can get to trace is the word "answer3". If I type "answer3" in the trace I get the variable im looking for. If I type [this.getCorrectAnswerNumber()] in the trace I get number 3. How do I go about concatinating the word answer and a dynamic number.
Heres my code...
Code:
trace("answer"+[this.getCorrectAnswerNumber()]);
View 7 Replies
Sep 19, 2010
I have a submit button that I'm pulling in from XML.
It needs to be XML because it is translated.
Therefore... the length is varying depending on the language.
I simply want to add an arrow to the end of the word using Webdings #4 (it looks like a solid arrow, not like > but solid)..
View 2 Replies
Sep 19, 2010
I have a submit button that I'm pulling in from XML.It needs to be XML because it is translated.Therefore... the length is varying depending on the language.I simply want to add an arrow to the end of the word using Webdings #4 (it looks like a solid arrow, not like > but solid)...
View 4 Replies
Sep 19, 2010
I have a submit button that I'm pulling in from XML.
It needs to be XML because it is translated.
Therefore... the length is varying depending on the language.
I simply want to add an arrow to the end of the word using Webdings #4 (it looks like a solid arrow, not like > but solid)...
View 1 Replies
Apr 27, 2010
Is there any way to concatenate E4X expressions? If I store "half" a path in a variable, can I concatenate the way I do with Strings?
View 3 Replies
Nov 25, 2008
When I use the code below the "!" never appears in the output text field. I tried removing nameInput.text and then the "!" will appear. But with nameInput.text in the code, any string I try to add after it does not appear.
View 3 Replies
May 27, 2009
How can I prevent concatenating when using the addition operator? totalCost_txt.text = (firstCost_txt.text + secondCost_txt.text)I can replace the "+" with any other operator and it works. (huh?)
View 3 Replies
Apr 6, 2011
I'm trying to make a function which ideally you tell it to go to the next level and it sorts everything out to transition to the next level for you. Currently I use this to get from level 1 to 2...
[Code]....
Also I need to make it so it checks if levelText == whatever on press of the Enter key, as well as the mouse click on GoButton.
View 2 Replies
May 26, 2010
I have this code to push "Variable1" in to MyArray:
ActionScript Code:
_root.MyArray.push(Variable1);
Note:
"Variable1" is a number stored as a string.
When "Variable1" changes, the code above is called upon to add the new "Variable1" value in to MyArray. Then I have this code which is called upon to find the sum of all the values within "MyArray":
ActionScript Code:
for (i=0; i<=_root.MyArray.length-1; i++) {
_root.MyArray_Total = _root.MyArray_Total + MyArray[i];
}
My problem is that rather than adding the values contained within MyArray (as if they were numbers), the values are being concatenated instead.
Example:
If MyArray values were 1, 2, 3
I want the MyArray_Total to = 5
But instead... MyArray_Total = 123
I tried making a new variable named "Variable1_num", declaring it as a number, making it equal to "Variable1", and then pushing "Variable1_num" in to "MyArray"... but that didnt seem to work either.
View 1 Replies
Dec 6, 2011
It is possible to reference an array inside of an image file name, here's the scenario.
I have a list of images that only differ by the number at the end of the name (for example. orangeimg1.jpg, appleimg2.jpg, strawberryim3.jpg, etc. Is it possible when referencing the image that I could somehow reference the array in the file name rather than repeating the same code over and over again?
I have two different arrays set up one for fruit which has (orange, apple, stawberry) and I have another array with the numbers (1, 2, 3). I have jpg images for each of these combinations but how to I reference that in one line when I'm trying to refer to these images. I thought something like source = "[fruit].img.[number].jpg" would work
Again I've found some information on the web but it doesn't refer to how it would work if I was coding a source for my images.
View 2 Replies
Mar 30, 2011
The course contain ten chapters that all have to report that when a user completed them. When they all are, the status is set
to "completed" for the course. First off the theory behind it:
1. I just completed a chapter.
2. Load a string with then numbers "0,0,0,0,0,0,0,0,0,0", one for each chapter. All 0's, no chapter is completed, all 1's, all chapters are completed, you get the picture.
3. Add a 1 for, lets say chapter 5, would look like this "0,0,0,0,1,0,0,0,0,0".
4. Check if the course is complete, like this: "1,1,1,1,1,1,1,1,1,1", or not.
5. If complete, set status to "complete", if not, set to "incomplete".
In practice:
import flash.external,*;
String(ExternalInterface.call("LMSGetValue, "cmi.suspend_data, TheCourseStatus"));
String(ExternalInterface.call("LMSSetValue, //..add the number "1" to
[code]....
So, after this rant. How do I,
1. Get the string.
2. Add the course number/value to the string
3. Then update the string, and..
4. ..set the appropriate status.
I found out that "I need to concatenate them together with a delimiter so I can separate the string on re-entry", but I don't know how to do that.
View 0 Replies
Jun 29, 2008
var c = mainSubThumbs.SubThumbsHolder[materialType].subthumb_mc[id] what i have obviously doesnt work. materialType and id are my variables that I want to be added onto these mc instances..
View 9 Replies
Mar 2, 2010
I have the following code in actionscript 3:
var async:AsyncToken;
async = bridge.retornamenu();
The bridge is a remote object, instantiated. The retornamenu() is the function that I want the remote object open in amfphp.
However the retornamenu() is a dynamic function, which turns another function, but I can not run it at runtime,
example
var stringfunction:String = "retornamenu()" // this name is dynamic.
var async:AsyncToken;
async = bridge.stringfunction;
But this way does not work, not perform the function retornamenu();
View 1 Replies
Jun 14, 2010
I can't for the life of me come up with anything that works...
function setCurrentCMI(id){
if (_level0.strInteraction+id==""||_level0.strInterac tion+id=="undefined") {
//does nothing, user hasn't been here yet
[code]......
View 0 Replies
Aug 22, 2005
can't figure out why the dynamic text boxes in my dynamic clip arent picking up the variable when I loop through this recordset!the trace (you'll see here right after I try two ways to assign the variable) traces the correct info back..
[code]...
View 1 Replies
May 29, 2009
I'm trying to make something that will show up in a dynac text field something like this:"[variable1] text text text [varibale2] text text text"I've linked the dynamic text field to a variable "resu" and set it to:var resu = variable1 + "text text text text" + variable2 + "text text text"The only problem is that when I make the variables random, they don't change
View 1 Replies
Feb 19, 2010
I have a movie clip and in that movie clip there is a dynamic text box. I want that text box to display a dynamic variable name something like:
Quote:
_root.var_[this._name]
so the variable will be _root._var plus what ever the instance name of the movie clip it's in is, how can i do this?
View 1 Replies
Oct 21, 2005
[URL]
And in this flash movie, in a text area, it shows whatever you type in before the string ".youarelame.com".
How was this done?
Is it possible to pass a variable to a Flash Movie thru the URL?
Like, for example, if I were to do something like this: [URL]
could I process the "USERNAME" variable with some code somehow and get it to return my USERNAME back to me in the Flash movie?
View 1 Replies
Feb 2, 2009
Code:
// what i have
ans1 = pollSet.getItemAt(0).ans1;
ans2 = pollSet.getItemAt(0).ans2;
ans3 = pollSet.getItemAt(0).ans3;
[Code].....
How would I go about declaring a dynamic variable based on the field name like I'm attempting to? Of course I could leave it the way I have it, but for future reference, how would I harness the scope of "this"?
View 4 Replies
Feb 25, 2009
I've never had to deal with a mc inside of an mc this way before... Basically they're already on the stage and creating them dynamically would require recreating everything.... Not worth it.
Code:
//14 total
for (var i:Number = 0; i < 14; i++){
[code]....
View 5 Replies
Nov 16, 2009
I have a xml file with some elements. I need to create a movieclip for each of these element. The name of the movieclip should be different for each.
[Code]....
View 4 Replies
Jun 9, 2009
Using AS2. I have a variable defined:
activenav = "services";
I then want to reference the variable in a MC string. I've tried many variations of this:
_root.my[activenav]Clip.gotoAndPlay("Out");
Essentially, I want Flash to see this as:
_root.myservicesClip.gotoAndPlay("Out");
Getting syntax error.
View 2 Replies
Jun 27, 2009
I've tried to make a function that will allow me to change the value of any variable in my flash movie, but it doesn't seem to be working. Here's my current code:
PHP Code:
function changeVar(variable,varValue) {
variable = varValue;
}
changeVar(score,"50");
View 1 Replies
Nov 21, 2010
I am loading images via xml lazyloader into my air app
[Code]...
If you dont know the lazyloader code then can you please explain how to create a dynamic variable for a bitmap???
View 4 Replies
Aug 14, 2008
[Im currently using Flex builder 3 ]I want to have a dynamic expression in actionscript
Code:
//skey is a label which should contain the xml node VALUE
skey.text = 'reftables_additem_load_dataprovider.lastResult.DATARESULTS.VER_DATA.' +
answer to remain on the screen
View 2 Replies
Jul 7, 2010
I'm attempting to use a for loop to set the onPress functions of all the buttons on a keyboard. Here is what i'm using so far:
Code:
Target.text = ""
Letters = Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "_")
[Code].....
View 2 Replies
Oct 16, 2010
In this game I'm creating I want to be able to add movie clips to the stage but give them instance names which will increment per clip.To give you an idea of what I mean, here is some sample code (which in my mind should work):
ActionScript Code:
for (var i:int=1; i<=10; i++) {
var root["enemy"+i]:MovieClip = new enemyBall();
[code].....
View 4 Replies