ActionScript 2.0 :: Call A Variable That Has A Variable Name?
Dec 28, 2003
I'm wondering how do u call a variable that has a variable name.
[AS]
max = 10;
For (i=1; i<=max; i++)
{
[Code].....
how can i do that? how do i address a variable name which is variable?
View 2 Replies
Similar Posts:
Nov 24, 2010
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 ?
View 1 Replies
Sep 1, 2009
Is it possibile to call a field of a object using a variable? Something like:
[Code]....
View 5 Replies
Jan 3, 2006
f you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:
PHP Code:
<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>
and it would display "success"...or like this:
PHP Code:
<?php$foo = "haha";$$foo = "success";print $haha;?>
and it would also display "success".
View 6 Replies
May 15, 2011
i have a variable take away another variable which makes answer1 variable i then want answer1 to be to the power of another variable how can i do this in flash
View 5 Replies
Jun 29, 2011
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...
View 2 Replies
Aug 24, 2011
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?
View 3 Replies
Feb 15, 2009
I have global variables:
_global.var1Array
_global.var2Array
_global.var3Array
_global.var4Array
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...
View 4 Replies
Sep 26, 2010
How do i go about this,
Lets say i have a variable _a:Number=5 and _b:String="_a"
I want to call a variable whose name is contained in _b
View 5 Replies
Dec 28, 2011
I am simply trying to get the variable from JS but can't get it
Code:
<script>
var APIfound = true
</script>
[code]....
View 0 Replies
Jun 24, 2006
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]...
View 2 Replies
Feb 27, 2007
I want to create a variable that I can call in a path. For instance:
Code:
var myVar = "varHome";
Then, to use in code:
Code:
_root.mcContent.varHome.gotoAndPlay(1);
Can you do that? This way obviously doesn't work (because I've tried it). Is it possible at all?
View 7 Replies
Sep 25, 2007
I am using Flash2004 MX
I thought this would be simple, but it hasn't been.
I have a seris of hidden MCs named star1, star2 etc.
I want them to become visible when I call this function.
star_fn = function() {
starcount++
starshow=("star" + starcount)
starshow._visible=true
}
But it is not working.
I thought maybe it was like converting variable info to a number format, but using a text scenario instead.
View 5 Replies
Aug 23, 2010
I am trying to call a variable from different class. I mean, I define a
PHP Code:
public var questionsAsked:String
variable in Main.as and want to call it from another class. but It gives me Access of undefined property questionsAsked.
View 2 Replies
Jan 7, 2004
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".
View 1 Replies
Apr 23, 2010
I have a Timer class and i am trying to call a variable from that TimerEvent class. But i am not sure how to do that. Do you have idea?
[code]...
How can get a var from outside to a Timer Class?
View 4 Replies
Sep 25, 2011
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?!
View 2 Replies
Sep 29, 2009
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.
View 7 Replies
Sep 26, 2010
It is possible to call variables using this[ "stringname" ] for instance, to refer to a variable called "stringname".
However, when referencing a static variable by the name "stringname", the "this" attribute no longer works if applied.
Is it possible to use this technique with statics?
View 5 Replies
Feb 23, 2011
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";
[code].....
View 7 Replies
Aug 4, 2011
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");
View 2 Replies
Jan 23, 2003
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?
View 3 Replies
Dec 23, 2008
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.
View 1 Replies
Apr 2, 2009
[Code].....
What's the proper way to write this line so I can replace the "j" variable with a number and be able to call up the proper mc (i.e. product1_mc)?
View 5 Replies
Apr 2, 2009
I just need to call a variable or function from a movie clip to main timeline. In AS2 I would use something like:
_root.myvar = "Hola";
or
_parent.myfunc(4,2);
But this doesn't works on AC3. I tried to remove the "_" but its the same.
View 2 Replies
Oct 4, 2010
Let's Say I Have This Class:
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
trace(getAverage(1,2,3));
trace(getAverage(1,2,3,4));
[Code]...
View 5 Replies
Mar 15, 2012
I need to call an object or function name with string variable.[code]it's working but, if I do something like below its not working [code]
View 2 Replies
Jan 7, 2004
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".
View 1 Replies
May 25, 2005
I'm trying to reference an instance through the use of a variable in my call to a prototype. The variable is myVar and contains the instance name to which I want to apply the resizeTo prototype. My syntax is incorrect.
Code:
on(release){
//disregard this line
this.swapDepths(this._parent.getNextHighestDepth());
//this is calling a prototype named resizeTo
this.resizeTo(150, -100, -100);
//Setting instance name of another movie
myVar = "green";
//Trying to drop that instance name into my next prototype call
this._parent.myVar.resizeTo(100, _parent.old_X, _parent.old_Y);
}
View 2 Replies
Aug 13, 2007
I have a variable in the _root called section.Now I want to call hemmaAnimation(); within a the global function (see below).So I set the section variable to hemma & tried these:
_global.sectionAnimation = function(){
this[section+"Animation"]();
};
[code]...
but no luck.
View 1 Replies