NEWBIE - Performing A Sub Sort On A Multidimensional Array
Hi everyone,
I was wondering if you could help me please.
I have the following multidimensional array:
Code:
var bestSize:Array = new Array();
bestSize.push( { counter: small, order: "1", productSize: "S" } );
bestSize.push( { counter: medium, order: "2", productSize: "M" } );
bestSize.push( { counter: large, order: "3", productSize: "L" } );
bestSize.push( { counter: xlarge, order: "4", productSize: "XL" } );
bestSize.push( { counter: xxlarge, order: "5", productSize: "XXL" } );
I want to first of all sort the array in descending order on "counter". I then want to perform a sub sort on "order" to arrange the values in ascending order. I can peform the first sort by doing...
Code:
bestSize.sortOn("counter", Array.DESCENDING)
...or by creating the following function...
Code:
function sortBySizeCounter(counterValue1, counterValue2)
{
var a, b;
a = counterValue1["counter"]
b = counterValue2["counter"]
if (a > b)
{
return -1;
}
else if (b > a)
{
return 1;
}
else
{
return 0
}
}
bestSize.sort(sortBySizeCounter);
I would like to know if somebody could suggest a way in which I could perform the required sub sort.
I am fairly new to ActionScript so apologise if this sounds like a dumb question.
Thank you in advance for your help with this.
Kind Regards,
Joe
SitePoint > Design Your Site > Flash and Actionscript
Posted on: Oct 14, 2008, 09:45
View Complete Forum Thread with Replies
Sponsored Links:
Performing A Sub Sort On A Multidimensional Array
Hi everyone,
I was wondering if you could help me please.
I have the following multidimensional array:
Code:
var bestSize:Array = new Array();
bestSize.push( { counter: small, order: "1", productSize: "S" } );
bestSize.push( { counter: medium, order: "2", productSize: "M" } );
bestSize.push( { counter: large, order: "3", productSize: "L" } );
bestSize.push( { counter: xlarge, order: "4", productSize: "XL" } );
bestSize.push( { counter: xxlarge, order: "5", productSize: "XXL" } );
I want to first of all sort the array in descending order on "counter". I then want to perform a sub sort on "order" to arrange the values in ascending order. I can peform the first sort by doing...
Code:
bestSize.sortOn("counter", Array.DESCENDING)
...or by creating the following function...
Code:
function sortBySizeCounter(counterValue1, counterValue2)
{
var a, b;
a = counterValue1["counter"]
b = counterValue2["counter"]
if (a > b)
{
return -1;
}
else if (b > a)
{
return 1;
}
else
{
return 0
}
}
bestSize.sort(sortBySizeCounter);
I would like to know if somebody could suggest a way in which I could perform the required sub sort.
I am fairly new to ActionScript so apologise if this sounds like a dumb question.
Thank you in advance for your help with this.
Kind Regards,
Joe
View Replies !
View Related
Performing A Sub Sort On A Multidimensional Array
Hi everyone,
I was wondering if you could help me please.
I have the following multidimensional array:
Code:
var bestSize:Array = new Array();
bestSize.push( { counter: small, order: "1", productSize: "S" } );
bestSize.push( { counter: medium, order: "2", productSize: "M" } );
bestSize.push( { counter: large, order: "3", productSize: "L" } );
bestSize.push( { counter: xlarge, order: "4", productSize: "XL" } );
bestSize.push( { counter: xxlarge, order: "5", productSize: "XXL" } );
I want to first of all sort the array in descending order on "counter". I then want to perform a sub sort on "order" to arrange the values in ascending order. I can peform the first sort by doing...
Code:
bestSize.sortOn("counter", Array.DESCENDING)
...or by creating the following function...
Code:
function sortBySizeCounter(counterValue1, counterValue2)
{
var a, b;
a = counterValue1["counter"]
b = counterValue2["counter"]
if (a > b)
{
return -1;
}
else if (b > a)
{
return 1;
}
else
{
return 0
}
}
bestSize.sort(sortBySizeCounter);
I would like to know if somebody could suggest a way in which I could perform the required sub sort.
I am fairly new to ActionScript so apologise if this sounds like a dumb question.
Thank you in advance for your help with this.
Kind Regards,
Joe
View Replies !
View Related
Multidimensional Array , Slice And Sort
how can I slice and sort an array like this :
Code:
var Table:Array = new Array();
Table[0]=[3];
Table[0][0]="01/01/2007 0:00";
Table[0][1]=100;
Table[0][2]=500;
Table[1]=[3];
Table[1][0]="01/01/2007 0:15";
Table[1][1]=15;
Table[1][2]=75;
Table[2]=[3];
Table[2][0]="01/01/2007 0:30";
Table[2][1]=150;
Table[2][2]=750;
I need a copy of this array sliced .... just last two elements
View Replies !
View Related
Stuck Trying To Sort A Multidimensional Array
Hello,
I'm banging my head against the wall trying to figure out how to sort the 2nd array column "topicName_str" in the following code:
Code:
//get CATEGORY info
for (var i:Number=0; i<contentTotal_num; i++) {
//get category vars from XML
var getCategoryName_str:String = temp_array[i].attributes.name.toString();
getCategoryName_str = getCategoryName_str.toUpperCase();
var getIconName_str:String = temp_array[i].attributes.icon.toString();
var sectionsTotal_num:Number = temp_array[i].childNodes.length.toString();
//save content to array
category_array.push({text_str: getText_str,
categoryName_str: getCategoryName_str,
iconName_str: getIconName_str,
items_num: sectionsTotal_num});
//get TOPIC info
for (var j:Number=0; j<sectionsTotal_num; j++) {
//get topic vars from XML
var getTopicName_str:String = temp_array[i].childNodes[j].attributes.name.toString();
var subsectionsTotal_num:Number = temp_array[i].childNodes[j].childNodes.length.toString();
//save content to array
category_array[i][j] = {topicName_str: getTopicName_str,
items_num: subsectionsTotal_num};
//get ITEM info
for (var k:Number=0; k<subsectionsTotal_num; k++) {
//get item vars from XML
var getItemName_str:String = temp_array[i].childNodes[j].childNodes[k].attributes.name.toString();
var getItemDesc_str:String = temp_array[i].childNodes[j].childNodes[k].attributes.desc.toString();
var subsubsectionsTotal_num:Number = temp_array[i].childNodes[j].childNodes[k].childNodes.length.toString();
//replace html placeholders with html tags
getItemDesc_str = getItemDesc_str.split("</P>,<P>").join(newline + newline);
getItemDesc_str = getItemDesc_str.split("<P>").join("");
getItemDesc_str = getItemDesc_str.split("</P>").join("");
getItemDesc_str = getItemDesc_str.split("[br]").join(newline);
getItemDesc_str = getItemDesc_str.split("[").join("<");
getItemDesc_str = getItemDesc_str.split("]").join(">");
getItemDesc_str = getItemDesc_str.split("'").join("'");
getItemDesc_str = getItemDesc_str.split(""").join(""");
//save content to array
category_array[i][j][k] = {itemName_str: getItemName_str,
itemDesc_str: getItemDesc_str,
items_num: subsubsectionsTotal_num};
//get LINK info
for (var l:Number=0; l<subsubsectionsTotal_num; l++) {
//get link vars from XML
var getLinkIconName_str:String = temp_array[i].childNodes[j].childNodes[k].childNodes[l].attributes.icon.toString();
var getLinkIconURL_str:String = temp_array[i].childNodes[j].childNodes[k].childNodes[l].attributes.url.toString();
//save content to array
category_array[i][j][k][l] = {linkIconName_str: getLinkIconName_str,
linkIconURL_str: getLinkIconURL_str};
}
}
}
}
Basically, I'm trying to sort category_array[i][j].topicName_str alphabetically. Any ideas?
Thanks in advance!
Scott
View Replies !
View Related
How To Sort Multidimensional Arrays?
Hi,
here a short explanation of what I want to do:
I want to store data in a multidimensional array for a highscore, something like:
// highscore array
var highscoreArray = [{score:1200, firstName:"John", lastName:"Doe"}, {score:1500, firstName:"Whity", lastName:"Whiteman"}, {score:500, firstName:"Tom", lastName:"Jones"}];
Then I want to sort the array with the highscoreArray.sort() method to display the entries depending on the score:
1. 1500 Whity Whiteman
2. 1200 John Doe
3. 500 Tom Jones
I didn't get the right sequence. Please let me know if you have an idea.
Thanks in advance.
View Replies !
View Related
Sort Multidimensional Based On Two Values
How do I sort a multidimensional based on two values?
My array looks something like this
myArray = new Array[[a, 1, 2], [b, 1, 1], [c, 2, 2], [d, 2, 1]]
The sorting needs to happen on the two values, first in order of the first value and the in order of the second value
The result will be:
[[b, 1, 1], [a, 1, 2], [d, 2, 1], [c, 2, 2]]
In other words
1,1
1,2
2,1
2,2
Thanks
View Replies !
View Related
A Newbie Sort Of
I need some help and my friend wont help me. I am looking for a decent slideshow and instructions on how to use it. I am trying to build my first ever website and i thought a slide show would make it abit better than what it is. I hope this aint alot to ask for ? I dont know alot about flash but i am getting somewhere with it and its a great program to use for web designing well i think so. thanx for the help in the furture J
View Replies !
View Related
Sort Of A Newbie Question
I want it to go to the next frame if all the vars match up, but it doesn't read them as variables if I do-
code: if (var1=1 and var2=2 and var3=3 and var4=1) {_parent.nextFrame();
}
so I thought that if I did this it might work
code: if (var1; =1 and var2; =2 and var3; =3 and var4; =1) {_parent.nextFrame();
}
but it says that it needs a ")" somewhere and I have tried several all over the place. I have all the variables defined in seperate movie clips, and so I don't want to redefine them in this. I don't know if I should have all the variables set in the frame or how to get them to read as variables under the "if"
I think I've done this before-it may just be that I'm tired-but any help would be appreciated
View Replies !
View Related
Sort Of 'intermediate' Newbie Question
Hello everyone.
Am having to teach myself everything I need to know about Flash 5 as my boss is too tight to buy me an 'undodgy' copy with an instruction manual – so I'm relying completely on you and my brain! So far so good though.
I've figured out basic actionscript (load movies, preloaders, button things etc) but always using 'basic' mode.
I now need to create a kind of 'instant quote calculator' . I've looked at loads of examples and tried to pull them apart, but each one seems to be written in a different way!
Basically, the calculator needs a couple of drop down menus with options to choose from. The chosen options need to be 'stored' somewhere and then all the choices added up at the end and display a figure.
I can do a drop down menu, and have figured out a VERY basic calulator (ie with only 4 buttons) but can't seem to apply the two together – what am I missing!
If anyone can tell me some simple code, or a place with a similar tutorial? Can't seem to find this.
Remember, I've only used basic mode so far, so be gentle!
View Replies !
View Related
Comparing Between An Array And A Multidimensional Array
Hi all, this is my first post.
I have only been working with flash for a couple of years, but I know my way around it pretty well. I usually can find answers to any problems I have through searching, but I seem to be stuck on this one....
I am trying to compare an element in an array to an element in an multidimensional array. Here is my code
var songArray:Array = new Array([["q"],["l8"],["l6"]],[["r"]],[["q"],["s5"]]);
var lineArray:Array = new Array("l8","s8","l9","s9");
var tempLine = lineArray[0];
var tempNote = songArray[0][1];
trace(tempLine) // l8
trace(tempNote) // l8
if(tempLine == tempNote) {
trace("True");
} else {
trace("False");
} // False
Why is this?
I appriciate anyones input
Thanks
builder
View Replies !
View Related
Flat Array Vs Multidimensional Array
For a game I'm making I've tried to stick with using flat arrays as much as possible because I read somewhere that its faster than using multidimensional arrays. I just need to know if anyone knows or can point me to any place which discusses the speed difference (if there is any).
Using multidimensional arrays would make my coding much easier but if its slower than flat arrays I'm willing to persevere for the better execution time.
Any thoughts?
View Replies !
View Related
Multidimensional Array
I am creating a tile-based game, and need large 2D arrays to map out the territory. As it is a large area, and I want to be able to add large objects, I thought that a map function would be good:
map=new Array();
//
Movieclip.createMap= function(beginCol,beginRow,endCol,endRow) {
for(var i=beginCol;i<endCol;i+=1)
for (var j=beginRow;j<endRow;j+=1) {
_root.map[i][j]=1;
}
}
//
Using this I should be able to map out any rectangular area.
The problem is that the map array is only 1 dimension, it doesnt accept the [i][j] parameters. And as it will be a 50*50 tile game, i dont want to declare
map[1]=new Array();
map[2]=new Array(); etc etc
Any ideas on how to declare an empty multidimensional array?
View Replies !
View Related
Multidimensional Array
hi I am trying to figure out multidimensional arrays...
I need an array to hold an answer + divider + score...
This is my code....
The dividers are there so I can use them to split the string in authorware
[code]
question = new Array(answer,divider,score);
question[1] = ["apples", " | ", 1];
question[2] = ["bananas", " | ", 1];
trace(question);
outputscore = question.join(" || ");
trace(outputscore);
Is this right?
Also how can I access the answer value of say question [1] ?
can I use question[1].answer = "peaches" ?
any help greatly appreciated!
View Replies !
View Related
XML->Multidimensional Array
Hello,
I am trying to put an XML file into a three dimensional array.I have searched this forum for help, but ít didn't help me. Can anyone tell me what's wrong with this function?
xmlRails.onLoad = function(succes){
var i,j,k;
var rails = new Array();
xmlRails = xmlRails.firstChild;
for(i=0;i<xmlRails.firstChild.childNodes.length;i+ +)
{
xmlRails[i] = new Array();
for(j=0;j<xmlrails.firstChild.childNodes[i].childNodes.length;j++)
{
xmlRails[i][j] = new Array();
for(k=0;k<xmlRails.firstChild.childNodes[i].childNodes
[j].childNodes.length;k++)
{
trace(xmlRails.firstChild.childNodes[i].childNodes
[j].childNodes[k]);
rails[i][j][k]=xmlRails.firstChild.childNodes[i].childNodes
[j].childNodes[k];
trace(rails[i][j][k]);
}
}
}
}
I can look into the XML file, but the trace on the array turns up 'undefined'.
Help? PLease? Any help? I'm desperate!
View Replies !
View Related
Multidimensional Array
Hi,
I'm strugling for hours now on a multidimensional array.
I load an XML-file and put the data in three array's.
The arPicture array should be multidimensional. In the XML-format i've got
<part>
<text>Blablabla</text>
<hulp>some text</hulp>
<pictures><picture>blabla.gif</picture><picture>blablabla.gif</picture></pictures>
</part>
As you can see there can be more than one pictures in a <part>-tag.
In the code below I've tried to loop trough all the XML-nodes. When a <pictures>-node is found, it loops a second to find all the pictures.
So the result should be:
arPicture[0][0] = blabla.gif
arPicture[0][1] = blablabla.gif
That works fine, until there's a new loop through the first level (<part>-node)
for some reason any value in the arPicture[0][x] is lost, and returns "undefined". The arPicture[1][x] is ok then.
I can't figure why?
Can anyone help? (quite urgent...)
Thanks in advance...
.NET Freak
Code:
var arText = new Array();
var arHelp = new Array();
var arPicture = new Array();
var xmlParser:XML = new XML();
xmlParser.ignoreWhite = true;
xmlParser.load("xml/isvBrugge.xml");
xmlParser.onLoad = function(success:Boolean) {
if (success) {
Title.text = xmlParser.firstChild.firstChild.firstChild.firstChild.nodeValue;
if (xmlParser.firstChild.firstChild.hasChildNodes()) {
i = 0;
x = 0;
for (var aPart = xmlParser.firstChild.firstChild.firstChild; aPart != null; aPart=aPart.nextSibling) {
if (aPart.hasChildNodes()) {
for (var aNode = aPart.firstChild; aNode != null; aNode=aNode.nextSibling) {
if (aNode.nodeName == "Text") {
arText[i] = aNode.firstChild.nodeValue;
}
if (aNode.nodeName == "Hulp") {
arHelp[i] = aNode.firstChild.nodeValue;
}
if (aNode.nodeName == "Pictures") {
x = 0;
for (var aPic = aNode.firstChild; aPic != null; aPic=aPic.nextSibling) {
arPicture[i] = new Array();
arPicture[i][x] = aPic.firstChild.nodeValue;
x++;
}
trace(arPicture);
}
}
i++;
}
x++;
}
}
_root.DelayController.play();
} else {
Title.text = "Loading XML-file";
}
};
View Replies !
View Related
Multidimensional Array
This is something not getting right
ar=new Array();
ar[8,0]=1;
ar[5,3]=8;
for(i=0;i<9;i++){
trace(ar[i,0]+" "+ar[i,1]+" "+ar[i,2]+" "+ar[i,3])
}
is delivering the results
1 undefined undefined 8
1 undefined undefined 8
1 undefined undefined 8
1 undefined undefined 8
1 undefined undefined 8
1 undefined undefined 8
1 undefined undefined 8
1 undefined undefined 8
1 undefined undefined 8
But i think it should go like
undefined undefined undefined undefined
undefined undefined undefined undefined
undefined undefined undefined undefined
undefined undefined undefined 8
undefined undefined undefined undefined
undefined undefined undefined undefined
undefined undefined undefined undefined
undefined undefined undefined undefined
1 undefined undefined undefined
Plz help. I think i doesn't know flash.
View Replies !
View Related
Multidimensional Array?
basically I have an array of numerical values that change depending on which button is pressed, and they need to be displayed as text but sorted numerically... I thought a multidimensional array would work, but I cant get it to sort right. Is this possible to do, or is there another way to accomplish this thats relatively easy?
The idea is for totals_array to calculate the total value and sort it numerically then name_array replaces that value with the appropriate title and is traced.
button code:
Quote:
on(press) {
// arrays are all created at frame 1 then used on button presses
totals_array[0] = fcsg_array[0] + nutrition_array[0];
totals_array[1] = fcsg_array[1] + nutrition_array[1];
name_array[0] = "Colorado Springs";
name_array[1] = "Minneapolis";
totals_array.sort(Array.NUMERIC);
trace(totals_array);
I am using FL8 also
Any help is appreciated!
Thanks
View Replies !
View Related
Multidimensional Array Help
Hi
I have an array with 12 elements
mates =["6", "bob", "4", "10", "fred", "1", "7", "joe", "3", "14", "mark", "7"];
I am trying to convert this into a mutidimensional array
so the new array would look like
newArray=[6,bob,4],[10,fred,1],[7,joe,3],[14,mark,7]
I need to be able to spilt the original array into 4 parts of 3 and then sort the array into order based on the first element.
the final structure in order would look like
[6,bob,4], [7,joe,3],[10,fred,1],[14,mark,7]
I am not sure how to do this can anyone please help?
View Replies !
View Related
Help With Multidimensional Array
I am having a problem with creating and loading data into a multidimensional array. I want to create an array to hold data from blog entries in a database. Each array in the larger array will hold the data for each column in the database.
I have tested and the data is coming into Flash fine and is in the LoadVars variable. However the final trace statement in the loop that is loading the data in the array shows "undefined" for the array element.
What am I missing? (code is below)
var blogItems:Array = new Array("artID","artTitle","artDate","artLoc","artCa t","art");
// get blog list data into an array we can use elsewhere
var records:Number = this["records"];
var i:Number;
blogItems["artID"] = new Array();
blogItems["artTitle"]= new Array();
blogItems["artDate"]= new Array();
blogItems["artLoc"]= new Array();
blogItems["artCat"]= new Array();
blogItems["art"]= new Array();
for (i=0; i < records; i++) {
blogItems["artID"][i] = this["artID"+i];
blogItems["artTitle"][i] = this["artTitle"+i];
blogItems["artDate"][i] = this["artDate"+i];
blogItems["artLoc"][i] = this["artLoc"+i];
blogItems["artCat"][i] = this["artCat"+i];
blogItems["art"][i] = this["art"+i];
trace (blogItems["artID"][i]);
}
View Replies !
View Related
Multidimensional Array
Hi!
My first post here
i have a problem. I need to pharse xml data and put it in an multidimensional array like this:
slides->slide[0]->subSlides[0]->slideHeader, slideText
slides->slide[0]->subSlides[1]->slideHeader, slideText
slides->slide[0]->subSlides[2]->slideHeader, slideText
slides->slide[1]->subSlides[0]->slideHeader, slideText
slides->slide[1]->subSlides[1]->slideHeader, slideText
slides->slide[1]->subSlides[2]->slideHeader, slideText
And so forth...
and the xml looks like this:
<channel>
<slides>
<slide>
<subSlides>
<slideHeader>Header</slideHeader>
<slideText>Text</slideText>
</subslides>
<subSlides>
<slideHeader>Header</slideHeader>
<slideText>Text</slideText>
</subslides>
<subSlides>
<slideHeader>Header</slideHeader>
<slideText>Text</slideText>
</subslides>
</slide>
<slide>
<subSlides>
<slideHeader>Header</slideHeader>
<slideText>Text</slideText>
</subslides>
<subSlides>
<slideHeader>Header</slideHeader>
<slideText>Text</slideText>
</subslides>
<subSlides>
<slideHeader>Header</slideHeader>
<slideText>Text</slideText>
</subslides>
</slide>
</slides>
Anyone that knows a solution?
I've made a whole bunch of tries but always end up with a error (#1010 or something like that).
Thanx!
//Martin
View Replies !
View Related
Multidimensional(3d) Array
ok, trying to make a multidimensional array that holds: questions, answers, and which answer is correct. all this info is stored in an external XML file that contains other text as well.
right now i have this:
var allReview:XMLList = theCaption.review.question.text();
var allAnswers:XMLList = theCaption.review.question.answer.text();
var allCorrectAnswers:XMLList = theCaption.review.question.answer.attributes();
trace("review questions: " + allReview);//traces out all the questions
trace("review questions: " + allReview[0]);//traces 1st question
now i believe i will make the correct answer a boolean value in a attribute in the XML file.
keep in mind some questions will have 2 answers and some will have 4.
one column for questions, one for answers, and one for boolean values.
how do i go about storing all this info in a multidimensional array???? if there's 4 answers to on question- there's no point in storing the question 4 times.
Please some type of direction on this issue would be great!!!
View Replies !
View Related
Multidimensional Array Help
hey people,
i am trying to create a dynamic menu with a submenu. i simply setted up a xml file which is looking like that:
ActionScript Code:
<menu>
<item pos = "main" type = "movie" cat = "none" sub = "no">
<title>news</title>
<content>news.swf</content>
</item>
<item pos = "main" type = "movie" cat = "none" sub = "no">
<title>projects</title>
<content>pr.swf</content>
</item>
<item pos = "main" type = "button" cat="none" sub = "yes">
<title>office</title>
<content></content>
</item>
<item pos = "sub" type = "text" cat="büro" sub = "no">
<title>bio</title>
<content><![CDATA[Here some text for content]]></content>
</item>
<item pos = "sub" type = "text" cat="büro" sub = "no">
<title>qualification</title>
<content><![CDATA[Here some more text]]></content>
</item>
<item pos = "sub" type = "text" cat="büro" sub = "no">
<title>internships</title>
<content><![CDATA[Bla bla]]></content>
</item>
<item pos = "main" type = "button" cat="none" sub = "yes">
<title>press</title>
<content></content>
</item>
<item pos = "sub" type = "text" cat="presse" sub = "no">
<title>won prizes</title>
<content><![CDATA[...]]></content>
</item>
<item pos = "sub" type = "movie" cat="presse" sub = "no">
<title>publication</title>
<content>p.swf</content>
</item>
<item pos = "sub" type = "text" cat="presse" sub = "no">
<title>exhibitions</title>
<content><![CDATA[More text]]></content>
</item>
<item pos = "sub" type = "movie" cat="presse" sub = "no">
<title>interviews</title>
<content>int.swf</content>
</item>
<item pos = "main" type = "movie" cat="none" sub = "no">
<title>contact</title>
<content>contact</content>
</item>
<item pos = "main" type = "text" cat="none" sub = "no">
<title>copyrights</title>
<content><![CDATA[sdf]]></content>
</item>
</menu>
now i had following idea:
i wanted to sort the nodes by asking for the position in the menu and if they have a sub menu (attributes pos & sub).
so i wrote a function which is looking like that:
ActionScript Code:
function sortButtons(bLabel:String, bType:String, bPos:String, bCat:String, bID:Number, bSub:String):Array {
var menu:Array = new Array(new Array(), new Array());
var bString = bLabel+"|"+bType+"|"+bPos+"|"+bCat+"|"+bID;
if(bSub == "no" && bPos == "main"){
counterSub = 0;
trace("menu["+counter+"]["+counterSub+"] pushed "+bString+" ("+bSub+", "+bPos+")");
menu[counter] = bString;
counter++;
}
else if(bSub == "no" && bPos == "sub"){
counterSub++;
trace("menu["+(counter-1)+"]["+counterSub+"] pushed "+bString+" ("+bSub+", "+bPos+")");
menu[(counter-1)][counterSub] = bString;
}
else if(bSub == "yes" && bPos == "main"){
counterSub = 0;
trace("menu["+counter+"]["+counterSub+"] pushed "+bString+" ("+bSub+", "+bPos+")");
menu[counter] = bString;
counter++;
}
else {
counterSub = 0;
trace("menu["+counter+"]["+counterSub+"] pushed "+bString+" ("+bSub+", "+bPos+")");
menu[(counter-1)][counterSub] = bString;
counterSub++;
}
trace(menu);
return menu;
}
the trace("menu["+counter+"]["+counterSub+"] pushed "+bString+" ("+bSub+", "+bPos+")"); is outputting the menu array totally right. but when i'm tracing menu at the end of the function it is stuck at the second button. do you have an idea, how this could be realized?
oh and by the way: the function is called in the onLoad function in a simple for-loop:
ActionScript Code:
for(i = 0; i < nodesNumber; i++){
var labels:String = String(nodes[i].childNodes[0].firstChild.nodeValue);
var type:String = String(nodes[i].attributes.type);
var pos:String = String(nodes[i].attributes.pos);
var cat:String = String(nodes[i].attributes.cat);
var subMenu:String = String(nodes[i].attributes.sub);
buttons = sortButtons(labels, type, pos, cat, i, subMenu)
}
i really appreciate your help!
thanks a lot!
View Replies !
View Related
MultiDimensional Array
I am trying to create an array that holds some info for each item in the array how would I do that?
I want to add a two variables to an array that are essentialy one item in the array. Also how would I acess them later?
a= 1;
b = 2;
myArray = [];
myArray.push [??? this is were I confused with the syntax.
I would really appreciate the help.
Thanks
View Replies !
View Related
Multidimensional Array
Hi, i have some problem witha multidimensional array.
Now explain:
I've create a structure like a Table, the data are take from a bidimensional array. I want include some button to order by a column for example order by code, name etc.
For ordering array i use sortOn() command but the result is anomalous, some time there is a change between 2 column and other time the array is the same in the same order.
Someone can help me please.
P.S. Sorry for my english, i hope to be right.
Nice
View Replies !
View Related
Multidimensional Array
I have an array/Object:
Code:
[0] = mm_name=image1.jpg,mm_path=img/req1,mm_keywords=keyword1
[1] = mm_name=image2.jpg,mm_path=img/req9,mm_keywords=my black cat
[2] = mm_name=image3.jpg,mm_path=img/req7/new,mm_keywords=a brown dog
I want to convert it to a multidimensional array (i think?) so I can reference, like so:
Code:
trace(myArray[1]["mm_name"]); // image2.jpg
trace(myArray[2]["mm_keywords"]); //a brown dog
Any suggestions are greatly appreciated!
View Replies !
View Related
XML To Multidimensional Array
Hi There,
First of all thanks for reading this.
I'm trying to build a trivia slideshow similar to what you would see at the movie theater. I can populate two arrays, one for questions and one for answers. But in order to randomize the output of the question/answers (making sure that the right answers stay with the right questions) I am trying to put them into a multidimensional array. Then later I'll pull a random from that to get my output for my sprite.
So my xml looks like this:
Code:
<trivia>
<entry question="How do you feel?" answer="I feel Fine"/>
<entry question="Are you tall?" answer="I am tall"/>
<entry question="Are you sleeping?" answer="I am asleep"/>
</trivia>
and my actionscript looks like this:
Code:
var xml:XML = new XML(); //setup initial vars to retreive xml data
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("trivia.xml")); //xml file is local to swf
loader.addEventListener
(Event.COMPLETE,function(evt:Event):void //wait for xml to load
{ xml = XML(evt.target.data);
var num:Number = xml.entry.length();
trace(num);
trace(xml);
var trivquest:Array = new Array();
var trivanswer:Array = new Array();
for (var i:Number = 0; i < num; i++)
{
trivquest[i] = xml.entry.@question[i].toXMLString();
trivanswer[i] = xml.entry.@answer[i].toXMLString();
}
var trivlist:Array = new Array((trivquest[i]),(trivanswer[i]));
trace(trivlist);
}
);
So my multiDarray is trivlist, but it's not getting populated properly.
Any advice/help is greatly appreciated!
Tony
View Replies !
View Related
Multidimensional Array
Hi, i have some problem witha multidimensional array.
Now explain:
I've create a structure like a Table, the data are take from a bidimensional array. I want include some button to order by a column for example order by code, name etc.
For ordering array i use sortOn() command but the result is anomalous, some time there is a change between 2 column and other time the array is the same in the same order.
Someone can help me please.
P.S. Sorry for my english, i hope to be right.
Nice
View Replies !
View Related
Multidimensional Array On The Fly
I'm going a bit...crazy...with this problem.
I need to create a multi-dim array that keeps track of movieclip references and under each movieclip references, more references to other clips.
So lets start with the first level movieclips:
mArray = [mc1, mc2, mc2, mc4, mc5];
and lets add a couple other references under it:
mArray[mc1] = [mc6, mc7];
mArray[mc2] = [mc8, mc9];
mArray[mc3] = [mc10, mc11];
I'll never be assigning these on first instance, I need to be able to push new references into the arrays as I go.
After this I'll need to be determine the clips related to each movieclip. So if I want to determine clips under mc2 I want to do:
mArray[mc2].length and recursively scan through it's children and command them as I would like.
I'm not sure if this is possible but it would make my life a "heck" of a lot easier. so my question is how do I add children to each array reference as I go?
thanks in advance.
View Replies !
View Related
Multidimensional Array
Hello!
I't trying to create a multidimensional array of the following kind:
let's say we have a list of cities:
Rome, Paris, London
and a list of neighborhoods for each(i.e: rn1,rn2,...for Rome)
How can I create one array that holds all that information like:
var travel = new Array()
//and the travel array hold information like:
Rome(rn1,rn2,rn3),Paris(pn1,pn2),London(ln1,ln2,ln3,ln4)
so later I could access travel[0] = Rome, travel[1] = Paris
and...
travel[0][0] = rn1
travel[1][1] = pn2
or something like it...
thanks!
View Replies !
View Related
Multidimensional Array Problem
Hi there,
I am putting together a very large ROI calcualtor for a client. It has an input screen, an output screen and a whole spreadsheet full of variables to calculate everything up with.
Since there is such a huge amount of 'assumtion' variables to work with I've decided to putthem all into a mutidimesional array and call them up that way (ie: Assumptions[2][1]). My problem comes in when i build my second mutidimensional array using a combination of input values and values from the first array.
I found out that i can't call an array item when i'm trying to build an array because of the brackets "[" i think.
Here's what it looks like:
array2 = [ [((e14 + ((array[0][0])*e14))* 40 * 52),((e14+(array1[0][1]*e14))*40*52),((e14+(array1[0][2]*e14))*40*52)],
[moredata,moredata,moredata] ];
Does anyone know a workaround for this?
I tried the old JavaScript infront of the [ and ] to show that i'm not trying to start or end an array but that doesn't work in Actionscript.
Does this make any sense?
Thanks for any help you can give me.
View Replies !
View Related
[MX] Populating A Multidimensional Array
I am relatively new to Flash MX. While I've done a pretty good job
in the last two days manipulating XML files and arrays, the following
challenge finally has my head spinning. Could anyone help me out? I've managed to work the XML file okay, but going nuts with the array itself.
I have the following XML file structure to work with, and need to
bring it into a multidimensional array so that I can read it often
to populate UI components dynamically.
XML File "productlist.xml" has the following structure.
(use of square brackets instead of angle brackets to allow display in this forum only)...
----------------------------------------------------------------
[?xml version="1.0"?]
[products]
[item]
[name]Product Name[/name]
[desc]Product Description Here[/desc]
[image]image.jpg[/image]
[price]xxx.xx[/price]
[option]
[optname]Option Name[/optname]
[optdesc]Option Description here[/optdesc]
[optimage]optimage.jpg[/optimage]
[optprice]zzz.zz[/optprice]
[/option]
[/item]
[/products]
---------------------------------------------------------------
Of course the structure will include many items. Some items
will have NO options, while others may have ten options.
All other elements are fixed.
I believe a four-dimensional array is needed. Might be wrong.
A diagram of how I am intending to access the array appears below:
//-------------- MY IMAGINED ARRAY STRUCTURE -----------------------//
// products[x] -- (a specific product)
// products[x][0] -- (product x name)
// products[x][1] -- (product x desc)
// products[x][2] -- (product x image)
// products[x][3] -- (product x price)
// products[x][4] -- (product options array)
// products[x][4][y] -- (product x option y)
// products[x][4][y][0] -- (product x option y name)
// products[x][4][y][1] -- (product x option y desc)
// products[x][4][y][2] -- (product x option y image)
// products[x][4][y][3] -- (product x option y price)
//-----------------------------------------------------------------//
I have a good chunk of code working already, but I seem to be
having trouble over-writing sections of the array while reading
through the XML file.
I think I remember seeing someone else with a similar problem. When I trace in the middle of iterating through the file, the array seems to be populating correctly. But when I trace again after the looping is complete, the entire array is filled with the elements from the last major node of the XML file.
Could someone help me out with code for this? I've been researching and fiddling all day to no end.
View Replies !
View Related
Visious Multidimensional Array...
Hi
I never use multi dimensional arrays before, but for a project Im doing I would like to combine a bunch of arrays into one ...
First I load some strings from txt for testing purpose..
the txt.:
Code:
&dato=01-01-2005,10-01-2005
&juliansk=1,10
&navn=fest1,fest2
&antal=10,23
Ok.. now I load, split and TRY.. to combine these.. but the trace at the bottom is empty or undefined..
Code:
my_date = new Date();
year = my_date.getFullYear();
all_years = new LoadVars();
all_years.load("data.txt");
all_years.onLoad = function(success) {
if (success) {
dato = this.dato.split(",");
jul = this.juliansk.split(",");
navn = this.navn.split(",");
antal = this.antal.split(",");
size = antal.length;
opdelArray(dato, jul, navn, antal, size);
} else {
trace("Det bare noget lort!");
}
};
stop();
function opdelArray(dato, juliansk, navn, antal, size) {
my_date = new Date();
year = my_date.getFullYear();
var j = 0;
var k = 0;
fest_data = new Array(size);
fest_data[0] = year;
for (var i = 0; i<size; i++) {
temp = dato[i].split("-");
trace(temp[2]);
if (fest_data[j] == temp[2]) {
fest_data[j][k] = ""+dato[i];
fest_data[j][k].push(new Array(1));
fest_data[j][k][0] = ""+juliansk[i];
fest_data[j][k][0].push(new Array(1));
fest_data[j][k][0][0] = ""+navn[i];
fest_data[j][k][0][0].push(new Array(1));
fest_data[j][k][0][0][0] = ""+antal[i];
k++;
} else {
j++;
k = 0;
fest_data[j] = ""+temp[2];
fest_data[j].push(new Array(size));
fest_data[j][k] = ""+dato[i];
fest_data[j][k].push(new Array(1));
fest_data[j][k][0] = ""+juliansk[i];
fest_data[j][k][0].push(new Array(1));
fest_data[j][k][0][0] = ""+navn[i];
fest_data[j][k][0][0].push(new Array(1));
fest_data[j][k][0][0][0] = ""+antal[i];
k++;
}
}
trace(fest_data)
}
If someone could guide me a bit.. I made this from and example and don't really know where to begin searching for errors..
thanks...
View Replies !
View Related
[F8] XML Data Into A Multidimensional Array
This multidimenisonal array is going to contain a site's navigation.
The XML loads, then calls the "linkAdder" function to parse the XML node values. It checks to see if there are child nodes of the XML data it's reading, and if so, creates another array within the value it's populating and calls itself. What I'm going for is a structure like this:
PHP Code:
var mainNav:Array = Array('A', 'B', 'C', 'D', 'E', 'F', 'G');
mainNav[4] = Array('D', 'D-A', 'D-B', 'D-C', 'D-D', 'D-E');
mainNav[4][1] = Array('D-A', 'D-A-A', 'D-A-B', 'D-A-C');
trace(mainNav);
I'm running into problems though. Instead of mainNav[4] being 'D', it's always replaced with 'D-A'. In other words, the value from xml_data.childNodes[4].childNodes[0] is replacing the value in xml_data.childNodes[4].
I've been looking at this too long, and my brain's turning to mush. I know my XML is formated properly. Can anyone help in any way?
PHP Code:
function loadLinkXML() {
var link_xml:XML = new XML();
link_xml.ignoreWhite = true;
link_xml.onLoad = function(success) {
if (success) {
_global.mainLinks = Array();
linkAdder(link_xml.firstChild, _global.mainLinks);
trace(_global.mainLinks);
}
};
link_xml.load("nav.xml");
}
function linkAdder(xml_data:XMLNode, container:Array) {
for (var i:Number = 0; i < xml_data.childNodes.length; i++) {
if (xml_data.childNodes[i].firstChild != undefined) {
container[i] = Array();
container[i].push(xml_data.childNodes[i].attributes.display_name);
linkAdder(xml_data.childNodes[i], container[i]);
} else {
container.push(xml_data.childNodes[i].attributes.display_name);
}
}
}
loadLinkXML();
View Replies !
View Related
[F8] Sorting A Multidimensional Array
I have an array thats stores an object;
chatters_arr = new array()
chatter = function(name, age, gender){
this.name = name
this.age = age
this.gender = gender
}
for(i=0;i<chatters.length;i++){
chatters_arr[i] = new chatter(
chatters.attribute.name,
chatters.attribute.age,
chatters.attribute.gender,
)
}
Now each time a chatter enters / leaves the room I will push a new object into the array or remove. Afterwards I want to sort the chatters alphabetically. How do I do this?
I know how to use the array sort, but how do I use it to sort the entire array based on the property of an ojbect stored inside?
Thanks.
View Replies !
View Related
[F8] Multidimensional Array For Nav Menu?
Ok, I have a feeling that I'm going about this all wrong, but anywho:
I have a site with a three level nav bar. I've created movie clips for the menu elements (easier for positioning) with mc_level1, mc_sub1, mc_sub2, mc_tert1_2, mc_tert2_1, etc.
In my actionscript, where I'm defining menu behavior/tweens, I want to have a multidimensional array to keep the elements of the menu, so that:
menu = new Array(4)
menu[0] = new Array(2)
menu[0][1] = new Array(mc_tert_0_0, mc_tert_0_1, mc_tert_0_2)
but I'd also like to be able to reference level 1 and level 2 menu items by the array like:
menu[0] = mc_Support
menu[0][1] = mc_Volunteer
menu[0][1][2] = mc_tert_0_2
Does this make sense? Are you allowed to have aliases for array levels, or should I just create three arrays?
View Replies !
View Related
[F8] Send Multidimensional Array To PHP
Hi Everyone,
Here's my situation, I'd like to send the data in a multidimensional array to php so it can commit the data to a mysql database. The array associates product numbers to matching images (sometimes more than one image, in which case there will also be an identifier for each image). For example:
product_array[12345][0] = new Array(image1, desc1);
product_array[12345][1] = new Array(image2, desc2);
product_array[12346][0] = new Array(image3);
My problem is getting this out to php while maintaining the structure. When I just send the array, it gets flattened into one long string that's completely useless.
I wonder if there is a way to send the whole array as an object or something to php, since I know arrays can be sent via post (i.e. an html form array), by maybe changing the loadVars.contentType property or messing with the LoadVars.AddRequestHeader method.
If not, can someone recommend a way of creating variables on the loadVars object whose name references the product number and whose value contains the nested array (if this gets flattened, i think i can figure how to parse it).
Thanks for any suggestions.
_b
View Replies !
View Related
[F8] Multidimensional Array Of Different Lengths (and A Bit Of XML Too)
Hi there,
I'm getting to grips with multidimensional arrays so i can store projects and images from each project loaded from an xml file for a photography website. i won't know the total number of projects as they will be added to so i need to dynamically create arrays to store new projects. are multidimensional arrays the way to do this?
if so, i was wondering if arrays within the main arrays could be of different lengths? this is because there is no set limit on the number of photos in a project.
so instead of:
bigA[0] = 0,1,2,3
bigA[1] = 0,1,2,3
bigA[2] = 0,1,2,3
it would be:
bigA[0] = 0,1,2
bigA[1] = 0,1,2,3,4,5
bigA[2] = 0,1,2,3
at the moment i'm creating the arrays using for...loops and will be using for...loops to cycle through and store the xml data.
any help regarding multidimensional arrays much appreciated and any tips on dynamically using xml data greatfully received.
cheers,
David
View Replies !
View Related
Multidimensional Array Problems
I'm not sure what I'm doing wrong, but I have an array that looks like this:
PHP Code:
function oFish(oCreature, oPopName, oDesc, oHabitat, oFood, oPredators):void{
this.creature = oCreature;
this.popName = oPopName;
this.desc = oDesc;
this.habitat = oHabitat;
this.food = oFood;
this.predators = oPredators;
}
//
var fishArray:Array = new Array();
fishArray[0] = new oFish("Black_Rockfish_mc", "Black Rockfish", "", "", "", "");
fishArray[1] = new oFish("Blue_Rockfish_mc", "Blue Rockfish", "", "", "", "");
fishArray[2] = new oFish("Bluestripe_Perch_mc", "Bluestripe Perch", "", "", "", "");
fishArray[3] = new oFish("Buffalo_Sculpin_mc", "Buffalo Sculpin", "", "", "", "");
fishArray[4] = new oFish("Cabezon_mc", "Cabezon", "", "", "", "");
and I keep getting this error on each array line:
Code:
1048: Method cannot be used as a constructor.
View Replies !
View Related
[AS3] Amfphp Multidimensional Array
Hello, I have a section of a php script that sends my as3 flash file a multi dimensional array via AMFPHP.
PHP Code:
$data = array();
while ($mail_row = mysql_fetch_assoc($results_mail))
{
array_push($data, $tempdata = array($mail_row['from_player_id'], $mail_row['_sent'], $mail_row['subject'], $mail_row['message']));
}
if ( mysql_num_rows( $results_mail ) == 0 )
{
return "0,No Mail";
}
return "0,".$data;
That will take specific data from every row of results and push it into an array. For each row found, it creates a new row of an array.
So im sure I need to do something alone the lines of looping through _data[1] for in, but can't get a working result. It either traces 'Array', or nothing at all.
Thanks!
View Replies !
View Related
Multidimensional Array Assignment
Hiya Guys,
I have done a search on the forum but coiuldn't see the same problem and I'm probably just having a brain fart anyway but...
this piece of code works...
Code:
Var GridArr=new Array()
for (var i=0;i<10;i++){
GirdArr[i]=123
}
trace(GridArr)
but this doesn't...
Code:
var GridArr= new Array()
for (var i=0;i<10;i++){
for(var j=0;j<10;j++){
GridArr[i][j]=123
}
}
trace(GridArr)
Anybody know why?
I'm sure I must have done this a million times before and it has worked but i cannot get it to work for the last 24 hrs!!
cheers for any help
Z
View Replies !
View Related
Multidimensional Array > TreeMenu
hi,
im trying to build a tree menu from a multidimensional array with lack of luck.
The array get its elements form a mysql db and has a parent - child relationship. what makes it look something like this;
Code:
var arr:Array = new Array
(
[0, 'root', 0],
[21, 'norwegian', 0],
[22, 'english', 0],
[23, 'Om mitt firma', 21],
[24, 'About My Company', 22],
[25, 'Kontakt', 21],
[26, 'Contact', 22],
[27, 'Tjenester', 21],
[28, 'Service', 22],
[29, 'tjeneste1', 27],
[210, 'service1', 28]
);
the function who display and sort the array;
Code:
function buildMainMenu(_arr:Array) {
_arr.sort(0);
for (var i:Number = _arr.length-2; i>0; i--) {
for (j=0; j<=i; j++) {
if (_arr[j][0] != _arr[j+1][2] && _arr[j+1][2] != 1 && _arr[j+1][2] != 0) {
var num = _arr[j];
_arr[j] = _arr[j+1];
_arr[j+1] = num;
}
}
}
var parentItem = undefined;
var pK = 2;
var childItem = undefined;
var cK = 3;
var childschildItem = undefined;
var ccK = 4;
var childschildschildItem = undefined;
var cccK = 5;
for (var i:Number = 0; i<_arr.length; i++) {
trace (_arr[i]);
var mc = this.attachMovie('btn_mc', 'mcChild'+i, i);
if (_arr[i][2] == 0) {
mc._x = 10;
mc._y = 10+(mc._height*i);
parentItem = _arr[i][0];
} else if (_arr[i][2] == parentItem) {
mc._x = 10*pK;
mc._y = 10+(mc._height*i);
childItem = _arr[i][0];
} else if (_arr[i][2] == childItem) {
mc._x = 10*cK;
mc._y = 10+(mc._height*i);
childschildItem = _arr[i][0];
} else if (_arr[i][2] == childschildItem) {
mc._x = 10*ccK;
mc._y = 10+(mc._height*i);
childschildschildItem = _arr[i][0];
} else if (_arr[i][2] == childschildschildItem) {
mc._x = 10*cccK;
mc._y = 10+(mc._height*i);
}
mc.txt.text = _arr[i][1];
}
}
buildMainMenu(arr);
as you can se this isnt working propertly and the code is quite complex.. and my mind is big enouge to find a work around for this.. heeelp
tanx
Hans Philip
seems to work fine afterall
View Replies !
View Related
Help Witih Multidimensional Array
at the top i declare the array:
Code:
var songData = new Array();
Now i populate the array in a function
Code:
..for..
this.songData[i]['id'] = resource.attributes.url;
this.songData[i]['art'] = "asdas";
I finally call the array and try and access it
Code:
ID = 10; //example index
lbl_artist.text = this.songData[ID]['id'];
lbl_song.text = this.songData[ID]['art'];
i get nothing when i try accessing the index like above... it wont let me access the array via specifying my own index, i.e
this.songData[10]['id'];
any ideas?
flash8 and i checked Actionscript 2.0
thanks
View Replies !
View Related
Multidimensional Array Not Working
I am trying to grab some rss data, put into array, then use values in array in a ticker.
The part that I can't get to work is my arWeather array in the processBook function. Keeps giving me undefined. Any thoughts on why?
Code:
tuteInfo_xml = new XML();
tuteInfo_xml.ignoreWhite = true;
var iCnt:Number;
var arWeather:Array = new Array();
iCnt = 0;
tuteInfo_xml.onLoad = function (success) {
if (success) {
//trace('rss loaded. Contents are: '+this.toString());
processBook(tuteInfo_xml);
/*trace(arWeather.length);
for(var i in arWeather){
for(var j in arWeather[i]){
trace(j + ": " + arWeather[i][j]);
}
}
*/
}
}
tuteInfo_xml.load('http://www.weather.gov/alerts/us.rss');
function processBook(tuteInfo_xml) {
// tuteInfo_xml is now a reference to the XML
// object where our information is stored
for (item in tuteInfo_xml.childNodes[0].childNodes[0].childNodes) {
//trace(tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].nodeName);
if (iCnt < 6) {
if (tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].nodeName == "item") {
for (nItem in tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].childNodes) {
if (tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].childNodes[nItem].nodeName == "title"){
arWeather[iCnt] = new Array();
arWeather[iCnt][0] = tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].childNodes[nItem].firstChild.nodeValue;
//trace(tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].childNodes[nItem].firstChild.nodeValue);
trace (arWeather[iCnt][0]);
}
if (tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].childNodes[nItem].nodeName == "link"){
arWeather[iCnt][1] = tuteInfo_xml.childNodes[0].childNodes[0].childNodes[item].childNodes[nItem].firstChild.nodeValue;
trace (arWeather[iCnt][1]);
iCnt++;
}
}
}
}
//arWeather[0] = new weatherlink("abc", "xyz");
}
}
_root.onEnterFrame = function()
{
var dx:Number;
var dy:Number;
dx = _xmouse - mcBox._x;
dy = _ymouse - mcBox._y;
var angle:Number;
var newAngle:Number;
angle = Math.atan2(dy, dx);
newAngle = angle * 180 / Math.PI
_root.mcBox._rotation = newAngle;
//trace(_root.txtHW._x);
if (_root.txtHW._x > Stage.width) {
_root.txtHW._x = 100;
_root.txtHW.Text = "Lee's test2";
} else {
_root.txtHW._x = _root.txtHW._x + 10;
}
}
// Object constructor
function weatherlink(title, url) {
this.title = title;
this.url = url;
}
View Replies !
View Related
Problem With Multidimensional Array
I need to fill a two-dimensional array like this:
Code:
myweek = new Array();
myweek[1,0] = "Monday";
myweek[1,1] = "Tuesday";
myweek[1,2] = "Wednesday";
myweek[1,3] = "Friday";
myweek[1,4] = "Thursday";
myweek[1,5] = "Saturday";
myweek[1,6] = "Sunday";
myweek[2,0] = "222Monday";
myweek[2,1] = "222Tuesday";
myweek[2,2] = "222Wednesday";
myweek[2,3] = "222Friday";
myweek[2,4] = "222Thursday";
myweek[2,5] = "222Saturday";
myweek[2,6] = "222Sunday";
But when I search the element [1,6] with:
Code:
trace(myweek[1,6]);
I obtain: 222Sunday and not Sunday (the very correct result).
What's wrong? Help me please!
View Replies !
View Related
|