[Flashcoders] can't get e.target.data

2011-10-07 Thread John Polk
Here's a code snippet:
            var req:URLRequest = new URLRequest(siteUrl + 
store/flash_store2.py?id= + id + pkg= + pkgID);
            /*
            var variables:URLVariables = new URLVariables();
            loader.dataFormat = URLLoaderDataFormat.VARIABLES;
            req.method = URLRequestMethod.POST;
            variables.pkg = pkgID;
            variables.id = id;
            req.data = variables;
            */
            loader.load(req);
            loader.addEventListener(Event.COMPLETE, onSendComplete);
        }
        
        private function onSendComplete(e:Event):void
        {
            var txt:TextField = new TextField();
            var myFormat:TextFormat = new TextFormat();
            myFormat.font = Arial;
            myFormat.size = 5;
            var str:String = new String(e.target.data);

First up, I find I have to often bypass URLVariables because it simply doesn't 
work, as is the case here. But the real problem is thus:
1) When I test this on my Mac, calling the data from my server, everything 
works fine.
2) When I test this on my server, calling the page TTW, everything works fine 
if id has a value and pkg does not.
3) When I test my python script that generates the data on my server passing a 
value only for pkg, everything displays fine; however;
4) When I test this on my server, calling the page TTW with no value for id 
and a value for pkg, e.target.data only serves up this string -- which is 
incomprehensible to me.
How do I trouble-shoot this?
TIA,
John

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] can't get e.target.data

2011-10-07 Thread Karl DeSaulniers

Maybe set it to a var first?

var data:String = e.target.data;
var str:String = new String(data);

HTH,

Karl



On Oct 7, 2011, at 2:23 PM, John Polk wrote:


Here's a code snippet:
var req:URLRequest = new URLRequest(siteUrl + store/ 
flash_store2.py?id= + id + pkg= + pkgID);

/*
var variables:URLVariables = new URLVariables();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
req.method = URLRequestMethod.POST;
variables.pkg = pkgID;
variables.id = id;
req.data = variables;
*/
loader.load(req);
loader.addEventListener(Event.COMPLETE, onSendComplete);
}

private function onSendComplete(e:Event):void
{
var txt:TextField = new TextField();
var myFormat:TextFormat = new TextFormat();
myFormat.font = Arial;
myFormat.size = 5;
var str:String = new String(e.target.data);

First up, I find I have to often bypass URLVariables because it  
simply doesn't work, as is the case here. But the real problem is  
thus:
1) When I test this on my Mac, calling the data from my server,  
everything works fine.
2) When I test this on my server, calling the page TTW, everything  
works fine if id has a value and pkg does not.
3) When I test my python script that generates the data on my server  
passing a value only for pkg, everything displays fine; however;
4) When I test this on my server, calling the page TTW with no value  
for id and a value for pkg, e.target.data only serves up this  
string -- which is incomprehensible to me.

How do I trouble-shoot this?
TIA,
John

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders