Excuse me if my AS3 is not entirely correct, but wouldn't this be more of what your trying to do?

...
        var req:URLRequest = new URLRequest();
        var post_vars:URLVariables = new URLVariables(id, pkg);
        loader.dataFormat = URLLoaderDataFormat.VARIABLES;
        req.method = URLRequestMethod.POST;
        req.url = "" + siteUrl + "store/flash_store2.py";
        post_vars.id = id;
        post_vars.pkg = pkgID;
        req.data = post_vars;
        loader.send(req.url, req.method, req.data);
        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();
        str = e.target.data;
        return str;
    }

Best,
Karl


On Oct 8, 2011, at 2:49 AM, Cor wrote:

Not sure, but by doing:
var req:URLRequest = new URLRequest(siteUrl + "store/flash_store2.py? id=" +
id + "&pkg=" + pkgID);

doesn't this "overwrite" the posting of the URLVariables?

I use URLVariables all the time and never have any problem.


-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: zaterdag 8 oktober 2011 9:45
To: Flash Coders List
Subject: Re: [Flashcoders] can't get e.target.data

I think the other way he was doing it is supposed to be like this..

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

Yes?

Karl


On Oct 8, 2011, at 2:39 AM, Cor wrote:

yes


-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: zaterdag 8 oktober 2011 9:38
To: Flash Coders List
Subject: Re: [Flashcoders] can't get e.target.data

Well then wouldn't..

var str:String = e.target.data;

work?

Karl


On Oct 8, 2011, at 2:31 AM, Ross Sclafani wrote:

Has to be.

Ross P. Sclafani
Design | Technology | Creative
347.204.5714
http://ross.sclafani.net
http://www.twitter.com/rosssclafani

On Oct 8, 2011, at 3:25 AM, "Cor" <c...@chello.nl> wrote:

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

without new?

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: zaterdag 8 oktober 2011 2:44
To: Flash List
Subject: Re: [Flashcoders] can't get e.target.data

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

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
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

_______________________________________________
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

_______________________________________________
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

Reply via email to