ActionScript 2.0 :: Traversing 3 Dimensional XmL?
Mar 5, 2010I have this as xml :
[Code]..
I wanna parse it and install it on in array or an object how do i that?
I have this as xml :
[Code]..
I wanna parse it and install it on in array or an object how do i that?
I have spent multiple hours on it to find no result. Here is the situation. MY xml structure looks like this:
<root>
<RES>
<R N="1">
[Code]....
But I am not able to refer to the corresponding parent <R> so that I can traverse it to retrieve corresponding <SEZ N="name" V="dummy name"/>
This might sound really simple, but I have spent multiple hours on it to find no result. Here is the situation. MY xml structure looks like this:[code]But I am not able to refer to the corresponding parent <R> so that I can traverse it to retrieve corresponding <SEZ N="name" V="dummy name"/>
View 1 RepliesFirst of all, this is not specifically for homework. It's a project I've been working on for the past few months and I've kinda hit a road block. The short version: I've got a Flash file (which is a DJ program) whose main functionality is to play mp3 files, load the files a user uploads into a web page I made and let the user have the ability to choose which song they would like.
I literally have this almost completed except for this final piece: playing what the user uploads. More details of how I got here: I've got a PHP page that creates (or updates if you wish to call it that) an XML file. I'm not sure which way I should approach it (most tutorials online show AS2 but I've already made my project in AS3 and I've seen it's easier...yet I'm not able to figure this out).
[Code]...
I have 2 classes Main.as and RedPawn.as (yes, in the same folder).I am wanting to check if a child exists on a movie clip in Main.as through RedPawn.as.This is within a for loop since I am checking 24 possible values for _dest until I find a match.This simplified code example would be in the RedPawn class:
Code:
_dest = 'example_mc'; // example_mc is pulled from an array
if ( MovieClip(root)._dest.numChildren < 2 ) { // do stuff; }
[code].....
I'm having trouble interrperting how I should traverse an XML file and pushing it to an array to display the sets of data.
Here is my AS:
myXML = new XML();myXML.ignoreWhite = true;myXML.onLoad = function(ok) {
if (ok) { alldata = this.firstChild.childNodes; allEntries =
[code]......
I'm currently working on a tower defense game and am in kind of an odd situation. I've programmed it in such a way that a large class hierarchy is in place. It's like this StartScreen class ---> BaseLevel class ---> GUI class ---> TowerPlacer class(towers are stored in an array in this class) ----> etc.My problem is that i need to access an array in BaseLevel from my GUI class, is there any fancy trick for doing this? or have i screwed myself over.
View 2 RepliesI am experiencing problems when trying to traverse XMl returned from the youtube data api.I can trace the XML but cannot access any of the nodes, not sure where I'm going wrong, I have tried various methods including parsing JSON format from youtube but to no avail. I thought it maybe the namespaces so I replaced these using a script to replace them as attributes. A snippet of returned XML is below:
[Code] .....
I've been searching around forever trying to find a way to make traversing nested display lists more of a 1-line possibility.In AS2 you could grab a clip just by _container.clip1.nestedclip2.nestedclip3 and it was blatently simple.In AS3, is there any way to do that?So far my only methods are keeping a class level reference to important parts of the UI or doing a painful series of getChildByName chains until I drill down to it:[code]The casting makes the getChildByName method possible.
View 15 RepliesWithout trying to explain the odd issue i am seeing, is this possible?
View 9 RepliesI want a bubble chart that just shows items along a straight line. So I'd like the horizontal axis to essentially not exist. I have it working right now with the yField assigned to a field that happens to always be '1' on my test dataset.. but this is not going to be the case in general, so I need some way to restrict the y-axis... preferably without needing to go back to my model and parse through all my data to add a dummy value '1' on each entry.
Unfortunately setting min/max values just cuts off anything above or below rather than restricting entries.
I set computedMin and Maximum (no idea what they are and the docs don't really explain) but it didn't seem to restrict the data in any way.
have a twodimensional array that consists of 6 other arrays(like array[0 to 5][0 to 4]). The [4] of each sub-array is a indexnumber that i'd like to use for sorting the array[0][x] toarray[5][x] according to their array[x][4]-value. How would I do
View 3 RepliesI couldnt find how to form a 2x2 matrix as old pascal days in ActionScript. All arrays are only one row. How can I change it.
View 3 RepliesI am currently playing around with flex, I have C++ background, so I am not used to AS3.The problem is in the main*.mxml file I have fx:script block and I try to define a multidimensional array like that:
public var Board:Array = new Array(25);
I use a function to initialize the 2d-array:
public function initBoard():void {
var i:int;
var j:int;[code]....
This function gets called later on in the main loop to init and reset the "board" why doesn't it work. The only difference to the AS3 documentation is that it gets done in a function.
[code]...
How can I sort the two-dimensional array superHeroes by the "city" or [1] value?
How do i traverse multidimensional array so i can turn this into value objects :
Code:
<accordion_nav>
<item branch="PATIENT TYPES" level="1" treeID="10.00">[code]......
so each items has a propery of branch, treeID, and level?
i am amuthavalli. i am new to the action script. so i want to know how tho define and access the two dimensional array in flash
View 1 Repliescreating If loops with multiple-dimensions. What I am trying to do is simple in concept: create "boxes" (square movie clips) surrounding another movie clip (one to the left, to the right, above and below). Essentially what I have so far looks like this:
--------SQUARE-------
SQUARE-Center-SQUARE
--------SQUARE-------[code].....
The problem with this is that as soon as I use the function createmoresquares, the for loop is run again for that second set of squares, but the original for loop to create the original set of squares is forgotten so that I end up with this:
----------------SQUARE--------
--------Center-SQUARE-SQUARE
----------------SQUARE--------
I know this all seems very confusing but the basic mistake I am making should be easy to resolve. I have the same problem creating multiple-dimensional arrays.
I have been working on this flash project for some time now. it is a calender program, one week at a time. (see the screencapture). My problem right now is that i am trying to load data into flash from a database as a two diminsional array. currently i have a two diminsional array in flash named num. num holds values for the color of each box: for example num[2][0] holds a number (1-8, each corresponding with a color) for the first box in moday for employee 3. How would i parse information so that the arrays can be filled with data from a text or asp file (MIME format). I tried to do this: num[0][0]=2&num[1][2]but it didnt work.
View 5 RepliesI am trying to create a two dimensional array in AS2. It should have two values like name and roll no. and stored in such a manner that they can be traced out and also the corresponding values should be together.
as of now I am using...
myArray1.push({name1:inpName,roll:inpRoll});
trace(myArray1);
Images I am loading from XML are associated with the right record on first load but then on refresh they swap places.I am loading XML and creating arrays.Then I pass the array data to objects using loop functions.the AS counts how many books there are in total then and creates the objects and passes informations regarding each book into the individual objects.when I trace the array data just before starting the loop function I get a good consistent read:[code]
View 1 RepliesI found the tutorial about getting the index of something in an array, but i need the same for a twodimensional array, so i get [0][1] for example. How do i alter this code to do so?
Code:
Array.prototype.getIndex = function(data) {
for (i=0; f=0; i<this.length; ++i; ) {
if (this[i] == data) {
[Code]....
I have loaded image file . I want to find out width and height of desire image. [code]...
View 1 RepliesHere's the bare bones of what's causing me a problem:
var txt:Array = [mtxt];[code]........
i do have problem with searching through my multi-dimensional Array to insert newly value to currently existing value..what I have now....
Code:
var someArr:Array = new Array(["apple"],["orange"],["watermelon"]);
so what I wanna do is I able to search the desire valeu 1st and append to existing value eg;
word search = apple
match and I can append new value to this particulars array and my expecting result new array after append new value
Code:
var someArr:Array = new Array(["apple","expensive"],["orange"],["watermelon"]);
How can I get the two values in a two dimensional array seperatly. I mean in myArrow[1,1] I want the two values seperatly.
View 1 RepliesI am trying to parse data from a user created .txt file and convert it into an Array. This data will eventually be used to output an .xml file or to generate html. The user has no experience or knowledge of XML otherwise there would be no need for this post, I would just parse XML. The data will be set up as a group of items (term and definition, question and answer as well as a type to determine the attributes of the item) like so:
1. How many licks does it take to get to the center of a tootsie pop?
a. The world may never know.
t. ML
2. What is the square root of 69?
a. 8 something.
t. SA
I am currently able to allow a user to have an Open Dialog box to open a local .txt file from their computer. I am also able to read the data and trace it via actionscript. I cannot however split the data where I want to into an array. I cannot use '' to split at as the data from the .txt file may sometimes be multi-line for the question or answer.
So I need to be able to; a) split on a number with a . and a space (eg. '1. ') b) split on a-e with a . and a space (eg. 'a. ') and c) split on 't. '.
Here is the relevant code I have so far:
ActionScript Code:
import flash.text.*;
import flash.net.FileReference;
var tf:TextField = new TextField();
[Code]....
I was just trying to hardcode a couple things like splitting on 'a. ' and 't. ' but it only does one split, whichever comes last.
I have an 2D array that will look summat like this:
var numbers:Array=[[10,1,3],[9,2,4],[8,3,5],[7,4,6],[6,5,7],[5,6,8],[4,7,9],[3,8,10],[2,9,1],[1,10,2]];
now how do I order this array by the 3rd number so it looks like this:
2,9,1, 1,10,2, 10,1,3, 9,2,4 , 8,3,5, 7,4,6, 6,5,7, 5,6,8, 4,7,9, 3,8,10
I have tried:
trace(numbers.sortOn(0,Array.NUMERIC));
returns:
5,6,8, 9,2,4, 8,3,5, 7,4,6, 6,5,7, 10,1,3, 4,7,9, 3,8,10, 2, 9,1, 1,10,2
trace(numbers.sortOn(2,Array.NUMERIC));
returns:
5,6,8, 9,2,4, 8,3,5, 7,4,6, 6,5,7, 10,1,3, 4,7,9, 3,8,10, 2, 9,1, 1,10,2
trace(numbers.sortOn(3,Array.NUMERIC));
returns:
5,6,8, 9,2,4, 8,3,5, 7,4,6, 6,5,7, 10,1,3, 4,7,9, 3,8,10, 2, 9,1, 1,10,2
spaced out for ease of reading.
I want to write a function which has 2 dimensional array as one of its arguments
_global.getList = function ( type:Number, list[]:Array )
This is giving syntax error, if I do
_global.getList = function ( type:Number, list:Array )
Then there is no error, but then, list is now, single dimensional array, which I don't want. Whats the correct syntax to write it as two dimensional array?
following on from B.Rich's great Multi-Dimensional Arrays and attachMovie tutorial, i'm trying to load the array from an external source.i've got a text file that outputs: url... i then try to break this down in flash into a multi-dimensional array that provides info for dynamic buttons:[code]however its not working at all. i'm not sure if its because the attachMovie loop is not getting initiated or what..
View 12 Replies