Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Tracing Variable Names In AS2



I want to be able to trace variable names in AS2. Ideally I would make a function that's kind of like this..

function tracevar( var:* ):Void{
trace( var._name + ": " + var );
}

Anyone know how to do something like this, or if it's even possible?



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-29-2008, 04:49 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Tracing Instance Names With OnMouseDown()
Hi

im trying to get something like: 10 buttons in the stage with instance names, and when you click on one of them you got a trace with the instance name of it.
But i dont want to had code to the buttons, i would like to use a listenner with onMouseDown()

Any ideas?

Tracing A Variable At The End Of The URL
Ok, forgive me if this sounds like a stupid question. I'm new to dynamic programming in flash. I can't find the specific answer i am looking for on the net or on this message board.

If someone could provide an answer or point me into the right direction I'd very much appreciate it.

The Problem
All I am trying to do is simply trace this variable at the end of this URL:

http://www.theurl.com/sampler/Sampler.htm?vSamp_Id=VUBZ

Here is my attempt:


Code:
myVariables = new LoadVars();
myVariables.load("http://www.theurl.com/sampler/Sampler.htm");
myVariables.onLoad = function(success) {
if (success) {
var sample = myVariables.vSamp_Id;
var theSample = (sample);
trace ("this is the variable: " +theSample);

} else {
trace("there was a problem loading the variables");
}
};
It is coming up undefined and due to my weakness in actionscript syntax, I cannot see why.

Tracing Variable Name?
hello world...
how do we get the name of some variable:
ex:

ActionScript Code:
_level0.one.abc.pepe.ok="yes"
trace(_level0.one.abc.pepe.ok)///output yes
///but i want in the output the name or the path...
//like
trace(_level0.one.abc.pepe.ok._name)///undefined O_ô

I dont know the property to get this... :S
Thanks

Tracing Variable
I have a variable that changes based on what is clicked. How can I trace what that variable is defined as. I tried just doing trace (myVariable); but that didn't work (I didn't think it would).

Thanks

Variable Tracing Problem ?
according to me isn't this possible of there's going something wrong:

if (_global.musictrack == "1"){
_global.musictrack = "2"
_root.mcBG.mcRadio.mcRadioLoader.gotoAndPlay(1);
}

because if i trace _global.musictrack in the mcRadioLoader on frame 1 i get the value "1" back :S! (but i want the value "2" :confuded: )

who can help ?

Variable Tracing Problem
hi

i asked this question in another forum but got no reply so maybe it is a silly question but it is confusing me!

i'm having a very annoying flash mx problem tracing variables within movie clips on my main timeline that is driving me nuts!

i have created a movie clip "circle" with the variable "radius = 12;" on the first frame of the clip.

i place a named instance (crc) of this movie clip on the stage and on the first frame of the main timeline i put a "trace (crc.radius);". this returns "undefined" in the output window when i test the movie. what gives?

if someone could set me straight i would be grateful.
thanks

Variable Tracing Problem ?
according to me isn't this possible of there's going something wrong:

if (_global.musictrack == "1"){
_global.musictrack = "2"
_root.mcBG.mcRadio.mcRadioLoader.gotoAndPlay(1);
}

because if i trace _global.musictrack in the mcRadioLoader on frame 1 i get the value "1" back :S! (but i want the value "2" :confuded: )

who can help ?

Variable Tracing Problem ?
according to me isn't this possible of there's going something wrong:

if (_global.musictrack == "1"){
_global.musictrack = "2"
_root.mcBG.mcRadio.mcRadioLoader.gotoAndPlay(1);
}

because if i trace _global.musictrack in the mcRadioLoader on frame 1 i get the value "1" back :S! (but i want the value "2" :confuded: )

who can help ?

Apply Variable Values To Variable Names?
I have a gallery with a series of 5 thumbnails, named gallery_position_1, gallery_position_2, etc, up to 5. I am loading an image with XML into gallery_position_(#), and have a button on top of that with scripts on it.

My question is whether I can have an integer variable (call it x) that starts at 1 and can be put into a for loop, using it then on the end of my other variable like so:

for (x = 1; x < 6; x++) {
gallery_position_x.loadMovie(URL path to image);
}

I basically want to be able to "index" a regular variable by changing a number within its name. I know its a long shot, as I've never seen it done before, but I thought I'd ask, all the same.

Variable Names Are Part Of A Variable Itself
hello,

i ahve a deadline and im in a bit of a mess, i was wondering if anyone knows the awnser to this one.

i am targeting a variable in another movie the name of the variable is ' ysh1 ' this is a score and the is 9 other they are ' ysh2 ' , ' ysh3 ' etc.
and a variable on the main time line called ' hole ' ,
it's value is ' 1 '.

this is the variable that targets ' ysh1 '.
set ("_level0.display.score.ysh"+_level0.hole, "_level0.display.score.ysh"+_level0.hole+"+1") ;

so it does target the variable, that works fine but i cant make the score increase by 1
im just try to increase the score by one evey time this function is called.

it's driving me mad.

any help would be great.

For Command And Variable Variable Names
i have a small 5x6 matrix of textboxes with var names in this scheme
11 means first row first column
12 means first row second column
34 means third row fourth column...

i wanted to create a reset function to set them equal to 100 times the row number

i am not very fluent in actionscript, but i know a little, i tried to fill in with psudeo-PHP style coding, and came up with this.

CODE//create a var "hundred"
var hundred = 0;
//define function
function reset(){
//for each column
    for(y=1;y<=5;y++){
//set hundred equal to 100 times the column number
        hundred = 100*y;
//for each row
        for(x=1;x<=6;x++){
//set the variable that has var x as the first digit and var y
//as the second digit equal to the current value of the var hundred...
//in php ${$x.$y} = $hundred
            {x+y} = hundred;
        }
    }
}
//apply the function
reset();

Variable Names
hi all
how can I change the name of a variable when creating it?

var (PartOfName + OtherPart) = 10

Variable Names
if i have some vars:

var_1
var_2
var_3

how do i access them dynamically in a loop?

eg:

txt_field.text = var_ + i;

Variable Names
ok, I'm a bit of a flash n00b.
I was trying to create global variables named using a combination of a word and an identification number, but I can't figure out how to phrase it properly. The part in red is my problem. If this worked properly it would create global variables named mass1, mass2, mass3 etc.


Code:
for (var i = 0; i<_root.totalorbs; i++) {
_root.["mass"+i] = _root["orb"+i]._mass;
}

Variable Names
ActionScript Code:
storycontent0 = "Day 1 - The Carnage Starts
The first day";
idnumber = 0;
story = this["storycontent"+idnumber]

this sets story to storycontent0.

however i need my menu button to set the content which is two levels above the timeline


ActionScript Code:
this.onRelease = function(){
    _parent._parent.storycontent = _parent._parent.["storycontent"+idnumber]
}

this doesn't work! i've tried different types but can't get it to work - any ideas?

Cheers,

Matt

Variable Names
Hello,

Is there any way that a movieclip named:

mcsomething1;

have a variable inside of the name so that it is:
var num:Number = 1;
mcsomethingnum;

?

thanx.

Variable Names
Can anyone tell me why this works:


Code:
my_mc._x = 10; // puts 'my_mc in the right place
while this does not

Code:
v = "my_mc";
v._x = 10; // nothing happens
and how to fix?

Using XML For Variable Names
hey, I'm attempting to build a menu using a XML. I have read the tutorial on the site and I am attempt to do it in a slightly different manner.

Anyways, I am trying to make dynamic variable names for my text fields. And because of the way I am doing this I found it easier to try to use XML to hold the field name. But when I try to use the name from the XML file it won't work. I can trace it and get the proper word but when used in the script it breaks.

Below I want to replace 'popMenu' with the fieldName variable.


Code:
mainMenu.menu1.onRollOver = function(){
listLength = menu_xml.childNodes[0].childNodes;
for(i=0;i<listLength.length;i++){
if(listLength[i].nodeName == "m"){
listLength = menu_xml.childNodes[0].childNodes[i].childNodes;
tbH = 100;
for(ii=0;ii<listLength.length;ii++){
bCat = menu_xml.childNodes[0].childNodes[i].childNodes[ii].attributes.n;
fieldName = menu_xml.childNodes[0].childNodes[i].childNodes[ii].attributes.cn;
mainMenu.menu1.createTextField("popMenu",this.getNextHighestDepth(),0,tbH,80,50,50);
mainMenu.menu1.popMenu.text = bCat;
tbH+=15;
trace(ii);
}
}
}
}

Variable Names
Hello,

Is there any way that a movieclip named:

mcsomething1;

have a variable inside of the name so that it is:
var num:Number = 1;
mcsomethingnum;

?

thanx.

Help With Strings And Variable Names
Hi everyone,

I seem to have bitten off more than I can chew with an interaction I'm trying to program.

It's a drag and drop activity, and one of the things I'm trying to do is set a variable based on
the name of the droptarget.

In other words, if my droptarget equals "/target1", i then want to be able to set a variable called
/:target1 equal to "busy", so that I can prevent other drag objects from being dropped there.

How do I take the value of the droptarget, suck out the contents, minus the slash at the
beginning, so that I can turn it into a variable name with "/:" add whatever???

I don't even know what this kind of action is called, so I can't look it up in the reference!

TIA!!!
js

Listing Variable Names
for (i in _root){
trace(i)
}
will list all the mc names
does anyone out there know how to list all the variables?
cheers for any help

Problems With Variable Var Names..
I'm having this problem.. I thought I'd use the code i found in actionscript.org's tutorial altho for something slightly different.. the code as.org used was

_root["boxx"+count]._x = random(550);

for changing the property of a dynamically created mc..
(This works fine)

So I tried 'the same':

ans1 = ["answers"+currentq][0]

This is for a questionairre, and all the variables are set right (I checked).. Still, all this displays is.. 'answers0' or 'answers1' (depends on what the variable 'currentq' is.. In other words, it don't use the data it contains, but uses the name instead.. converts it to a string instead of a variable..

I have no idea what to do - Please help me

Thanks in advance

How Can I Use Variable Names In LoadMovie URL?
I am setting variables when buttons are pressed, which will load an external .swf. Normally I would use a lot of these:

loadMovie("history/image.swf", "/image_loader");

"history" is where I would like to use a variable name, how can I do this?

Textfield Variable Names
I have just finnished making a simple (I think) search engine in flash that searches an external text file, well not quite finnished. Anyways after a search has been completed, it duplicates the movie clip with dynamic text fields inside (by how many results), which display the results.

What I need to know is a way to change the textfield variable name as a new duplicate is made. Or in other words add + 1 to the end of the textfield variable name as a duplicate is made.

It's very hard to explain an example, so I will just show you my code.

dup = 0;
ymove = rmovie._y; // origanal movie (to be duplicated) y position
while (dup <= rnum) { // rnum is the number of results found
duplicateMovieClip("rmovie", "rmovie"+dup, dup);
setProperty("rmovie"+dup, _y, ymove);
dup = dup + 1;
ymove = ymove + 30;
}
stop();

Meanwhile I want the textfield containing the results variable name to be something like this, "result"+dup, but this does not work.
Anyways what I want is that the textfield variable name in the first moiveclip duplicated will be called result1, the second result2 and so on.

By the way, the movieclip duplicates fine, it's just getting the textfield variable NAME inside it to add 1 as a new duplicate is made.

If you have any ideas at all that may solve this problem, or if you know another way to acheive the same thing, Please Respond.

Thanks

Textfield Variable Names
I have just finnished making a simple (I think) search engine in flash that searches an external text file, well not quite finnished. Anyways after a search has been completed, it duplicates the movie clip with dynamic text fields inside (by how many results), which display the results.

What I need to know is a way to change the textfield variable name as a new duplicate is made. Or in other words add + 1 to the end of the textfield variable name as a duplicate is made.

It's very hard to explain an example, so I will just show you my code.

dup = 0;
ymove = rmovie._y; // origanal movie (to be duplicated) y position
while (dup <= rnum) { // rnum is the number of results found
duplicateMovieClip("rmovie", "rmovie"+dup, dup);
setProperty("rmovie"+dup, _y, ymove);
dup = dup + 1;
ymove = ymove + 30;
}
stop();

Meanwhile I want the textfield containing the results variable name to be something like this, "result"+dup, but this does not work.
Anyways what I want is that the textfield variable name in the first moiveclip duplicated will be called result1, the second result2 and so on.

By the way, the movieclip duplicates fine, it's just getting the textfield variable NAME inside it to add 1 as a new duplicate is made.

If you have any ideas at all that may solve this problem, or if you know another way to acheive the same thing, Please Respond.

Thanks

Dynamic Variable Names
Hello,

I can't remmeber for the life of me how to create dynamic variable names.

I have an if statement that I want the second part to be dynamic

if (eval(_root.button_1._droptarget) == _root.drop_1)

-----------------------------
So somewhere I set variables
var i = 2
var b = 3

and


if (eval(_root.button_1._droptarget) == _root.drop_1)
becomes:
if (eval(_root.button_1._droptarget) == _root.drop_i)

The 1 at the end is now variable as per the i in the second one.

Any thoughts?

Thanks.....Rob

Referencing Variable Names
Referencing variables

Hi I have some code that looks like this.

on (rollOver) {
setProperty("over", _visible, true);
}
on (release) {
// display appropriate fields
setProperty("../button" + n, _visible, false);
location = eval("link" + n);
i = eval("location");
trace(i);
_root.definition = location;
_root.term = linkname;
_root.example = eval("_root.exam");
_root.hint = eval("_root.hint");

}
on (releaseOutside, rollOut) {
setProperty("../button" add n, _visible, true);
setProperty("over", _visible, false);
}
</cite>
</html>
Okay, I want to assign variables to text boxes... This works for the first two types _root.definition _root.term .

THe problem is that when i try and do a simular method that is ussed for obtaining the location variable i.e make location the variable of variable "link" + the instance number "n"

it dosent work for anything else but the location variable.

So..

I want to know how do i find out, what location variable is set to (not the string in the variable the container name of location one) so I can extract the "n" part of the from the "link" part and then assign the n to a variable and add it to the other evauluated strings.

So basically how to i get the container name of a variable???

I am using flash mx, and this code is from a scrooling item list.

Need help quick


Ænertia

Dynamic Variable Names?
for (i=0; i<=numLots; i++) {
currentLot = "_root.vozi.L"+i;
if (("L"+i) == "sold") {
tellTarget (currentLot) {
gotoAndStop(2);
}
}
}


See what I am doing with this line:

if (("L"+i) == "sold") {

I need the loop to go through L1....L72 and check the value of all. All variable values are being passed in from an external file - so I think an array is out of the question. How do I dynamically update the variable name?

Variables In Variable Names & Url's?
Hi, a few things ive been wondering about the use of variables in a few instances...

---- Example 1 ----
Say i have a loop using "Count" as a looping variable, that adds '1' every time. And i have some other variables named "Item1, Item2 , Item3" ect... And for whatever reason, i want to use "Count" in the name of the other variables, "Item(Count)" to access "Item1" when "Count=1"

Another exaple of what i mean is like if i have "Colour = Red" and another variable named "BlahRed" and i want to access "BlahRed" but by using the "Colour" variable in "BlahRed"'s name.
Like "Blah(Colour)=whatever" where of course the "Colour = Red"

What is the correct syntax for that? And i'm not talking about using an array, I just used parenthesis here because i dontk now what you'd really use...

I don't know if it's possible, but there it is.

----Example 2 ----
I know this one is possible.

Say I want to use a variable in a URL like
GETurl(http.com/ "VARIABLE" .html) ect...
Where - VARIABLE = "index" - or something

What's the correct way to accomplish that?
----

Thanks, i hope i explained the first one well enough, it's a little complicated i know. Just ask me if you need clarification

Thanks.

Trouble With Variable Names
[reposted from the general board]

easy one this, but I can't quite seem to get it.

I have lots of variables...

var1_thing
var2_thing
var3_thing
etc...etc...

and I want to mess with 'em all in a loop....

for(i=1;i<10;i++)
{
["var" + i + "_thing"] = "chocolate";
}

but I can't seem to get the right syntax... can anyone tell me what I'm doing wrong? ta!

Using Variable Names In Arrays
Is it possible to make an array that contains variable names and display their value?

For example (not actual code):

array (VarName1, VarName2, VarName3)//VarName values are predefined in maintimeline//

for i = 0 to x //total number of variable names in array
get i
next i

OUTPUT:

VarName 1 = (Display Value)
VarName 2 = (etc...)

Hope that's not too confusing. Thanks for the help

Dynamic Variable Names
how in god's name do I concantenate a variable name from a string and an array index. Here's what I've been trying (this is actionscript, not PHP)...


PHP Code:



var dragNames=new Array(5);
dragNames[0]="Drag1";
dragNames[1]="Drag2";
dragNames[2]="Drag3";
dragNames[3]="Drag4";
dragNames[4]="Drag5";

var targetNames=new Array(5);
targetNames[0]="Target1";
targetNames[1]="Target2";
targetNames[2]="Target3";
targetNames[3]="Target4";
targetNames[4]="Target5";

var i=0;
var thename="";

for(i=0;i<dragNames.length;i++){
    var (eval("dragName" + i)) = dragNames[i];
}

for(i=0;i<targetNames.length;i++){
    var (eval("targetName" + i)) = targetNames[i];
}




I'm trying to end up with a bunch of variables named "dragName1, dragName2,...etc.
I've tried every variation on the above that I can think of and nothing works. This is soooo easy to do in PHP, but not in ECMA script. Please help!

Dyanmic Variable Names
Hi guys,

I've been playing with this for some time now with no luck. What I want to do is create many copies of a movie clip (manually) each which will have a different instance name (var1, var2, var3 etc). This will match up to a variable passed from PHP eg: var1=0&var2=1&var3=1

I would like to get the following code to work but where it says var1 have that replaced dynamically by the instance name. This way all I would have to do is create my copies of the movie clip and change the instance names instead of having to go into each one and edit the code.

onClipEvent (load) {
if (var1 eq "0") {
gotoAndStop(1);
}else{
gotoAndStop(2);
}
}

If someone can shed some light it would be greatly appreciated!

Thanks in advance
frost3r

Variable Names Of Loaded MCs ?-- Help Please
What is the variable name of the movies that you load?

I'm trying to make an "index" movie pre-load for each loaded movie, but I can't get the code: getBytesTotal and code: getBytesLoaded parts to work....

I load the movies like this:
code:
loadMovie(NewMovie,emptyMC);


And "NewMovie" is defined by what button you click.

HELP PLEASE!

VARIABLE Varible Names
I seem to be having undue difficulty with this... perhaps it's not possible...

My problem is that I have a number of variables (eg. Xvelocity or Status)which I have set up as object properties(Eg. Avatar.Xvelocity or Enemy.Status); My problem is that I would like to be able to have these objects name themselves according to whatever title I give the MovieClip which contains them.

To clarify: If I have a Library MovieClip called "EnemyHandler" whose first frame declares something to the effect of "Title = new Object();" followed by a number of "Title.Xvelocity = 5; Title.Rotation = 61", is there a way for me to take the variable "getProperty(this, _name)" and make that the object name?

In the end, if I have two instances of this "EnemyHandler" movieclip, one name "MCDude" and the other named "MCBaddie", how could I get them each to initilze their own set of variables/object names, eg:

MCDude.Xvelocity =5;
MCBaddie.Xvelocity =5;

I'm really stuck on this.

Expression For Variable Names?
Hello,

I'm using flash mx 2004 and stumbling on something that I used to do all the time with flash 4 and 5: Having an expression for the name of a variable.

I've got this code in a loop:


Code:
this["_root.list_item_" + i + "_height"] = eval ("_root.list_item_" + (i - 1) + "_height");


I'm trying to simply asign the value of list_item_2_height to list_item_3_height. And it does not work. I've tried using _root["list_item_" + i + "_height"] instead, but with no luck. Of course the old flash 4/5 syntax does not work. I've searched the web but am coming up empty handed.

I should mention that _height is part of the variable name, not the property _height.

Can anyone help me??

Thanks!
Cooper
www.pigdogtoad.com

Variables As Variable Names
Hi

I'm duplicating a movie clip like this:

cliplevel ++;
clipname = "clip" + cliplevel;
duplicateMovieClip(car, clipname, cliplevel);


And I want to access a variable inside the clip called myid like this:
clipname.myid = cliplevel;

where clipname is a variable with value = clip24 for example.

Alternatively I need a clip to be able to find out what it's instance name is.

I hope it's reasonably clear what I'm getting at.

Get All Variable Names Inside *.as?
Hey,
I was wondering if it's possible to put all variable names imported from an *.as file inside an array (as strings)?

Example:
code:
//--Code in *.as file---
var someString = "dasdasd";
var anotherVar = ["asd","asd","gads"];
var geehAnotherOne = 6;

//--Generated array should then be---
var generated = ["someString","anotherVar","geehAnotherOne"];


Thnx,
SaphuA

Changing The Variable Names
Hiya everybody!

Does anybody know how to change the variable name of a dynamic text box by the click of a button.

So If I click on buttonOne - the variable name on the dynamic text box changes to "buttonOne".

If I click on buttonTwo - the variable name on the dynamic text box changes to "buttonTwo".

All help much apprecitated

Deadhands

Dynamic Variable Names
What's the correct syntax for this?

i = 1;
id_1 = 25;
curid = id_[i];

In other words, so that the variable curid will be 25.

Checking Variable Names
I have a set of cuePoints and I want to trigger an action on only the cuePoints who's name begins with the two letters 'ss'. How can I perform a check like this on any data? And where can I look in the help file to find more information on it?

thanks
mark

Trouble With Variable Names :-(
hi guys,

Im having a real problem with this...

I've got 60 variables passed from a PHP page, called:

V1, V2, V3, V4, V5 etc.

And i need to pass them into a loop, so i tried this:

while(i < 60){
CurV = ["V" + i]
trace CurV
i = i +1
}

But this doesnt work Instead of getting the value of the V's i.e V1 = Bob, V2 = Kev
Its outputting the actual V's --- V1, V2, V3

If someone could please help, that would be great

Thanks.

Variable Instance Names
In a menu header I'm making for a site, I want it to import a text file that has each menu item and link URL, then create MC buttons for each of them and distribute them evenly across a certain y value with certain endpoints.

Anyway, I'm getting started on the code to read the text file and create the MC's. To save myself the hassle, I will put the number of links as the first var in the imported text file. I make a for statement, counting up from 1 until it has reached the total number of links, and want to make an MC for each one. So, I createBlankMovieClip, using "linkname_"+i to create it using the current iteration of the for statement. However, how do I call that to add a text field to it?

linkname_+i.createTextField() doesn't seem to work.

Looping Variable Names
Hello,

I'm loading a text file into my swf and it contains quite a few variables with names that are in sequence. (Sort of the way a grid or table would be setup).

So as they are imported, I wanted to create a loop that would convert them into arrays. Here's what I've tried...


Code:
for(i=0;i<10;i++){
for(j=0;j<10;j++){
this["C" add i add "R" add j] = this["C" add i add "R" add j].split(",");
}
}
So what should happen is it would pull variable C0R0 as a string, and then convert it into an array of the same name. Then it would pull variable C0R1 and do the same thing, etc...

The part to the right of the "=" seems to be correct, but the part to the left is not. Does anyone know what I'm doing wrong? Or is there a better way of accomplishing what I'm trying to do?

Thanks

Assigning Variable Names Using AS
I'm using Flash 8.

Is there a way to assign a variable name to a text field created using AS.

ie. Is "my_email" the assigned variable name in the string "this.createTextField("my_email", this.getNextHighestDepth(), -80, 48, 160, 15);?

It's easily done without AS, but I prefer the formatting advantages of AS.

gmcalli

Concat, But For Variable Names?
Hi,

I'm pretty much trying to find the highest number by using Math.Max to compare each set in a loop. I think my syntax is wrong for updating the variables through the loop, like so ...


Code:
//Find highs

numberOfSectors = 5;
newHigh = 0;

sales1=408;
sales2=469;
sales3=244;
sales4=13;
sales5=1023;

for(i=0;i<numberOfSectors;i++){
newHigh = Math.max(sales[i], newHigh);
trace(newHigh);
}
"newHigh" comes back Nan.

How do I get my sales increments to go up while in the loop? Of maybe there's a better way?

Thanks,
Layne

Variable Instance Names?
Hi. Can I address a movie clip with a variable?

For example I want to use a variable called "counter" to be used when addressing a movie clip


The movie clips instance names will be in the properties panel
Entry1
Entry2
Entry3

Can i address "Entry" + the counter variable in some way to end up addressing Entry1, 2, or 3

For Loops With Variable Names
im sure iv done this before but cant remember how

i have a shared object with 25 pieces of data but for now ill just use 4 cell1, cell2, cell3 cell4.

initially each cell will have the same value (ie false) rather than hardcoding each cells content i want to use a for loop to enter the values.

something like this

for (i=0; i>3; i++) {
so.data.cell1 = false;
}

how do use the 'i' value to increase the cell number each time it loops. i thought something like
so.data.cell+i
but as soon as i did it i realised it wouldnt work and why.

please help

Dynamic Variable Names?
ready to shoot myself in the face..... this should be simple...
why does this not work??
I'm trying to write a function to control several different movie clips on the stage ... there is a movie on the stage called 'prv_vancouver' that should play when moused over, but for some reason the 'province.play();' is seeing 'province' as a string and not an instance name... ! arrghh help!


function mouseout(prov) {
var province = ("prv_" + prov);
province.play();
}



btn_vancouver.addEventListener(MouseEvent.MOUSE_OU T,
function button(){
mouseout('vancouver');
}
);

Copyright © 2005-08 www.BigResource.com, All rights reserved