Solved

Having trouble downloading MySQL to Flash

Posted on 2011-02-26
3
296 Views
Last Modified: 2013-11-11
I need the experts on this one...

I have some code but need some help making it work...

I am trying to display data from a mySQL database to a datagrid or listbox...

The php code is working as it was tested in the browser but the actionscript is playing difficult...

Here is my code in Flash:

var theXML:XML = new XML();
theXML.ignoreWhite = true;

theXML.onLoad = function(){
	var nodes = this.firstChild.childNodes;
	var i:Number;
	for(i=0;i<nodes.length;i++){
		testList.addItem(nodes[i].firstChild.nodeValue);
	}
	
	
}
theXML.load("http://mysite/myfile.php");

Open in new window

The main problem is that AS3 is not recognizing the load request and onLoad handler...

I just need to be pointed in the right direction on this one...How can the above code be written in AS3?
0
Comment
Question by:eager_to_learn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
CyanBlue earned 500 total points
ID: 34990359
That's AS2 code...  ;)

Check out this tutorial on how to do that with AS3...
   http://www.republicofcode.com/tutorials/flash/as3xml/

CyanBlue
0
 

Author Comment

by:eager_to_learn
ID: 34991673

Thanks CyanBlue for responding...

After a few hours of playing around with the code I came up with this working model:
var file:String = "/scripts/Product.php";
var xmlData:XML= new XML()

var theURL_ur:URLRequest = new URLRequest(file);
var loader_ul:URLLoader = new URLLoader(theURL_ur);
loader_ul.addEventListener(Event.COMPLETE, fileLoaded);

function fileLoaded(e:Event):void
{
xmlData = XML(loader_ul.data);

var array = xmlData.children();
var howMany = xmlData.children().length();

	for(var i = 0; i < howMany; i++) {
		TestGrid.addItem({UPC:array[i]});
	}
}

Open in new window

Thanks.
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 34991731
Glad to hear that you've got it working...  Please close the topic...  ;)

CyanBlue
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Survey branching tutorial 11 78
embadded search engine in website 4 47
MySQL programmer starter 25 66
Need a quick overview of Selenium testing 2 36
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Viewers will learn how to use the Hootsuite Dashboard.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question