Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Flex/Actionscript External XML Scope Issue

Level 1
Level 1
I am processing an external XML file in an event listener
after the URLLoader is complete. The issue I'm having is that I
want getProduct() to return the XML data. How can I get the data
from the event listener getXML(). I tried creating a public
variable outside of the functions but I can't access it from within
the two functions.

package messages




//Returns the current product

public class FetchXMLData


public static function getXML(e:Event):void {

var myProduct:XML = new XML(;



public static function getProduct():XML{

var loader:URLLoader = new URLLoader();


loader.load(new URLRequest(""));

var myProducts:XML = new XML();

//get the value from the listener?!

return myProducts;



0 Replies