Accessing Last Element Of Array Dynamically?
Afternoon people, Well, I;ve been bashing my face against this code now and still can;t get it to work.
I have been using Code: myArray[myArray.length] = blah+i to successfully add values to an array.
Now it's come to retrieving the last element and.. the same notation seems to give me "undefined".. which is obviously hilarious. I could use some horrendous pop-> put back in array, keep copy for usage. But that seems frankly arse-about-face.
Tried
Code: myArray["[myArray.length]"] and myArray[[myArray.length]] and var foo = myArray.length trace(myArray[foo]) It looks like trace(this["myArray["+myArray.length"]") which would work if the array was publcly accessible but changing it to public just to get that to work is beyond my Occam's razor. Must be a simpler explanation? Anyone care to enlighten me?
*sobs*
KirupaForum > Flash > ActionScript 3.0
Posted on: 09-08-2007, 10:44 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
(CS3) Accessing An Array Dynamically
Hi, Thanks ahead for any help. I'm learning so please put up with my stupid questions.
Basically I've got a load of Arrays, and i do a function called LoadImageArray, passing in the array, and it's name as a string. a function will run, and inside there i want to update the array. I don't know what the array name will be, so how do i change the array using the "thisName" argument? (which has the array name inside)
Just saying thisName[i] etc... is referencing the argument (I think they're called arguments?) and I don't know how to make it reference the Array of the same name.
Code:
var imageArray0:Array = [];
LoadImageArray(imageArray0, "imageArray0")
Code:
function LoadImageArray(thisArray:Array, thisName:String) :void {
//Unimportant Stuff Cut Out
//Below function will run...
function onAllLoaded(done:Event) :void {
//Unimportant Stuff Cut Out
//Here I want to access the Array (for this example it is imageArray0) that has been passed in under the argument "thisName".
}
}
}
Thanks for any help
Dynamically Accessing Array Variables
Here's my problem:
I am loading the variables for a page into an array. A couple of timelines into my movie I have a handy function to access one of those variables based on what number I feed the parameter of the function:
function image_display (i) {
caption = eval ("../../:page [../../:page_current].image_"+i+"_caption");
}
The idea is that I send this function "1" as a parameter and it will give me the value for "page [page_current].image_1_caption", which is on the root timeline (I like relative as opposed to absolute references, but it shouldn't make a difference either way).
The problem is that I cannot get this to come up with anything but "undefined". If I hardcode this without the "eval" statement and replacing the "i" with "1" it works fine, which says to me that I need to construct the variable I want to get differently, but I don't know how to do that.
Any thoughts?
Dynamically Accessing An Object Array
I am just full of quesitons today.
How can i access an object array's length
if...
data.area01=name1;
data.area02=name2;
data.area03=name3;
data.area04=name4;
just for clarification the array goes deeper...
data.area01.urllink="www.etc.com";
data.area01.urllink2="www.blog.com";
data.area01.publication01="blahblah";
------------------------------
I just want to find the length of data
but if i do ntotal=data.length i get undefined.
It sure would've been a lot easier if the areas weren't labelled with numbers appended to their ends. Then I can use a for...in loop
Array Text Into Textfield And Creating New Line For Each Array Element
I have an array called dropTarg1 which stores dropped-in items.
I want to loop through this array and in a textfield, display each array item on a new line of this text field
I think I need to use something like Array.join("/n") but I can't get it working properly. I hope that the /n would create a new line of the text field called reviewBoxContentText.
for(var i:Number = 0; i<dropTarg.length; i++){
with(reviewBoxContent.reviewBoxContentText){
autoSize = true;
text = dropTarg1.join("/n");
}
}
All that is happening though is that the text field displays on a single line with /n in between each array element.
[F8] Finding A Dynamically Created Element
If I dynamically create an element, and after its created add a listener to it, how would I grab that element?
For instance, say I create a button
var btn = new Button();
btn.text = "Click Me";
parent_element.addChild(btn);
Now that I've created an placed it, I want to add a listener, do I just do
btn.addEventListener, or do I need to alias it first?
Can't Add Dynamic Text Element Dynamically
I have a bunch of images loaded into my movie from external URLs. They sit nicely next to each other.
Now I'm trying to overlay some custom text on each one, but I can't get it to show up.
I created a movie clip in my library and placed a dynamic text field at the center. I named this dynamic text field, "captionField" and centered it and exported the symbol for actionscript as "captionHolder"
Once my clips are done loading, I use attachMovie("captionHolder", "newCaption1", ....) to overlay the caption field. Then I set the value of newCaption1 to "Hello World" but it doesn't show up.
Even if I set the default value of the dynamic text field (I manually type in the value to start inside Flash) it doesn't show up. But if I change the type of the text field to "Static Text," then the default shows up perfectly on top of the image.
I've also tried createTextField but couldn't get anything to show up. Any ideas?
Dynamically Change The Height Of An Element
Hi there,
I have an animated graph in flash and I would like to set the values (heights of the bars) using data imported via an XML file.
I can successfully import the data, but I have no idea how I change the height of the bars!
Can anyone point me in the right direction?
Thanks in advance!
Andy
ARRAY Element Value - Not Array Index Value
Hi all -
Have a small problem converting the below variables from PHP into a useful Ascript Array. I keep getting the value of the array index, rather than the value of the variable in question.
So I know I have 3 rows in my database (totalRows var),
and I have a incremental values for the "recordId"'s (which correspond to the record ID in the db).
totalRows = 3
recordId0 = 1
recordId1 = 5
recordId2 = 6
this is the code I am using:
Code:
function extractMenu() {
//returned vars (FYI): totalRows=3&recordId2=6&recordId1=5&recordId0=1&result=okay&
this.menuArray = new Array();
with (menuLoad) { //menuLoad is the LoadVars object holding PHP vars.
for (i=0; i<=totalRows-1; i++) {
menuArray[i] = recordId + i;
trace(menuArray[i]);
//the trace returns:
//0
//1
//2
//I was expecting the values:
//1
//5
//6
}
}
any takers?
Test If Array's Element Is An Array.
I'm recursively looking through an Array, and I'm looking for a solid way to test if an element is actually an Array(there is a chance that the tested array element is another datatype). I was thinking that I could use the length property to test, however looking in the index of ASDG2 I see that there are a few other Objects that possess the a length property, and I am afraid that this might cause a problem.
look at
nav_array[i].length >= 1
below
Is there a way to use typeof on an Array, and have it return anything other than Object?
Code:
private function recurseThroughArray(nav_array, itemsArray, depthHolder){
for(var i=0;i<nav_array.length;i++){
depthHolder.push(i);
if(nav_array[i] == itemsArray){
var returnDepth:Array = depthHolder;
break;
}else{
if(nav_array[i].length >= 1){ //make sure that this is an Array
recurseThroughArray(nav_array[i], itemsArray, depthHolder);
}else{
depthHolder.splice(depthHolder.length-1,1);
}
}
}
return returnDepth;
}
also, I'm new to recursion, and I haven't tested this yet.
Element In Array
Can anybody tell me if there is a built in array function in Actionscript which returns true if a value is an element of the array, and false otherwise, or do I have to write my own by comparing each element?
Thanks
Array Element
hi everyone,
can anyone help me?? how can i remove the first element of an array and then put him in a var??
thanks Catarina
Get Next Element In Array
Hello ,
I have dynamically created array image gallery ...when I rollover one image I want it to enlarge and shift neighbouring images aside...
What I need to know is : when I rollover particular mc with image how to list mcs with indexes lower in that array and with higher index number in that array ?
Code:
_root[myArray[i]].onRollOver = function (){
this._xscale +=10
this._yscale +=10
}
Now I need to get the mcs with lower index and higher index than that one mcs that was rolled over
Anybody ??
Thanx
Set Vars To Array Element
I need to on the first frame:
1)declare a newarray called myArray
2)with a for loop set elem0 - elem9 to = its corresponding array element
ex. elem0 = myArray[0]
so wrote the following code but it doesnt work
--------------------------------------------------------
var myArray = new Array();
for (var i = 0; i<=9; i++) {
var "elem"+i = myArray[i];
}
--------------------------------------------------------
what am i doing wrong. I know it has to do with the way im trying to dynamically create each variable
Remove Element From Array
How can I remove elements from the following array?
myArray=[0,1,2,3,"",5,6,"",8]
In my case, I'm speciffically interested in removing the empty strings "".
Thanx, Smash
Referring To The Last Element Of An Array
I want to refer to the last Element of an Array
Is there another syntax then:
existingCells[existingCells.length-1]
Like a special word:
existingCells[last]
Or something...
Delete Element From Array
Hi there
I am have loads to trouble deleting elements from an array
what I am trying to do is make a shopping cart in flash
using arrays when the user click on an item it pushing the
product variable into an array but the problem is when
the user need to delete the product from the array.
I have tried using the pop (); function but that just
Deletes the last element from the array and what I
Really need is to delete the element at relates to the
Product that the user want to delete.
Any ideas
any help on this would be GREAT
Thanks
Mac-10
Delete A Particular Element From An Array
Hi All,
I have an array of 17 elements all numbers from 1-17 stroed in it.
I am generating a random number and want that particular number to be deleted from the array
Thanks in Advance
Warm Regards
Deepak Lohumi
Remove Array Element
Does anybody know how to remove elments from an Array that have the same value. For instance i have :
myArray(1,2,3,4,undefined,undefined,undefined,8,9, 10)
How do i remove all elements that have UNDEFINED value and decrease myArray length from 10 to 7 ? Thanks
Removing An Element Of An Array
Hello everybody!
Is there a way to remove an element of an array by its name?
I can remove elements with the splice method, but it works with the index.
Thanxs in advance
Comma In An Array Element?
Hi,
I am using LoadVars to bring in array items, delimited by commas. Unfortunately it is required that some array elements include the character "," but not as a delimiter [example: "I need to add commas like this, thanks."]. We tried using the %2C escape sequence but this does not work in IE [no idea why, but it instead adds a line break], is there any other way to display a comma in an array like this? Thanks a lot for any help,
Jeremy
Programming Art
PS. I am using Flash MX
Get Random Element From Array
apologies for this easy question but I'm new to actionscript and flash!
I have an array with a list of things, and I simply want to pick out a random element from the array. How can I do this?
I was trying to solve this by having a random number, multiply by 10, then have a function to call to check whether it is greater than the count of the elements in the array, but this seems long-winded and it didn't work anyway!!!!
Thanks.
Array Element Names
Hello gurus
Stuck on what seems a simplish question and cannot find the info anywhere.
I want to call an array element by name and clear it totally from the array.
I know that if you use delete on an array, it only clears the value.
I read somewhere that if you name the elements, you can then use delete to clear the value and its container.
q1/ Does naming the elements make it an associative array?
q2/ If this is so, and I cannot use the length method, is there some other way of getting the length?
q3/ Any better ways of doing this that the way I am going about it.
Have looked at Objects and deleting but again, cant get length.
Thanks if you can help out. I am just diving in to actionscript and haven't had that AHA! moment yet.
..
cz
[Help] Deleting An Array Element
Ok I created a function to delete an element of an array which looks like:
Code:
function deleteD(index,array){
newArray =[];
if (index == 0){
}
else{
newArray = array.slice(0,index);
}
if(index >= array.length-1){
}
else{
newArray.push(array.slice(index+1,array.length));
}
return (newArray);
}
But for some reason it doesn't work properly. For example:
Code:
testArray = [['a',0],['c',1],['e',2],['g',3],['i',4]]; //an array with some random elements.
testArray = deleteD(1,testArray);//Should delete element 1: ['c',1]
trace(testArray) // traces a,0,e,2,g,3,i,4 like it should
trace(testArray.length) //traces 2, when the length should be 4
trace(testArray[1]) // traces the second element which should be ['e',2] as e,2,g,3,i,4
I attached the .fla so you could see it, and any help would be great. I've been pulling my hair out over this...
Delete An Element On Array?
Hello,
direct to the point. my problem is, i have an array and want to delete an element, lets say "my_Array[4]" from it. the thing is i can erase the variables, but that leaves an empty space en "my_Array".
how can i move all the records of "my_Array" to fill the blank space?
after i delete the element i got this (and i dont need it that way):
my_Array = [dog, cat, plane, train, undefined, house]; (this is a geek example).
please help.
Array Element Visibility
Describes the mood or content of the topic posted 03-19-06 09:27 PM
Hi, I have a script problem in Flash not sure it can be easily solved.
I am a casual Flash user and not sure if there is a easy solution to this:
I have and array of elements from which one of them is retrieve randomly, and then stored in the variable selectedElement
myElements = new Array("beerBelt", "bottleBelt", "canBelt", "chipBelt");
function randomAll() {
_global.randomNumber = Math.round(Math.random()*(myElements.length-1));
_global.selectedElement = myElements[randomNumber];
};
Inside a MC in the same scene I have a series of MCs with the instance name exactly the same names as the variable elements, they are invisible from the first frame,
beerBelt._visible = false;
bottleBelt._visible = false;
canBelt._visible = false;
chipBelt._visible = false;
then an action frame appears to make the selected MC visible,
selectedElement._visible = true;
selectedElement.gotoAndPlay(_currentframe + 1);
stop();
for any reason (my lack of knowledge sure is the one to blame) I cannot make that element visible, I tried everything I know.
Could you please advice me what is the best way to aproach this problem?
Is it really possible to use variables values (in this case strings) to modify a element property?
Am I missing something?
Please any comment would be really welcome....
Attaching MC To Element Of Array
I want to plcae a movie clip in somthing like an inventory, so it will show a movie clip of the element of the array if it is there.
-----------------------------|
|
[$] <- icon_MC [#]<-amount|
|<---(inventory screen)
|
------------------------------
Inventory [0]= gold;
and how do I set the value of that element. Say 500gold?
Array Element Exists?
How do I check if an element in an array exists?
I'm looking for something along the lines of this, but don't know the proper syntax:
ActionScript Code:
if(array[5].exists()) {
// Do something.
}
else {
// Do something else.
}
Keep Adding Element To Array
Hello,
I'm trying to extract the data out from the array and put them into a new array consisted of name, x location, and y location. Somehow I can't keep adding them, the result of the new array will show only 1 element. can somebody help please?
thanks
ActionScript Code:
function doDub1(){
var myLV:LoadVars = new LoadVars();
myLV.onData = function(src:String) {
var words = (src.split(" "));
//trace(words);
_global.wordArray = new Array();
wordArray = src.split(" ");
_global.n = wordArray.length;
trace("Output Data = ");
for (i = 0 ; i < wordArray.length ; i++){
trace(" wordArray[" + i + "] = " + wordArray[i]);
}
for (i=0; i<wordArray.length; i++) {
_global.mc = attachMovie("Word", "noun"+i, 100+i, {msg:wordArray[i], _x:mc._width*i, _y:mc._height*i});
//mc.oldname = mc._name;
//mc.oldX = mc._x;
//mc.oldY = mc._y;
//trace("mc.oldname = " + mc.oldname);
//trace("mc._x = " + mc._x);
//trace("mc._y = " + mc._y);
xLoc = getProperty ("noun"+i, _x);
yLoc = getProperty ("noun"+i, _y);
trace(xLoc);
var abc:Array = new Array()
abc.push(["noun"+i, xLoc]);
trace(abc.length);
if(wordArray[i].length > 4 && wordArray[i].length <= 9){
mc._xscale = mc._xscale * 2;
}else if(wordArray[i].length >= 10){
mc._xscale = mc._xscale * 2.3;
}else{
mc._xscale = mc._xscale;
}
}
}
myLV.load("nounsFile.txt");
tempLabel = "Nouns";
}
Delete Array Element By Value?
Is it possible to delete an array element by value rather than position?
I need to do something like:
Code:
my_array.splice("value",1);
Which doesn't work.
Is there a way to do this?
Cheers,
Jr.
Save Array Element
Is it possible to save an element of the array to a txt file? or do I have to create a new array to hold that value then save it? Please note that I only have one variable that when the mouse is over the movie clips it will show the element of array on to that variable.
Array Element Not Being Defined
Hey
It's late here and i'm tired, so it could just be that, but i can't work out why this isn't working:
ActionScript Code:
trace ("index" + index)
_root.SavedSO.data.Inventory[index][0] = getable[i];
_root.SavedSO.data.Inventory[index][1] = _root.SavedSO.data["room"+x+","+y+","+z].getinfo.split("*")[i];
trace(_root.SavedSO.data.Inventory[0][0])
index is 0, as it should be, yet the trace at the end returns undefined. However, if i remove one of the array elements it works... Does anyone know why this would be, or how to fix it?
Swapping Element In An Array
Hi all,
Can someone tell em what I'm doing wrong here? I basically want to swap the order of two elements in the array. The splice command works fine with only a single field in the array eg bob.push("aaa") but I get undefined when using multiple elements in the Array...help!?
bob = new Array()
bob.push({name:"aaa",age:1})
bob.push({name:"bbb",age:2})
bob.push({name:"ccc",age:3})
bob.push({name:"ddd",age:4})
bob.push({name:"eee",age:5})
bob.splice(1,0,bob.splice(2,1))
trace(bob[0].name) // gives aaa
trace(bob[1].name) // gives undefined
trace(bob[2].name) // gives bbb
trace(bob[3].name) // gives ddd
trace(bob[4].name) // gives eee
Position Of An Element In An Array
Hello,
Is there a method to get the position of an element in an array?
if I have an Array like this
myArray=[apple,pears,orange,banana];
when I ask for "apple" I would like to have 0 returned (its position in the array)
when I ask "banana", it will return 3
Thanks
Henri
Array And Deleted Element
Hi,
I have a Form with 6 input Text fields.
Now the Submit button should find out, if all Text fields are defined.
The Array is updated on enter text with >splice< like
var a:Number = 0;//
while(a<6){
this["formTF"+a].onChanged = function(txt){
var theText = txt.text;
var theNo:Number = this.avar;
theSubmit_array.splice(theNo,1,theText);
};
a++;
}
All works fine, I have an array like this > AA,BB,CC,DD,EE,FF <
But, when the TF is left empty or previous entered Text is deleted, lets say TF no.2, then
my Array looks like >> AA,,CC,DD,EE,FF < so… BB is gone and I have an empty space.
How can the Submit button read, that the TF no 2 is empty???
I have tried so many things during 2 days, but found no solution.
For ex. looping through the array like:
for(var x:Number=0,x<theSubmit_array.length;x++)
var checkStr = theSubmit_array[x];
if(checkStr == ""){
//play error
}
}
// but does not work.
Can anyone help me please??
Thanks.
Remove Element From Array ?
hi
How can i remove the element from array in actionscript?
i have this array:
myArray = new Array ("1","2", "3", "4", "5");
i want to remove the element "3" when i press button.
Remove Element From Array
Hello kirupers,
i am trying to remove elements form an array.
the array is kind of special: content depends on what you have clicked or not:
see some code:
pArr = [];
for(var i =0;i<max;i++){
johndoe[i].pressed = false;
johndoe[i].onPress = function(){
this.pressed = !this.pressed;
if(this.pressed){
pArr.push(this.obj)
}else{
pArr.remove(this.obj);
}
}
}
of course the remove function is my pb, not done yet.
i have tested some proto on it, but cannot figure it properly.
How can i remove the same object from the array, knowing that the array can contain several times the same object, so i do not want to delete it many times but just the good one ? so the trick is to remove only the object associated with the johndoe button.
maybe the pb comes from the way i push the elements ?
thx for your reading so far, hope this is an understanding problem.
tofu.
Deleting A Element In Array.
var my_arr:Array =['das',2,jack',4,5];
i need to delete the element by refering thier index number.....
like this my_arr.remove(3);
how can be this done....
Help-instance Name->array Element,array Element->instance Name
help. I need help!
i got a problem here, i have some movie clip on the stage, and when i click on it, it will save one variable, _global.array1=new Array("a");
a is the instance name, which other function will use this element on other button.
But when i click on other button, how it can link this element to trigger the instance?
thanks!
(i'm using Mx2004.)
Remove An Element From Array
I have created a bit of AS that attaches library images from an array 1 at a time, but i am having difficulty remove the element/images once it has been displayed from the array and stage.
output
Entry lunchbox(12)
Array No:12 was removed
Entry toydoll(20)
Array No:20 was removed
Entry newspaper(14)
Array No:14 was removed
Entry pictureframe(17)
Array No:17 was removed
Entry fork(7)
Array No:7 was removed
Entry jug(9)
Array No:9 was removed
Entry key(10)
Array No:10 was removed
Entry pan(15)
Array No:15 was removed
Entry spoon(18)
Array No:18 was removed
Entry trophy(21)
Array No:21 was removed
//should not have been deisplayed again
Entry fork(7)
Array No:7 was removed
Entry chair(3)
Array No:3 was removed
//should not have been deisplayed again
Entry fork(7)
Array No:7 was removed
been going round in circles with this.
heres my code so far
Code:
var picArray:Array = new Array();
picArray[0] = "bottle";
picArray[1] = "bucket";
picArray[2] = "carrierbag";
picArray[3] = "chair";
picArray[4] = "coat";
picArray[5] = "cushion";
picArray[6] = "envelope";
picArray[7] = "fork";
picArray[8] = "hat";
picArray[9] = "jug";
picArray[10] = "key";
picArray[11] = "kitchenroll";
picArray[12] = "lunchbox";
picArray[13] = "mirror";
picArray[14] = "newspaper";
picArray[15] = "pan";
picArray[16] = "phonebook";
picArray[17] = "pictureframe";
picArray[18] = "spoon";
picArray[19] = "toyboat";
picArray[20] = "toydoll";
picArray[21] = "trophy";
picArray[22] = "trouser";
picArray[23] = "vase";
var depths:Number = -1;
var rndNum:Number = olddepth;
function attachPic()
{
rndNum = Math.floor(Math.random() * picArray.length);
_root.blank1.attachMovie(picArray[rndNum], picArray[rndNum] + "Clip", depths++);
return ("Entry " + picArray[rndNum] + "(" + rndNum + ")");
}
trace(attachPic("picArray: ", +picArray[rndNum]));
function picRemove(toRemove:String)
{
for (var i:Number = 0; i < picArray.length; i++)
{
if (picArray[i] == toRemove)
{
_root[picArray[i] + "Clip"].removeMovieClip();
picArray.splice(i, 1);
return ("Array No:" + i + " was removed");
}
}
return ("Failed to remove an entry.");
}
trace(picRemove(picArray[rndNum]));
//trace(picArray);
How To Access This Array Element
Here's the function :
Code:
var curItem;
function disableAll(){
for (var i=0;i<buttonArray.length;i++){
trace(buttonArray[i])
}
}
Here's the problem/question :
- I want to assign the var curItem into the onRelease function throughout the buttonArray. How?
Remove Element From Array ?
hi
How can i remove the element from array in actionscript?
i have this array:
myArray = new Array ("1","2", "3", "4", "5");
i want to remove the element "3" when i press button.
Remove Element From Array
Hello kirupers,
i am trying to remove elements form an array.
the array is kind of special: content depends on what you have clicked or not:
see some code:
pArr = [];
for(var i =0;i<max;i++){
johndoe[i].pressed = false;
johndoe[i].onPress = function(){
this.pressed = !this.pressed;
if(this.pressed){
pArr.push(this.obj)
}else{
pArr.remove(this.obj);
}
}
}
of course the remove function is my pb, not done yet.
i have tested some proto on it, but cannot figure it properly.
How can i remove the same object from the array, knowing that the array can contain several times the same object, so i do not want to delete it many times but just the good one ? so the trick is to remove only the object associated with the johndoe button.
maybe the pb comes from the way i push the elements ?
thx for your reading so far, hope this is an understanding problem.
tofu.
Remove Array Element?
I wrote my own event addListener and removeListener. Everything works except I can't remove the single event listener:
CODE_global.port.__proto__.removeListener = function ( listener:Object ) : Void
{
// Loop through keys.
for ( var key in listener )
{
// Is event?
if ( typeof( this.listeners[ key ] ) == "object" )
{
// Loop through sub array.
for ( var idx = 0; idx < this.listeners[ key ].length; idx++ )
{
// Match?
if ( this.listeners[ key ][ idx ] == listener[ key ] )
{
// Remove listener.
// What do I do here?
}
}
}
}
}
Delete Element From Array
Hi there
I am have loads to trouble deleting elements from an array
what I am trying to do is make a shopping cart in flash
using arrays when the user click on an item it pushing the
product variable into an array but the problem is when
the user need to delete the product from the array.
I have tried using the pop (); function but that just
Deletes the last element from the array and what I
Really need is to delete the element at relates to the
Product that the user want to delete.
Any ideas
any help on this would be GREAT
Thanks
Mac-10
? Operate On A Single Array Element ?
I'd like to change a single array element, as in:
//----
raSample = [36,24,36];
raSample[0] = 48
raSample[2]++;
//-----------
Do I have to redefine the whole dang array every time?
Thanks,
Addressing Variable Value To Array Element
I am trying to assign the values of variables read from an external variable file to an array.
One way or another I really need to figure out how to do this-
I have been trying a routine similar to the following, however I can't get the array element to accept the expression as a value.
varArray = new Array();
LoadVariablesNum("vars.txt", 0);
// lets say that the txt stores the var "X"
set( varArray[0], X );
what is incorrect about this assignment?
Referencing A Movieclip From An Array Element...
Hi,
I'm trying to check the current frame of a movie clip based on the content of an array element. I've tried a couple of methods but they don't seem to work.
I tried this
if (array[i]._currentframe == 3 ){}
and..
if (String(array[i])._currentframe == 3 ){}
Anyone know how I can do this?
I'm getting desperate, I need it for tomorrow...please help!
|