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!
FlashKit > Flash Help > Flash ActionScript
Posted on: 03-19-2002, 02:24 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Referencing MovieClip Properties From An Array
Code:
container_mc = _root.createEmptyMovieClip ("Page_Container_mc",100);
pageContent = new Array ();
for (var p=0; p<5 ; p++) {
pageContent[p] = container_mc.attachMovie ("Page Content "+p, "page_content"+p, 1000+p*100); // "Page Content 1"... are linked from library
pageContent[p]._y = 300; // won't work because ???
}
Hi all,
As you can see from the above code, I'm trying to create a set of MovieClips and save a reference to each in an Array so I can easily access them and their props/methods.
I must be having a brain-lapse because I can't get this to work. Any ideas on this or a better approach?
Any help is greatly appreciated. Cheers.
Referencing A Random MovieClip From An Array
I know this has to be simple, but I can't solve the problem. I'm trying to call a random MovieClip from the library each time the user clicks. The MovieClip names are stored in the array. I can get a single clip to work without the array, but not with. The main problem lies, I think, in trying to apply randomStar to currStar.
The tutorial this code references is http://www.kirupa.com/developer/flas...ps_AS3_pg1.htm
Quick help? Thanks much in advance.
Code:
function Main() {
stage.addEventListener(MouseEvent.CLICK, AddStar);
}
Main();
var starArray:Array = new Array("star01", "star02", "star03", "star04", "star05");
var randomStar = starArray[Math.random() * starArray.length];
function AddStar(e:MouseEvent):void {
var currStar = new randomStar();
this.addChild(currStar);
currStar.x = mouseX;
currStar.y = mouseY;
currStar.addEventListener(Event.ENTER_FRAME, PlayStar);
}
function PlayStar(e:Event):void {
var starMC:MovieClip = MovieClip(e.target);
}
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.
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
Referencing Array Items With An Id Pulled From The Array
I have been modifying one of the Kirupa tutorials about loading external xml data and arrays. I have it successfully working, but i would like to figure out how to take it one step further. I want to be able to designate a each item in the arrays with an id rather than an iterative variable number and cannot figure out how to do it.
This is a snippet from the xml file:
<projects>
<item>
<id>13</id>
<projectname>First Project</projectname>
<location>Anytown, USA</location>
<units>60</units>
</item>
<item>
<id>33</id>
<projectname>Second Project</projectname>
<location>Sometown, USA</location>
<units>132</units>
</item>
</projects>
I am currently populating an array this way:
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
id[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
projectname[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
plocation[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
units[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
but that just gives me references to: projectname1, projectname2 etc.
I would like to figure out how to get the <id> value from the loaded xml file connected to the variable name of each item in the array so that i can refer to the variables this way: projectname13, projectname33, etc.
Does this make sense? Can anyone help?
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
[CS3] Referencing A Movieclip Inside A Movieclip From A Class File
Hello All,
I'm trying to access a movieclip inside another movie clip from a class file that is not attached to either movieclip. For instance, I'm checking hitTests for the avatar the player uses on the game, there are two enemy movieclips. Inside each enemy movieclip is another movie clip that serves as a bounding box (specifically around the mouth of the enemy so it can eat the player). Here is what I have so far that isnt working:
Code:
if (_root['otter']['obbox'].hitTest(this) && touch == false) {
trace("Otter touched Urchin");
gotoAndPlay("hit");
_root['otter'].gotoAndPlay("eat");
touch = true;
}
The class file is for the avatar. On the stage is the otter mc and inside the otter mc is another mc called obbox which is what I'm trying to hitTest against. Needless to say, it doesn't hitTest or trace or play the animation. Is there a way to reference a nested mc? Thanks in advance.
Terror.
? 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?
Removing An Element From The Middle Of An Array
does anyone have any tips on removing an element from the middle of an array?
MyArray[a,b,c,d,e,f]
and I want to remove c from MyArray so afterwards I would have:
MyArray[a,b,d,e,f]
any thoughts? thanks in advance
:yikes: Delete Array Element?
a=new Array();
a[0]="funky";
a[1]="honky";
a[2]="bonky";
function killEmAll() {
var j=a.length;
while(j--) {
delete a[j];
}
trace(a.length);
}
killEmAll();
way this trace outputs 3 and not 0?
this delete seems to be not applayable to array-elements or what?
i need this a array globaly, in my fns i wont to delete everything what was inside an put my new values?
anybody have an idea?
|