and so forth.The issues is I need to call a variable from within the array but depending on an option the user has chosen it needs to call the right one.At the moment I am trying
end = "_global.var"+userOption+"Array["+array#+"]";
userOption being the needed array
array# being the needed entry within the array.
However when I try and use this I of course just get it like a string, not as a variable...
I want to monitor a variable. Whenever the variable value changes I want to call a function. In actionscript 2 I can use "watch" but in as3 what can do ?
In the below code, "sector" is an indexed array.fsector1, fsector2,fsector3 are Associative arrays.The "gotoAndStop" command doesnt work properly.The last trace command, "curTerr" returns the same value as "curSec",leading me to assume i did not define "curTerr" properly.
Actionscript Code: function loadmaptest(){ sector = ["fsector1","fsector2","fsector3"] fsector1 = new Array(); fsector1["terrain"] = "grass"; fsector2 = new Array();
I'm going to post the full code of the two functions, disregard the "fluff" unrelated to the two functions as it is all working flawless, I've tested this HEAVILY and cannot understand why it keeps setting the entire array to undefined!
Code: // processReplace Function function processReplace(transferFiles) { var processArray:Array = transferFiles.slice();
[Code]....
Basically it's supposed to check to see if the file exists and return as true if it does and add it to a replace array, then the replace array is processed into a single string and put into a dialog box through the flash wrapper prompting them to "replace the files or not".
It makes the replace array just fine, it actually even has the right "count" in it but it's setting all the "filenames" to undefined because of the exists = processSearch function.
I even tried to make a new array and run the search just from that one and set the values from the old one and it's still failing.
Is it because of the "break" or can anyone figure it out? Iknow it's hard because you can't use the code
I want to change the value of a variable listed in an array using the array. for example:
Code: var theVariable:Number = 15; var theArray:Array = [theVariable]; now if I try this
Code:
theArray[0] = 20;
I just get an array with 1 value of 20 in it and it no longer references theVariable what i want to do is change the value of theVariable with out removing it from the array but referencing it from the array in a loop or something.
i want to call a function from within a function using a variable representing its name...
[Code]...
i've been tryin to figure this out for quite some time now since FLASH MX , i just kept abandoning a solution.. and now i'm once again in need of this , still cant solve it so im postin...
basically i want to populate an array with some data, photoArray[count]= varLoader.data.nombre; the problem is that "nombre" is suposed to be a variable, this is inside a loop and i have "nombre = "pic" + count;" before it, but it wont work, how am i suposed to call it?
I'm just getting the hang of AS2 OOP, after avoiding it for all this time, and I have set up my first couple of classes.
One class generates an array, and the other class takes this array, and uses it it to place MC's on the screen, and gives each mc an onEnterFrame function. I have a stack of these onEnterFrame functions, named 'avoidIt1()-avoidIt11()'[code]...
Can I call a variable declared in a SWF, and call the same variable into another SWF, when i am loading it using XML.I am declaring a variable in the "Child movie", and am loading this "Child movie" into a "Parent movie" using XML. Can I retrieve the variable declared in the "Child movie" in the "Parent movie".
I'm trying to pass a variable through a function, but I'm getting it's value 0. Here's my code:
thumbLoader.addEventListener(MouseEvent.CLICK, goToCategory); function goToCategory(e:MouseEvent) { trace(c);[code]....
this trace gives me value of 0. Normally I would do goToCategory(c) and inside that category I would get it's value, but in this case I'm calling this function with an event, how can that be done?
var c is declared globally, so I'm using it above this code in different place... is there smth like global $c like in PHP.. or there's some other way to do it?!
I'm brand new to actionscript and I've decided to try and make an overhead tile scrolling game. It's been going good so far, but here is my problem: I have the level data stored in an array, where the number represents the corresponding tile. I have movie clips in my library called "tile_1", "tile_2", "tile_3" etc. Anyway, what I was thinking of doing was this: var newTileContents:("tile_"+lvlArray[i]) = new ("tile_"+lvlArray[i])(); newTile.addChild(newTileContents); Where, if the value in the lvlArray at [i] is 2, then it will create an instance of tile_2 etc. But I am not sure how to to type the "tile_"+lvlArray[i] bit properly.
I have a several functions that I can compact into 1 function via a for loop if only I can find a way to call the variable by name.
For example:This is what I want to accomplish: (However I do not have the slightest clue as to how to go about doing the below...)
ActionScript Code: var test1:String = "testing 1"; var test2:String = "testing 2";
[code].....
I am able to do something similar to the above when using objects using methods such as: (I know not efficient, but its just an example to show what I am trying to accomplish.)
ActionScript Code: var test1:String = "testing 1"; var test2:String = "testing 2";
I want to use a variable in my movie clip code. Right now I generate a random U.S. state name and assign it to "correctAnswer". Then I want to assign that to myMovieClip.correctAnswer.gotoAndStop("down"); The problem is that the variable is not recognized and is seen as correctAnswer instead of the U.S. state that was assigned to it. My code is below.
ActionScript Code: // Correct answer is randomly generated and can be any U.S. state name correctAnswer = "utah"; // Using the variable correctAnswer this should come out as myMovieClip.utah.gotoAndStop("down"); myMovieClip.correctAnswer.gotoAndStop("down");
Is it possible to call an instance of a movieclip by a variable name?
Say I have several movie-clips on the main timeline and a variable named "disabled". I want to click a button and have be able to tell "disabled" to goto frame 2, where disabled will contain the name of the movie-clip. can I do this?
I need a way to call a function from a function. It's not that hard, I know, but the name of the nested function is a variable passed into the first function. Like in setTimer() and other functions in flash, where you have the name of a variable to call. I'm going to have a lot, so doing some cheap if(funcname == blabla){blabla();} won't work.