473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

XML node values into actionscript array

Hi everybody,

Here I am doing a project to generate flash line graphs using xml data. I prepared every thing ready for this, But only problem I am facing since so many days is from the node values in xml. My mind was blocked with this. I want to read the xml node values into the array in action script. Any help will be greatly appreciated. Here is the code:
Expand|Select|Wrap|Line Numbers
  1. var fillDataArray=new Array(); 
  2. var productInfoArray=new Array();
  3. var headingXArray=new Array();
  4.  
  5. function ck() {
  6.  
  7. /* This is the array to be read the values*/
  8.     fillDataArray = [[], [], [], [], []];
  9.  
  10.  
  11.     productInfoArray = ['OPEN', 'HIGH', 'LOW', 'CLOSE'];
  12.     headingXArray = ['25-06-07', '26-06-07', '27-06-07', '28-06-07', '29-06-07'];
  13.     myGraph.init(fillDataArray, headingXArray, productInfoArray);
  14. }
  15.  
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <CMTICKERDATA>
  4.  
  5. <RECORD>
  6. <CANVASBGCOLOR>E3ECFB</CANVASBGCOLOR>
  7. <SYMBOL>CONCOR</SYMBOL>
  8. <SERIES>EQ</SERIES>
  9. <OPEN>2279</OPEN>
  10. <HIGH>2675</HIGH>
  11. <LOW>2126.8</LOW>
  12. <CLOSE>2206.15</CLOSE>
  13. <LAST>2200</LAST>
  14. <PREVCLOSE>2283.65</PREVCLOSE>
  15. <TOTTRDQTY>12498</TOTTRDQTY>
  16. <TOTTRDVAL>28124001.55</TOTTRDVAL>
  17. <TIMESTAMP>1-JUN-2007</TIMESTAMP>
  18. <DELIVERQTY>8813</DELIVERQTY>
  19. </RECORD>
  20.  
  21. <RECORD>
  22. <SYMBOL>CONCOR</SYMBOL>
  23. <SERIES>EQ</SERIES>
  24. <OPEN>2210</OPEN>
  25. <HIGH>2265</HIGH>
  26. <LOW>2151.55</LOW>
  27. <CLOSE>2172.75</CLOSE>
  28. <LAST>2170</LAST>
  29. <PREVCLOSE>2206.15</PREVCLOSE>
  30. <TOTTRDQTY>3734</TOTTRDQTY>
  31. <TOTTRDVAL>8288918.55</TOTTRDVAL>
  32. <TIMESTAMP>4-JUN-2007</TIMESTAMP>
  33. <DELIVERQTY>2145</DELIVERQTY>
  34. </RECORD>
  35.  
  36. </CMTICKERDATA>
  37.  
Jun 26 '07 #1
3 5402
Motoma
3,237 Expert 2GB
I am sorry, your question is difficult for me to understand. Could you reiterate what you are having problems with?
Jun 26 '07 #2
I am sorry, your question is difficult for me to understand. Could you reiterate what you are having problems with?

Hi,

In the AS code fillDataArray is a multidimensional array of four arrays. i have to call all the open values in the xml to the first array of fillDataArray. Then all the high values to the second array of fillDataArray. low values to the third array of fillDataArray. close values to the fourth array of fillDataArray.

I have tried this in so many ways and almost i came to near that. But failed to do so, Below is the AS code that I am trying to call the node values into four individual arrays.

function loadXMLData(loaded) {
if (loaded) {
for (i=0; i<2; i++) {

open[i] = this.firstChild.childNodes[i].childNodes[3].firstChild.nodeValue;
high[i] = this.firstChild.childNodes[i].childNodes[4].firstChild.nodeValue;
low[i] = this.firstChild.childNodes[i].childNodes[5].firstChild.nodeValue;
close[i] = this.firstChild.childNodes[i].childNodes[6].firstChild.nodeValue;
}

But I failed to place this array values into fillDataArray. Is it the right way to solve this problem or is there any easy way, Pleae let me know.

I hope your guidance will make me to do so, Thanks for your help.

Sincerely,
Srinu.
Jun 27 '07 #3
Motoma
3,237 Expert 2GB
Hi,

In the AS code fillDataArray is a multidimensional array of four arrays. i have to call all the open values in the xml to the first array of fillDataArray. Then all the high values to the second array of fillDataArray. low values to the third array of fillDataArray. close values to the fourth array of fillDataArray.

I have tried this in so many ways and almost i came to near that. But failed to do so, Below is the AS code that I am trying to call the node values into four individual arrays.

function loadXMLData(loaded) {
if (loaded) {
for (i=0; i<2; i++) {

open[i] = this.firstChild.childNodes[i].childNodes[3].firstChild.nodeValue;
high[i] = this.firstChild.childNodes[i].childNodes[4].firstChild.nodeValue;
low[i] = this.firstChild.childNodes[i].childNodes[5].firstChild.nodeValue;
close[i] = this.firstChild.childNodes[i].childNodes[6].firstChild.nodeValue;
}

But I failed to place this array values into fillDataArray. Is it the right way to solve this problem or is there any easy way, Pleae let me know.

I hope your guidance will make me to do so, Thanks for your help.

Sincerely,
Srinu.

I had a similar problem when I was working with Flash and XML. My problem was that the XML data was actually not loaded at the time my parse routine was being called. Try placing an else statement to notify you in the case that loaded is false. Post back your results.
Jun 27 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Matt | last post by:
Hello, I am attempting to get a software prototype UI/demo built in Flash to talk with existing C++ (so I can exchange data and commands between the application-software already developed in the...
2
by: Sebastian Araya | last post by:
Hello, I'm trying to create a single function to append new nodes to a DOMDocument object: public function addElement( $element, $name, $value = '', $attrs = Null ) { if( !( $created =...
0
by: RJN | last post by:
Hi I have to read an xml and add the node elements into a hashtable with nodename as key and nodetext as value. If the selected node has childnodes, then value should go as an array. for eg.,...
11
by: ctman770 | last post by:
Hi Everyone, Is it faster to save the precise location of an html dom node into a variable in js, or to use getElementById everytime you need to access the node? I want to make my application...
8
by: John Barleycorn | last post by:
Hi I'm sorry if this question is a bit basic for most people, but I'm really new to VB (I'm using the .NET 2005 Express Edition), but I've set myself a task and would love to see it through. ...
1
by: Rocky86 | last post by:
hi ppl bascially I am require to pass my php coding to actionscript and the actionscript will seperate the code of my php how do I do it? Must I create a function for php to be pass into actionscript...
4
by: Rocky86 | last post by:
hi people I trying to join the 2 report1 and report2 together to send it to the actionscript for displaying the result how do I join them together plss help below is my code: <?php $temp=""; ...
3
by: JuneNasch | last post by:
Hi. I'm a beginner in using Actionscript. Do you know what is the actionscript for a button to exit or quit my project? I'm using Flash 8 pro. I don't know which version of actionscript is used,...
0
by: shaqa | last post by:
I try to do this but i cannot. i creat two layers with actionscript seperated as slideshow need to be,,and i try to put in one rectangle all of my images but cannot put in work,it doesnt load when i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.