EDIT: This is applicable only to FP9.
Are you sure you are using the right class? FileReference
does not have a load method or a data property. I guess you are referring to the URLLoader
class - it does have both and that's what you should be using to load data. FileReference class is for downloading files from the server to the user's machine (not to the SWF) and uploading files from user's machine to the server.
Use URLLoader class for loading data to the SWF and Loader class to load other SWFs and images to your SWF. Loader
class has a content
property analogous to the data
property of URLLoader
that will hold the loaded content. The load()
methods of both these classes are asynchronous (returns without waiting for the load to be completed) and hence, as @dustmachine noted, you can access the loaded data/content only after the Event.COMPLETE
is fired.
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, onLoad);
urlLoader.load(new URLRequest(theURL));
private function onLoad(e:Event):void
{
var urlLoader:URLLoader = URLLoader(e.target);
trace(urlLoader.data);
}