473,473 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

"FOR" loop in flash to load xml data

57 New Member
Hi,
I've been using a "for" loop in a javascript to load multiple nodes from an xml file, but now I need to do the same thing in flash. Here's the javascript code:

Expand|Select|Wrap|Line Numbers
  1. xmlDoc=loadXMLDoc("xmlfile.xml");
  2. x=xmlDoc.getElementsByTagName('info');
  3. for (i=0;i<x.length;i++)
  4.     {
  5.     document.write(x[i].childNodes[0].nodeValue)
  6.     document.write("<br />")
  7.     }
  8.  
As they're written, I can't use the two variables (xmlDoc & x) or "document.write" in Actionscript. It's not working and I couldn't find anything to help me in the tutorials/help files in Flash itself. Does anyone know how to do this?

Thanks in advance!
Oct 29 '08 #1
3 3919
joedeene
583 Contributor
If you want the results of the loop to appear on the web page, or wherever you had it before, you could call the JavaScript function from Flash, let me know if you need help with that, also, If you want it to appear in the flash movie/player, then take a look at this tutorial on loops in flash. and there are plenty of tutorials on the web that you can find by searching Google. Such as this one from kirupa.com. Let me know if you need further assistance.

joedeene
Oct 29 '08 #2
npm
57 New Member
Thanks,
It seems like it would be easiest to find out how to use javascript in flash, since I already have the javascript that I've been using all along. Is it easy?

Thanks!
Oct 29 '08 #3
joedeene
583 Contributor
In that case, the getURL function would be most suitable for your situation, and a sample JavaScript function, quoted from that site.

In the following ActionScript, JavaScript is used to open an alert window when the SWF file is embedded in a browser window (please note that when calling JavaScript with getURL(), the url parameter is limited to 508 characters):

Expand|Select|Wrap|Line Numbers
  1. myBtn_btn.onRelease = function()
  2. {
  3.  getURL("javascript:alert('you clicked me')"); 
  4. };
And there are many tutorials on Google on using JavaScript with Flash, using these keywords: 'geturl flash javascript'
(Link to Google with the keywords listed above)

joedeene
Oct 29 '08 #4

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

Similar topics

23
by: Invalid User | last post by:
While trying to print a none empty list, I accidentaly put an "else" statement with a "for" instead of "if". Here is what I had: if ( len(mylist)> 0) : for x,y in mylist: print x,y else:...
32
by: Toby Newman | last post by:
At the page: http://www.strath.ac.uk/IT/Docs/Ccourse/subsection3_8_3.html#SECTION0008300000000000000 or http://tinyurl.com/4ptzs the author warns: "The for loop is frequently used, usually...
3
by: songie D | last post by:
would it be possible to sort of engineer some sort of preprocessor macro that does a 'for' loop. i.e. for where you would normally use a normal for loop, but when it is known ay compile time whay...
3
by: Patrick Sullivan | last post by:
In this for loop, IE skips over the animation function until the end of the loop and only aninmates the last phrase. Firefox does it right. Loop is right below, entire script is below that. This...
34
by: Frederick Gotham | last post by:
Is the domestic usage of the C "for" loop inefficient when it comes to simple incrementation? Here's a very simple program that prints out the bit-numbers in a byte. #include <stdio.h> #include...
1
by: Ralgoth | last post by:
using Flash, I'm sending a bunch of variables to my php script that have ordered names. What I want is to use a "for" loop to identify each variable. This is how I would do it in Flash but don't...
15
by: Steve | last post by:
I am having problems getting values out of an array. The array is set as a global array and values are pushed into it as they are read from a JSON file using a "for loop". When the "for loop" is...
8
by: Ratko | last post by:
Say you have something like this: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not...
9
by: Alexnb | last post by:
Okay, so lets say you have a list: funList = and you do: for x in funList: print x this will print 1-5
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.