ActionScript 2.0 :: Reference The Variable Pointed To By The Variable Text?

Jan 5, 2012

How do I reference the variable pointed to by the variable text?

Say I have:

engine_level = 5;
v_name = 'engine';
pb_name = v_name + '_p_button'; // so pb_name = 'engine_p_button';
level = v_name + '_level'; // so level = 'engine_level';

[Code]......

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Reference The Variable Pointed To By The Variable Text Cont?

May 25, 2010

How do I reference the variable pointed to by the variable text but pointed to by more than one function?Say I have:

engine_level = 5;
tank_level = 3;
v_name = 'engine';

[code].....

View 4 Replies

Reference Text With Variable?

Oct 20, 2009

I want to be able to reference the text of a text box within an MCThe MC is called "box1", the text field is called "field1"...I have many MCs (all with field1 in them)... box1, box2, box3 etc etcObviously I can set the text to being something by saying...box1.field1.text = "set_this_text"However, I'm using a variable to come up with the "box1" bit. (Using an array and a loop to figure out which box I want to update based on where the user clicked). So, let's say I have a variable... and I want to say..boxClickedon = box1 //will be defined by userSo I don't know in advance about box1... I can only access it through "boxClickedin" variable, but

boxClickedin.field1.text = "set_this_text"
or
[boxClickedin].field1.text = "set_this_text"

[code]....

View 1 Replies

ActionScript 3.0 :: Use Of A Variable To Reference A Text Box In An Instance?

Aug 16, 2009

Lets say I have 3 Movie Clip Symbols in  my Library : Movie0, Movie1 and Movie2
 
Each movie has a dynamic text box: "TextBox1"
 
I want to be able to write a function that can manipulate the alpha(or any attribute) of the TextBox1 in all three MovieClips.

In my limited experience I thought I could do something like the following:

for (var row:int = 0; row < dataArray.length; row++)
{
Movie(row).TextBox1.alpha = 1;
}
 
I hoped that this would loop through 3 times and set the alpha of the TextBox1 in all three movies to 1.
 
Is this possible? Can you reference an instance with use of a variable?

View 2 Replies

Professional :: Reference A Text Field With A Variable?

May 7, 2011

I have 10 text fields named "text1", "text2" etc;

I'd like to use a for loop to pulate each one, so that each text filed is populated with whatever i is:

for (var i:Number=1; i<=10;i++)  {
"team"+i.text = i;
}

I keep getting errors with regards to how the text filed name is referenced.

What is the correct way to increment the text filed name and reference it?
 
I've tried:

["team"+i].text = i;
"team"[i].text = i;

but they don't work.

View 1 Replies

ActionScript 3.0 :: Use A Variable(text) To Reference A Movieclips Instance Name?

Nov 28, 2010

i want to use a variable(text) to refrence a movieclips instance name

Code:
function InventoryShow(event:Event):void
{
var SC:URLVariables = new URLVariables(event.target.data);

[Code].....

View 1 Replies

ActionScript 2.0 :: Create A String Then Use It To Reference A Variable In An External Text File

Jan 19, 2011

So i have an external text file organized like this:

/* $file: data.txt */
&title0=Sacrum
&detail0=Detail text for Sacrum
&title1=L5

[Code].....

There are 28 of these 'title' and 'detail' pairs. The 'title' text is to fill a dynamic text box and the 'detail' to fill another dynamic text box depending on which section the user is mousing over.

My issue is getting the text from the file stored into arrays. For my test loop I keep getting undefined as the stored value, and i know it has something to do with converting a string value to object..

var lv:LoadVars = new LoadVars();
lv.onLoad = handleDataLoad;
lv.load('data.txt');
function handleDataLoad (success:Boolean) {

[Code]....

View 1 Replies

ActionScript 2.0 :: FMX:Loading External Variable From Text Into Variable

Sep 8, 2003

I want to load an external variable called name from a text file into a local variable in flash called my_str...here's what I have:

var loadText = new loadVars();
loadText.onLoad = function(success) {
if (success) {

[Code]....

I need to have the variable my_str available outside the function..

View 3 Replies

Flash8 :: Variable Within A Variable For Dynamic Text?

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

ActionScript 2.0 :: Create A String Variable...and Then Use The Value Of That Variable To Declare Another Variable?

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

IDE :: Reference Function With A Variable?

Mar 2, 2010

Is there a way to reference a function via a variable? In other words, instead of saying something like:

var theVar = someString + 'function';
if (theVar == 'functionName') functionName ();
to access it directly:
(someString + 'function') ();

using some kind of bracket notation?

View 1 Replies

ActionScript 2.0 :: Dynamic Reference To MC Using Variable?

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

ActionScript 2.0 :: Reference Variable From Outside Function

Apr 9, 2010

i have a function that read a variable from a text file, yet i can only read the variable from within the function. How could i create a global variable or such that i can then read from outside of the function.

Code:
var Make:LoadVars = new LoadVars();
Make.onLoad = function() {
VARIABLE = Make.textVariable;

[Code].....

View 1 Replies

ActionScript 3.0 :: Reference A MovieClip Via Variable?

Nov 12, 2011

The scene is a number of movie clips, all already added to the stage (i.e. not dynamically) and when one is clicked, I need to call a property of that clip. [code]...

View 3 Replies

ActionScript 3.0 :: Use A Variable Value As A Reference To A MovieClip?

Oct 14, 2008

How do you use a variable value as a reference to aMovieClip?I'd like to do this:

A2.visible = false;
myVar = A2;
myVar.visible = true;

[code]......

View 1 Replies

ActionScript 1/2 :: Use AttachMovie With A Variable ID Reference?

Jan 31, 2008

I am trying to write an attachMovie statement with a variable feeding the ID parameter.[code]...

View 1 Replies

ActionScript 3.0 :: Using Array Value To Reference Variable

Sep 25, 2009

I want to loop through an array and use the array value to reference a variable. The Setup:(For illustration only. Not actual script)

[Code]...

View 3 Replies

Actionscript 3 :: Make Variable Act Like Reference In It?

Aug 22, 2011

Can you have "ByRef" arguments in AS3 functions?

Primitive types in AS3 pass by value instead of reference. Is there a way to override that behavior and pass by reference for certain variables? [code]...

View 3 Replies

Flex :: Object Reference Through Variable Value?

Dec 29, 2011

Is it possible to reference an object using a variable value?

For example, I have a function that is supposed to hide an image and add that image to an inventory list when the item is clicked.

All the image info is stored in an object (name, imgSource, visible, x, y);

I was thinking I could do something like this:

<fx:Script>
<![CDATA[
public var item:Object = new Object();

[Code].....

I want "item" to stand for knife so that I could change knife.visible, knife.xPos, ect.

View 2 Replies

ActionScript 3.0 :: Assign A Reference To Another Variable?

Feb 14, 2010

Code:
public function Text1Down(e: MouseEvent): void{
var textArea:Label=Label(e.currentTarget.id);
.......
}

I get this error:

Code:
TypeError: Error #1034: Type Coercion failed: cannot convert "text1Area" to mx.controls.Label.

I know that e.currentTarget.id is of type Label. All I want is to make a reference variable so I don't have to keep typing long names.

View 2 Replies

ActionScript 3.0 :: Using This[] To Reference A Variable - Not Working ?

May 2, 2010

I'm writing a function which can take the names of different variables and use them to do some calculations. Long story short, I want to be able to call the function like this:

It probably seems like a really roundabout way to pass the variable through its name rather than just passing the variable itself. This is related to me using XML to get the variable names, so they come in as strings. Just bear with me here.

Inside the function, I want to be able to do something like this:

which should then trace the variable's value. Unfortunately, I just get an 'undefined'. How do I use 'this[]' to get the value of the variable from a string corresponding to the variable's name?

View 6 Replies

ActionScript 3.0 :: Reference A Referenced Variable?

May 19, 2011

I'm not entirely sure that I've even asked the question correctly in the title but hopefully) this description will make it a little more clear.

Code:
private var mySpriteA:Sprite;
private var mySpriteB:Sprite;

[code]......

View 3 Replies

ActionScript 2.0 :: Passing A Variable By Reference?

Aug 30, 2006

function foo(bar:Number){
bar = 5;
}

simple example. How do I pass bar by reference to change it's value in the function.

well at least in C++ it's called passing a variable by reference.

View 2 Replies

ActionScript 3.0 :: Using String To Reference Variable Name In XML?

Apr 2, 2009

Is there, uh, a way to use the value of a string to reference a variable name?

I'm trying to dynamically assign XML node names and attributes using a string value, I tried something like this:

Code:
var sItem:String = "book"; // to be dynamically assigned
for (var i:uint; i < _xml.book.length(); i++) {
aList.push(_xml.(this[sItem])[i].@title);

[Code]....

View 2 Replies

ActionScript 3.0 :: Reference A Object Through A Variable?

Mar 11, 2010

If I wanted to change the 'x' of a object, and a variable contained a the object's name, how would I change the 'x' by using the variable.Without variable:

Code:
myObject.x = 123;
With variable maybe?:[code]....

View 6 Replies

ActionScript 3.0 :: Using This[] To Reference A Variable Not Working?

May 2, 2010

I'm writing a function which can take the names of different variables and use them to do some calculations. Long story short, I want to be able to call the function like this:

function caseConditionEvaluator( nameOfVariable:String )

It probably seems like a really roundabout way to pass the variable through its name rather than just passing the variable itself. This is related to me using XML to get the variable names, so they come in as strings. Just bear with me here.

Inside the function, I want to be able to do something like this:

trace( this[nameOfVariable] )

which should then trace the variable's value. Unfortunately, I just get an 'undefined'. How do I use 'this[]' to get the value of the variable from a string corresponding to the variable's name?

View 3 Replies

ActionScript 2.0 :: Using A Variable To Reference An Object?

Mar 2, 2004

I desperately hoping someone can shed light on my problem. I am trying to reference a movieclip with a variable. I've done it before but in loops reading from xmlobjects but cannot get it to work in the most simplist way....??ar i = 0;_root.movie[i]._visible=0;

View 2 Replies

ActionScript 3.0 :: Variable Take Away Another Variable Which Makes Answer1 Variable

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

ActionScript 2.0 :: Remove A MovieClip W/reference As Variable

Nov 23, 2011

How would I remove this attachMovie? [code] I have tried these codes with no success [code]I am using flash 10.2, in flash professional 5.5.

View 1 Replies

ActionScript 3.0 :: Creating A New Instance With The Same Variable Reference?

Mar 8, 2011

set to null a reference in this case?

private function initGame():void{
var game:Game = new Game()
}

[code]......

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved