Finding The Index Number In An Array
Hi there - not sure if this is a tricky one, but hopefully someone can help.
I have an array with a list of ten scores in. I have an object called "details" with a variable attached called "score". I know that details.score is in the array because I just put it in there and had the array sorted using .sort) with a function in the braces to sort numerically rather than by ascii.
Now I want to find out the index number of that score. The reason is that details also has another variable, Name. I also have another array with a list of names in of Top Ten scorers. If a player gets a top ten score, his/her score is put into the score array and sorted. So now I have to find out the position of the new score so that the players name is placed in the same index in Top Ten scorers array.
The reason for all this is that I have a Score board screen where the two arrays are looped through with a For and obviously the two, score and name, have to match.
Now I know I am probably doing this inefficiently and yes I will be exploring later better methods to handle this, but I am new in the area of multiple arrays; so any help would be gratefully received!
cheers
frank
FlashKit > Flash Help > Flash ActionScript
Posted on: 11-20-2003, 07:50 AM
View Complete Forum Thread with Replies
Sponsored Links:
Finding An Index In An MC Array
FP v. 7. AS v. 2.0
_____________________
I have 10 MCs called "button0", "button1", "button2", etc. inside an MC called buttonsHolder.
I can access each "button" mc this way:
_root.buttonsHolder["button" + index]
This is what I have inside each "button" MC:
on (release) {
_root.buttonPanel[this].gotoAndStop("on");
}
I know I can find out button's number by using substring() on "this", but is there another way to find out the index of "this" inside buttonPanel? I couldn't find any methods or properties for that.
Any ideas?
View Replies !
View Related
Trouble Finding An Index Of An Array
Hi all,
I have posted this on the adobe forum and have got closer and closer to making this work.
I have parsed data from a CSV file and got it into an array. However when I try and find an index of an array, I am getting an undefined returned.
Code:
stop();
Array.prototype.findPos = function(value) {
var tAr = [];
for (var i = 0; i<this.length; i++) {
if (this[i] == value) {
tAr[tAr.length] = i;
}
}
return (tAr.length>0) ? tAr : false;
};
myVars = new LoadVars();
myVars.load("members.csv");
myVars.onData = parseCSV;
var TonyData = [];
function parseCSV(raw) {
var delim = (raw.indexOf("
") > -1) ? "
" : (raw.indexOf("
") > -1) ? "
" : "
";
var temp = raw.split(delim);
var fields = temp.shift().split(",");
for(var i=0;i<temp.length;i++) {
var row = temp[i].split(",");
if(row.length != fields.length) continue;
var tmpObj = {};
for(var j=0;j<row.length;j++) {
tmpObj[fields[j]] = row[j];
}
TonyData.push(tmpObj);
}
TonyData.onData
trace("Data Has Loaded");
trace("33's trace is..." + TonyData[33].Name_First + " " + TonyData[33].Name);
trace("10's trace is..." + TonyData[10].Name_First+" "+TonyData[10].Name);
var finder
//This finder value actually works, but introducing findPos causes it to fail finder = TonyData[10].ID;
finder = TonyData[10].ID.findPos(42703);
trace(finder);
if (!finder) {
trace("not found");
} else {
trace("The Array Index relating to the Membernum is: " + finder);
}
gotoandstop(2);
};
The annoying thing is that I can trace TonyData[10].ID but TonyData[10].ID.findPos returns undefined. I have also tried getIndex as well with the same results.
Does anyone have any experience in getting an index of a CSV parsed array, or can anyone see any holes in this code?
Any help would be greatly appreciated.
Regards,
Tony
View Replies !
View Related
Finding The Position Of An Array Index
i was wondering if you have an array value, can you find what number it is in the array's order. For example,
letters=new Array("a","b","c","d");
cnumber=letters.position["c"]
trace(cnumber);
so that cnumber=2. How would I go about doing something like this?
-Brendan
View Replies !
View Related
Finding Index Of Array Item
I'm working in AS2 and have created an array of movie clips (symbol_box[n]) with n ranging from 0 to 24. I want to be able to return the index of a movie clip (symbol_box[n]) when it is clicked so I can use it to access another movie clip in a second array. I need to be able to get the value of n... i.e. the index of the clicked clip. Any ideas? I'm sure it is simple!
View Replies !
View Related
How Can I Access The Value Of An Array Index (or Key) Number?
how can i access the value of an array index (or key) number?
I know how to get the value of the array (large_array[0], but I can't find how get the actual number, i.e., 0, 1, 2, etc. I want to access corresponding values in other arrays, as in: if btn2_mc (of the btn_array [btn0_mc, btn1_mc,...] ) is clicked, it hides redGraphic2_mc (of the redGraphic_array [redGraphic0_mc, redGraphic1_mc, ...]) and so on for other arrays. Using Flash 8...
Thanks!
View Replies !
View Related
Index Number Of Array Element
Hello all,
How does one find out the index number of a particular element in an array.
Say i have an array named fruit and it is populated with the following five fruits in this order: apple, banana, orange, pear and mango.
If for one reason or another i happen to be dealing with the element/value orange, using actionscript, how can i determine that its index number is 2.
Many Thanks.
View Replies !
View Related
How To Learn The Index Number Of An Array Node?
Hello all!
This is kind of complicated, I think. I have a multidimensional array:
myArray = newArray()
myArray[0] = new Item(buttonA, "nameA", ArrayA);
myArray[1] = new Item(buttonB, "nameB", ArrayB);
myArray[2] = new Item(buttonC, "nameC", ArrayC);
myArray[3] = new Item(buttonD, "nameD", ArrayD);
Thus, on the main screen there are 4 buttons (named ButtonA - ButtonD) and a dynamic text which displays a string according to the variable: Screen.
I am trying to make a function so when I onMouseOver one of the buttons, such as ButtonA the function finds out what Array ButtonA belongs to and sends "nameA", which is also part of myArray[0], to the dynamic text, Screen.
If someone would be so very kind as to help me, I would be very grateful.
View Replies !
View Related
Checking Index Number Of An Item In An Array
I have this Array
Code:
var shoprubriken:Array = new Array();
shoprubriken[0] = "43";
shoprubriken[1] = "44";
shoprubriken[2] = "45";
shoprubriken[3] = "46";
shoprubriken[4] = "47";
shoprubriken[5] = "48";
shoprubriken[6] = "49";
shoprubriken[7] = "50";
shoprubriken[8] = "51";
Now I wanted to check on which Index Position maybe the 47 is
How can I archive this on a Button or Function???
any hints??
thanx in advance
ChromeD
View Replies !
View Related
How To Learn The Index Number Of An Array Node?
Hello all!
This is kind of complicated, I think. I have a multidimensional array:
myArray = newArray()
myArray[0] = new Item(buttonA, "nameA", ArrayA);
myArray[1] = new Item(buttonB, "nameB", ArrayB);
myArray[2] = new Item(buttonC, "nameC", ArrayC);
myArray[3] = new Item(buttonD, "nameD", ArrayD);
Thus, on the main screen there are 4 buttons (named ButtonA - ButtonD) and a dynamic text which displays a string according to the variable: Screen.
I am trying to make a function so when I onMouseOver one of the buttons, such as ButtonA the function finds out what Array ButtonA belongs to and sends "nameA", which is also part of myArray[0], to the dynamic text, Screen.
If someone would be so very kind as to help me, I would be very grateful.
__________________
- Brother Gabriel
View Replies !
View Related
***. Arrarys, Finding Index, Loading Called Pic From Found Index
I am fairly new to flash, so thanks for bearing with me - here is my problem -
1. I have a bunch of associated arrays, populated from an xml file.
2. I have a dyn mc that displays thumbs, based on the info from the arrays.
3. if the user clicks on the thumb, I want the on release to trigger (among other things) a function that will find the index of, say, "houseID" so I can then apply that index in loading up a different(big) jpg , and other info pertinent to that thumb.
here is my code for the button:
on (release) {
//carry ID being the variable passed thru "oneHouse" function
CarryID=this.houseID;
trace("houseid"+houseID);
_parent.oneHouse(CarryID)
//"big" being the frame label
_parent.play("big")
}
-----------------------
here is code from a frame -
foundIndex = findByID(CarryID);
if (foundIndex != null) {
/*set dynamic textbox values from Arrays
all this stuff is not set up yet...
txtLocation = houseLocationArray[foundIndex];
txtBed = houseBedArray[foundIndex];
txtBath = houseBathArray[foundIndex];
txtPrice = housePriceArray[foundIndex];
//set dynamic jpeg clip from value of photoArray
loadMovie(houseBigpicArray[foundIndex], BigphotoClip);
*/
trace("foundIndex!=null");
}
else{
trace("foundIndex really=null");
}
function findByID(houseID) {
//loop through the IDArray
for (j=0; j<houseIDArray.length; j++) {
//if the passed argument equals an Array value...
if (houseIDArray[j] ==houseID) {
//return the index of the matching value
return j;
}
}
//if nothing is ever found, return null
trace("foundIndex2=null");
return null;
}
gotoAndStop("big");
}
thanks for anyone that can help me with this!!
View Replies !
View Related
***. Arrarys, Finding Index, Loading Called Pic From Found Index
I am fairly new to flash, so thanks for bearing with me - here is my problem -
1. I have a bunch of associated arrays, populated from an xml file.
2. I have a dyn mc that displays thumbs, based on the info from the arrays.
3. if the user clicks on the thumb, I want the on release to trigger (among other things) a function that will find the index of, say, "houseID" so I can then apply that index in loading up a different(big) jpg , and other info pertinent to that thumb.
here is my code for the button:
on (release) {
//carry ID being the variable passed thru "oneHouse" function
CarryID=this.houseID;
trace("houseid"+houseID);
_parent.oneHouse(CarryID)
//"big" being the frame label
_parent.play("big")
}
-----------------------
here is code from a frame -
foundIndex = findByID(CarryID);
if (foundIndex != null) {
/*set dynamic textbox values from Arrays
all this stuff is not set up yet...
txtLocation = houseLocationArray[foundIndex];
txtBed = houseBedArray[foundIndex];
txtBath = houseBathArray[foundIndex];
txtPrice = housePriceArray[foundIndex];
//set dynamic jpeg clip from value of photoArray
loadMovie(houseBigpicArray[foundIndex], BigphotoClip);
*/
trace("foundIndex!=null");
}
else{
trace("foundIndex really=null");
}
function findByID(houseID) {
//loop through the IDArray
for (j=0; j<houseIDArray.length; j++) {
//if the passed argument equals an Array value...
if (houseIDArray[j] ==houseID) {
//return the index of the matching value
return j;
}
}
//if nothing is ever found, return null
trace("foundIndex2=null");
return null;
}
gotoAndStop("big");
}
thanks for anyone that can help me with this!!
View Replies !
View Related
Finding Index Or Position Of Certain Attributes In Xml File?
Hi,
I've been getting to grips with xml and as3 but cant figure this out....
If I retrieve the value in a node from the number of the node, how do i then find the number of the node from the value. (confused?)
this is my code:
Code:
var hx:XML =
<hmv>
<level> <area> Music </area>
<subject> <area> Radio </area>
<content>Live Stream </content>
<content>Archive</content>
</subject>
<subject> <area> Library </area>
<content>Brian Ferry</content>
<content>Harvey GoldSmith</content>
<content>The Levellers</content>
<content>The Kooks</content>
<content>SugaBabes</content>
<content>Take That</content>
</subject>
</level>
</hmv>
trace(hx.level[0].child("area"));
var neededVal:String = hx.level[0].child("area");
///// this gives me the result "Music"
How do i then get the number 0 back from putting in the name Music?
should be relatively simple, i'm sure i just haven't been able to find this explained in any tutorials and its quite a difficult subject to search for.
any help greatly appreciated,
thanks
View Replies !
View Related
Finding The Highest Number
My question might be a bit basic for this board but...
I am running Flash MX and have an external .txt file containing x and y coordinates.
It looks a bit like this, but much longer.
x=1,2,3,4,5,6,7,8,9&y=3,4,6,8,12,19,5,2,1&
Can anyone suggest how I can find the highest value of y?
Thank You in advance,
Tim.
View Replies !
View Related
Finding Out The Highest Number
I have a slider that outputs the current _x position in a text field (xpos), when the slider is released, the _x position and the (xpos) text field both go back to it's origin.
Is there a way to find out the highest number that was output into the (xpos) textfield?
View Replies !
View Related
Finding Out The Highest Number
I have a slider that outputs the current _x position in a text field (xpos), when the slider is released, the _x position and the (xpos) text field both go back to it's origin.
Is there a way to find out the highest number that was output into the (xpos) textfield?
View Replies !
View Related
Finding The Mid-range Number
Hi guys.
What's the quickest way of finding the mid-range number in an object that contains three numbers? I'm trying to find a way of returning the actual property name instead of the value.
Here's an example object...
ActionScript Code:
var colour:Object = { r:10, g:100, b:200 };
... ideally "g" should be returned from a function because it's the mid-range number.
If two values are the same then either property could be returned. For example {r:100, g:100, b:200} could return "r" or "g"... and {r:200, g:20, b:20} could return "g" or "b"... and so on.
I'm stuck on this one for some reason so any help or pointers would be great.
Cheers,
Si ++
View Replies !
View Related
[F8] How To Call Function By Number/index?
I have a bullets that I shoot into enemies and there is different kind of bullets and enemy should call function based on bullet type. I have a code that checks if bullet hit enemy is like:
for(i=0;i<=_root.bullets.length;i++){ //(bullets is array)
if(this.hitTest(_root[_root.bullets[i]])==true){
React on the bullet type.
}}
For example I have a variable in each type of bullet like type=1;type=2 etc...
I know I can call the way:
if(_root[_root.bullets[i]].type==1){function1()}
if(_root[_root.bullets[i]].type==2){function2()} etc...
Is there way to call a function without "if" but some like indexed functions??
Like function[type]() or something. I mean to call a function with "type" variable index, that is variable which describe bullet type.
View Replies !
View Related
Unrepeating Rando Number From Index
Hi, I have a set of numbers that look somewhat like this: 0, 1, 2, 3, 4, 5 and what I want to do it to randomly generate one of these numbers and then remove it from the index and then repeat the whole process until all the numbers are "gone" or have been used.
I know that there's been many similar post about this, but I've searched the forums and can't actually find a working script that fits this description...
Thanks
View Replies !
View Related
How To Get The Index Number Of A Clicked Textfield?
I have an array of textfield and I have added event listeners to each of them for MOUSE_DOWN, what I want is get the index number of the textfield that's been clicked. how can I achieve that?
so far I have these in a loop to populate pArray:
ActionScript Code:
var myTextField:TextField = new TextField();
myTextField.addEventListener(MouseEvent.MOUSE_DOWN, mouseClickText);
pArray.push(myTextField);
then I have mouseClickText for the EventListener:
ActionScript Code:
function mouseClickText(e:MouseEvent):void {
}
but how can I detect which textfield in pArray I am clicking on? ie. how do I get the index of the array element I make a mouse click on?
View Replies !
View Related
Finding An Error's Line Number?
Is there any way to find the line number from an Error object? The docs show getStackTrace() returning something like:
TypeError: null cannot be converted to an object
at com.xyz.OrderEntry.retrieveData(OrderEntry.as:995)
at com.xyz.OrderEntry.init(OrderEntry.as:200)
at com.xyz.OrderEntry.$construct(OrderEntry.as:148)
which appears to include the filename and line-number, but on my system it isn't writing the filename/linenumber, e.g.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MyPackage::SomeClass/SomeFunc()
View Replies !
View Related
Finding The Number Of Instances Of A Class
Is there a way of finding the number of instances of a class in ActionScript?
For example, if i run something like:
Code:
var objectName1:myClass = new myClass;
var objectName2:myClass = new myClass;
var objectName3:myClass = new myClass;
var objectName4:myClass = new myClass;
var objectName5:myClass = new myClass;
how can I find the number of times myClass has been instantiated other than keeping a counter variable?
View Replies !
View Related
Creating An Index For Jpgs Loaded By Number
Hello everyone...
I am using a simple gallery movie to allow users to browse through
a series of images.
in the first frame of the movie i use this actionscript:
var wimg = 1;
var url='image/' + wimg + '.JPG';
then in the second keyframe:
loadMovie(url, "bitmap");
then in the last frame i use:
gotoAndStop(2);
then for the left arrow I use:
on (release) {
if (wimg eq 1) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg - 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
then the right arrow:
on (release) {
if (wimg eq 100) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg + 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
This works fine, loading in numbered images from the the image/ directory.
The question I have:
Is there a way to visibly number the images, and allow for a index to call up an image using its number?
and if so, how in the world do i do this??
Please Help...
Thank you in advance
- Karmakat
View Replies !
View Related
Creating An Index For Jpgs Loaded By Number
Hello everyone...
I am using a simple gallery movie to allow users to browse through
a series of images.
in the first frame of the movie i use this actionscript:
var wimg = 1;
var url='image/' + wimg + '.JPG';
then in the second keyframe:
loadMovie(url, "bitmap");
then in the last frame i use:
gotoAndStop(2);
then for the left arrow I use:
on (release) {
if (wimg eq 1) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg - 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
then the right arrow:
on (release) {
if (wimg eq 100) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg + 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
This works fine, loading in numbered images from the the image/ directory.
The question I have:
Is there a way to visibly number the images, and allow for a index to call up an image using its number?
and if so, how in the world do i do this??
Please Help...
Thank you in advance
- Karmakat
View Replies !
View Related
Creating An Index For Jpgs Loaded By Number
Hello everyone...
I am using a simple gallery movie to allow users to browse through
a series of images.
in the first frame of the movie i use this actionscript:
var wimg = 1;
var url='image/' + wimg + '.JPG';
then in the second keyframe:
loadMovie(url, "bitmap");
then in the last frame i use:
gotoAndStop(2);
then for the left arrow I use:
on (release) {
if (wimg eq 1) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg - 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
then the right arrow:
on (release) {
if (wimg eq 100) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg + 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
This works fine, loading in numbered images from the the image/ directory.
The question I have:
Is there a way to visibly number the images, and allow for a index to call up an image using its number?
and if so, how in the world do i do this??
Please Help...
Thank you in advance
- Karmakat
View Replies !
View Related
Creating An Index For Jpgs Loaded By Number
Hello everyone...
I am using a simple gallery movie to allow users to browse through
a series of images.
in the first frame of the movie i use this actionscript:
var wimg = 1;
var url='image/' + wimg + '.JPG';
then in the second keyframe:
loadMovie(url, "bitmap");
then in the last frame i use:
gotoAndStop(2);
then for the left arrow I use:
on (release) {
if (wimg eq 1) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg - 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
then the right arrow:
on (release) {
if (wimg eq 100) {
wimg = wimg;
url = 'image/' + wimg + '.JPG';
play();
} else {
wimg = wimg + 1;
url = 'image/' + wimg + '.JPG';
play();
}
}
This works fine, loading in numbered images from the the image/ directory.
The question I have:
Is there a way to visibly number the images, and allow for a index to call up an image using its number?
and if so, how in the world do i do this??
Please Help...
Thank you in advance
- Karmakat
View Replies !
View Related
Finding Total Number Of Frames In A Movie Clip
im loading random movieclips from an external folder into an emptymc,
i need a way to get flash to tell me the number of frames in the random clip that has been loaded.
this is what i'm trying to use now to give me a random #, within the # of frames loaded
Code:
Code:
var rNum = Math.round(Math.random(emptymc1,_totalframes))
the clips im using have 90-100 frames, but the number im getting is either 1 or 0
does anyone have any idea what's wrong?
View Replies !
View Related
I Know The Line Number. I Need The Last Char Index Number Of The Line.
Hi,
I have a multiline wrap textbox which is dynamic and has a variable assigned to it. I am importing text into this textbox. If the amount of text exceeds the height size of the textbox I want to split the text into two parts, so the part which exceeds the textbox ( the text which is not visible unless you scroll down) will be moved into another textbox located below the first textbox.
I know how to get the location of the last visible line in the textbox. I simply use
LastVisibleLine=MyTextbox.bottomScroll;
Now I have the location of the last visible line so my question is:
How can I get the location of the last character in the last visible line in the textfield?
Is it possible to count the lines in a textfield when the text is wraped. I've tried to count "
" and "
" and they don't detect the wrapping.
( Wrap: When the textfield detects if a line has reached the width of the texfield it automatically breaks the line so it will fit the textfield. )
Thank you.
View Replies !
View Related
I Know The Line Number. I Need The Last Char Index Number Of The Line.
Hi,
I have a multiline wrap textbox which is dynamic and has a variable assigned to it. I am importing text into this textbox. If the amount of text exceeds the height size of the textbox I want to split the text into two parts, so the part which exceeds the textbox ( the text which is not visible unless you scroll down) will be moved into another textbox located below the first textbox.
I know how to get the location of the last visible line in the textbox. I simply use
LastVisibleLine=MyTextbox.bottomScroll;
Now I have the location of the last visible line so my question is:
How can I get the location of the last character in the last visible line in the textfield?
Is it possible to count the lines in a textfield when the text is wraped. I've tried to count "
" and "
" and they don't detect the wrapping.
( Wrap: When the textfield detects if a line has reached the width of the texfield it automatically breaks the line so it will fit the textfield. )
Thank you.
View Replies !
View Related
Finding Current Frame Number Of FLV Movie (playing In Flash 8 Player)
Hi,
I want a reliable method to find the current frame of a flv movie, being played in the flash 8 player.
I can find the frame rate and current playheadTime of the movie, but I am not sure if it's gonna lead me to exact frame number.
Here is little code snipppet which I am using...
HTML Code:
import mx.video.NCManager;
import flash.external.*;
import mx.video.VideoPlayer;
/* The following code forces the compiler to include the NCManager
class in the current SWF file, which the VideoPlayer class requires
by default. */
var _dummy:NCManager;
var my_vp:VideoPlayer;
my_vp.addEventListener("playheadUpdate", doPlayHeadUpdate);
my_vp.autoRewind = false;
my_vp.autoSize = true;
my_vp.bufferTime = 0;
my_vp.maintainAspectRatio = true; // default
my_vp.playheadUpdateInterval = (1000/15);
//Water.flv is 15 fps movie - I want playhead interval so small that it would update it every frame
my_vp.play("water.flv");
function doPlayHeadUpdate(eventObj:Object):Void
{
trace(" [" + my_vp.playheadTime + " sec of "+ my_vp.totalTime + "] => Frame Rate: " + my_vp.metadata.framerate);
//Print Current Frame Number Here...
//NOT SURE IF THIS IS THE RIGHT WAY TO DO IT... so THAT I WON'T MISS ANY FRAME
trace("Current Frame : "+(my_vp.playheadTime * my_vp.metadata.framerate);
}
Thanks in advance. Please let me know if there is any way of directly finding the current frame of flv movie.
View Replies !
View Related
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?
View Replies !
View Related
Help - Getting Array Index 0 With MultiDim Array
Howdy,
I've attached a file for some help here. I'm creating a menu structure in flash and need to pull certain names out of multiple arrays. I had this working before the arrays became multidim. Now that the arrays have become multidim the chapter heading names are all whacked. The chapter subpages are fine though.. When the file is previewed it's pulling a 0 index for one chapter header, but after that it's pulling the supbage indexes. Basically the headers of the menu need to be the [0] of the arrays.
Any help or suggestions would be helpful
thx
B
View Replies !
View Related
Help - Getting Array Index 0 With MultiDim Array
Howdy,
I've attached a file for some help here. I'm creating a menu structure in flash and need to pull certain names out of multiple arrays. I had this working before the arrays became multidim. Now that the arrays have become multidim the chapter heading names are all whacked. The chapter subpages are fine though.. When the file is previewed it's pulling a 0 index for one chapter header, but after that it's pulling the supbage indexes. Basically the headers of the menu need to be the [0] of the arrays.
It's under the note // populate chapter headers with text //
Any help or suggestions would be helpful
thx
B
View Replies !
View Related
How To Index An Array
I should know this; I think I once did . . . but for some reason my brain is frazzled and I am turning up nothing, not in books, nor on the internet.
All I want is to return the index of an array element. Really, that's it.
I am storing ID values for news stories in an array and I want to make a "previous" and a "next" button -- so I want to take the index of the current ID, add or subtract one, and then send that value to my loading function.
Please, someone save me from myself.
Ed
View Replies !
View Related
Array Index
flash mx
i have an array (arrayA) with length of x, and i have a variable (y) with randomly assigned values between 0 and x
i assigned a random value for x, then in the same frame, i have a dynamic textfield, i want to display the value of arrayA[y], but it doesn't seem to work when i put arrayA[y] in the var field of the dynamic textfield...
please help...
View Replies !
View Related
Array Index
hey guys
i am loading the name of the images 4rm the database and storing in an array is it possible to get the index value of the image inside the array
for eg
my array:Array=["image1","image005","image7","image15"]
all this images r displayed in an thumbnail
when i click on the thumbnail is it possible 2 retrive the image index inside the array so i can navigate thru
say previous image and next image
Tnx in advance.
Shom
View Replies !
View Related
Specify Array Index
Is there a way I could specify the index of a array using this short code:
ActionScript Code:
var myArray = new Array("teste");
How would I go about giving a custom index name instead of it being myArray[0]? I could do it the long way like posted below, but I was wondering the there was a way to shorten this:
ActionScript Code:
var myArray = new Array();myArray[myCustomIndex] = "testing";
Cheers!
View Replies !
View Related
XML Array Index. Help Me Pls...
<?xml version="1.0" encoding="iso-8859-1"?>
<genealogy>
<g1>
<Director title = "Son" />
<Seffire title = "Daughter" />
<Jain title = "Sister" />
<Stropper title ="Mother">
<Kirupa name = "Kirupa"/>
<NovemberRain name = "November Rain"/>
</Stropper>
</g1>
</genealogy>
Above is the XML file. I've a function to reade the nodes of the XML that is "dispTree". xmlStr is the XMl Object.
_root.dispTree(xmlStr.firstChild.childNodes[1], 3);
The call returns "Jain"
What is arrat index we can refer Kirupa.
is it something like _root.dispTree(xmlStr.firstChild.childNodes[1], [3][1]);
I'm little confused how to pass that node index to dispTree function (Kirupa node)
Any help will really appreciable
View Replies !
View Related
Specify Array Index
Is there a way I could specify the index of a array using this short code:
ActionScript Code:
var myArray = new Array("teste");
How would I go about giving a custom index name instead of it being myArray[0]? I could do it the long way like posted below, but I was wondering the there was a way to shorten this:
ActionScript Code:
var myArray = new Array();myArray[myCustomIndex] = "testing";
Cheers!
View Replies !
View Related
Array Index
I know its possible to extract a data item from an Array using and index number but is it possible to extract an index number by specifying a data item or string?
Follow me?
Is it possible to do something like the following?
ActionScript Code:
myArray = new Array ("Tom", "Bob", "Harry", "Mary");
trace (myArray.indexOf("Bob"));
View Replies !
View Related
Deleting The Last Index Of An Array
here is my code:
-----------------------------------------------------------
myArray = new Array("hi","my","name","is","bob");
for(i=0;i<5;i++)
{
listBox.addItem(myArray[i]);
}
myButton.onPress = function ()
{
listBox.removeItemAt(myArray[myArray.length-1]);
}
-----------------------------------------------------------
when i click on the button it erases the first index namely "hi" But I thought I had it set up to erase the last index. Can anyone tell me what is going on here?
View Replies !
View Related
An Array / Index Issue
Hi,
Does someone know an array method (or something else) that returns the index of an element of this array.
For instance :
array[0]="joe";
array[1]="nono";
array[2]="dudul";
array[3]="titi";
If I ask to this "method" the index of the element "joe", I expect it to return 0.
If I ask to this "method" the index of the element "dudul", I expect it to return 2.
It sounds easy... did not find the method through the actionscript dictionnary though...
Thanks for your help
View Replies !
View Related
For Loop And Array Index Zero
when i do a trace of my array i alwasy get an undefine first (index zero).... why is that?
how can i get the pushed item into index zero when the array is empty, by not telling it direct (array[0] = "me"); and then being able to output it to my window?
Code:
on (release) {
array.push ("me");
var size = array.length;
for (var i = 0; i >= array.length - size; --i)
{
resultBox.htmlText += array[i] + " ";
}
}
thanks in advance
Hector
View Replies !
View Related
Array By Index Question
I have this array with three values
ActionScript Code:
var myArray:Array = [91,77,65,];
I need all three values in the array because im using it by index,but what I need is when i press on a button for it to only call the third value of the array 65 and not call the other two.what i'm doing is moving a movie clip to the numbers specified in the array but only need the third value.
hope this makes sense
View Replies !
View Related
|