all groups > flash actionscript > june 2004 >
You're in the

flash actionscript

group:

XMLConnector -> ActionScript


XMLConnector -> ActionScript bobpf
6/18/2004 8:29:56 PM
flash actionscript:
I am trying to use a XMLConnector purely in ActionScript and it seems to not be
working, please find the attached class I wrote. Any ideas why this would not
work?

import mx.data.components.XMLConnector;
import mx.core.UIObject;

class com.con_way.flash.area.AreaController extends UIObject{
private static var mySelf:AreaController;
private var connector:Object;
private var _contenturl:String;
private var _sic:String;

private function AreaController(){
connector = createObject("XMLConnector", "connector",
mx.managers.DepthManager.kTop);
}
[Inspectable(name="Content URL" type=String)]
public function setContentUrl(contenturl:String){
_contenturl = contenturl;
}
public function getContentUrl():String{
return _contenturl;
}
[Inspectable(name="SIC", type=String)]
public function setSic(sic:String):Void{
_sic = sic;
}
public function getSic(Void):String{
return _sic;
}
public static function getInstance():AreaController{
if (mySelf == null){
mySelf = new AreaController();
}
return mySelf;
}
public function load(Void):Void{
trace("Start Load");
connector.direction = "receive";
connector.URL = _contenturl;
trace("URL: "+_contenturl);
connector.ignoreWhite = true;
connector.addEventListener("result", result);
connector.addEventListener("status", status);
connector.trigger();

}
public function status(event:Object){
trace("type: "+event.type.toString());
trace("target: "+event.target.toString());
trace("code: "+event.code.toString());
trace("data: "+event.data.toString());
}
public function result(event:Object){
trace("Done? "+event.target.results);
}



}
Re: XMLConnector -> ActionScript dignan
4/18/2005 12:00:00 AM
This example is found in flash help:

Example

This example retrieves a remote XML file using the XMLConnector by setting the
direction property to receive. Drag an XMLConnector component into your
library, and enter the following code on Frame 1 of the Timeline:


import mx.data.components.XMLConnector;
var xmlListener:Object = new Object();
xmlListener.result = function(evt:Object) {
trace("results:");
trace(evt.target.results);
trace("");
};
xmlListener.status = function(evt:Object) {
trace("status::"+evt.code);
};
var myXMLConnector:XMLConnector = new XMLConnector();
myXMLConnector.addEventListener("result", xmlListener);
myXMLConnector.addEventListener("status", xmlListener);
myXMLConnector.direction = "receive";
myXMLConnector.URL = "http://www.flash-mx.com/mm/tips/tips.xml";
myXMLConnector.multipleSimultaneousAllowed = false;
myXMLConnector.suppressInvalidCalls = true;
myXMLConnector.trigger();

I hope this helps.


AddThis Social Bookmark Button