You're welcome ;-) w/ On 8 okt 2011, at 10:20, Cor wrote:
> Yes, THANKS TO WILLEM !!! :-) > > Best regards, > Cor > > > -----Original Message----- > From: flashcoders-boun...@chattyfig.figleaf.com > [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl > DeSaulniers > Sent: zaterdag 8 oktober 2011 10:18 > To: Flash Coders List > Subject: Re: [Flashcoders] can't get e.target.data > > Ah ok, > I see. Nice! > > Best, > Karl > > > On Oct 8, 2011, at 3:09 AM, Cor wrote: > >> I do it like this: (Thanks to Willem!) >> /* >> //usage >> var myPHP_Loader = new PHP_Loader("myPhpFile.php", ["val1", "Value >> 1"], ["val2", "Value 2"]); myPHP_Loader.addEventListener("loaded", >> myPHP_LoaderLoadedHandler); function >> myPHP_LoaderLoadedHandler(e:Event):void { >> trace(e.target.loader.data["a"]); >> } >> >> //myPhpFile.php >> <?php >> $val1= $_POST['val1']; >> $val2= $_POST['val2']; >> //... do something with these values. >> echo 'a='; >> echo $val1+$val2; >> ?> >> */ >> package { >> >> import flash.display.*; >> import flash.net.*; >> import flash.events.*; >> >> public class PHP_Loader extends Loader { >> >> public var loader:URLLoader = new URLLoader(); >> >> public function PHP_Loader(url:String, ...args){ >> loader.addEventListener(Event.COMPLETE, >> loaderCompleteHandler); >> var request:URLRequest = new URLRequest(url); >> >> if(args.length>0){ >> var variables:URLVariables = new >> URLVariables(); >> for (var i:int = 0; i < args.length; i++) { >> variables[args[i][0]] = args[i][1]; >> } >> request.method = URLRequestMethod.POST; >> request.data = variables; >> loader.dataFormat = >> URLLoaderDataFormat.VARIABLES; >> } >> >> try{ >> loader.load(request); >> } >> catch (error:Error) { >> trace("Unable to load URL"); >> dispatchEvent(new Event("error", true)); >> } >> }//end CONSTRUCTOR >> >> private function loaderCompleteHandler (e:Event):void { >> trace( loader.data ); >> dispatchEvent(new Event("loaded", true)); >> }//end loaderCompleteHandler >> >> }//end class >> }//end package >> >> HTH >> Cor >> >> >> -----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:55 >> To: Flash Coders List >> Subject: Re: [Flashcoders] can't get e.target.data >> >> I'm also not to entirely sure you should use >> >>>>>> var variables: >> >> having a var named variables might be a back-end no-no (I think) The >> whole reserved names thingy.. >> >> 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 >> >> _______________________________________________ >> 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 =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= Geografiek is een in Utrecht gevestigd kartografisch bureau Willem van den Goorbergh is telefonisch bereikbaar onder nummer 030-2719512 of mobiel: 06-26372378 postadres: Hooghiemstraplein 89 3514 AX UTRECHT Bezoek onze website op: www.geografiek.nl twitter: @wvdgoorbergh =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders