Hi Michael, I have just downloaded Flex 2 Beta 2. I will put it to work. I tell you after if this is working with Beta 2
Thank you very much --- In [email protected], "Michael Schmalle" <[EMAIL PROTECTED]> wrote: > > Hey, > > I am using Flex2-AMFPHP in a project and it works great! > > There has been some discussion in this list about what to change by > subclassing NetConnection. > > Well hey, here is my stuff; > > package com.teotigraphix.amf > { > import flash.net.NetConnection; > > public class NetConnection2 extends NetConnection > { > public function AppendToGatewayUrl (append:String):void > { > } > > public function AddHeader():void > { > } > > public function ReplaceGatewayUrl():void > { > } > } > } > > Service abstract class > > package com.teotigraphix.amf > { > import flash.util.trace; > > import flash.net.Responder; > import flash.net.NetConnection; > import flash.net.ObjectEncoding; > > import flash.events.Event; > import flash.events.EventDispatcher; > > import mx.utils.ObjectUtil; > > import com.teotigraphix.amf.NetConnection2; > > import com.teotigraphix.events.FaultEvent; > import com.teotigraphix.events.ResultEvent; > > /** > * The abstract class to create a concrete service implementation using > AMFPHP. > * @author Michael J. Schmalle > * @date 03-06-06 > */ > public class AMFService extends EventDispatcher > { > protected var _gateway:NetConnection2; > private var __gatewayURL:String = " > http://localhost/teotigraphix/flashservices/gateway.php"; > protected var classPath:String = ""; > > /** > * The url leading to the service's gateway.php file. > * @usage myService.gatewayURL = " > http://www.example.com/flashservices/gateway.php"; > */ > public function set gatewayURL(value:String):void > { > __gatewayURL = value; > } > public function get gatewayURL():String > { > return __gatewayURL; > } > > /** > * Create the gateway connection, set ObjectEncoding to AMF0 and > connect the gateway to the gateway url. > * @see com.teotigraphix.amf.NetConnection2 > */ > public function AMFService() > { > super(); > _gateway = new NetConnection2(); > _gateway.objectEncoding = ObjectEncoding.AMF0; > _gateway.connect(__gatewayURL); > } > > /** > * NOTE :: This works but it needs to have the arguments dealt with, > so I didn't implement it yet. > * Can anyone tell me what I am doing wrong to get the arguments > passed to php correctly ? > * Wrapper for the fudged service call. > * @param methodName a string indicating the method to invoke within > this service. > * @param responder a Responder instance that will activate the > default onResult() or onFault() handlers. > */ > protected function service(methodName:String, responder:Responder, > ... args):void > { > //trace("service() " + classPath + "." + methodName); > _gateway.call(classPath + "." + methodName, responder, args); > } > > // > ===================================================================== === > // Public _gateway event handlers > // > ===================================================================== === > > /** > * Default result handler for the Responder. > * @param event an Event that holds {event.result}. > */ > public function onResult(event:Object):void > { > dispatchEvent(new ResultEvent("result", event)); > } > > /** > * Default fault handler for the Responder. > * @param event an Event that holds {event.fault}. > */ > public function onFault(event:Object):void > { > //trace("onFault()", ObjectUtil.toString(event)); > dispatchEvent(new FaultEvent("fault", event)); > } > } > } > > Subclassed service... > > > > package com.teotigraphix.amf.files > { > import com.teotigraphix.amf.AMFService; > > import com.teotigraphix.events.ResultEvent; > import flash.net.Responder; > import flash.util.trace; > import com.teotigraphix.amf.files.IFileService; > > public class AMFFileService extends AMFService implements IFileService > { > > public function AMFFileService() > { > super(); > classPath = "com.teotigraphix.amf.files.AMFFileService"; > } > > /** > * > */ > public function getAllDirectories(directory:String):void > { > var responder:Responder = new Responder (onAllDirectories, > onFault); > //service("getAllDirectories", responder, directory); > _gateway.call(classPath + "." + "getAllDirectories", responder, > directory); > } > > private function onAllDirectories(e:*):void > { > //trace("onAllDirectories()"); > var ev:ResultEvent = new ResultEvent ("allDirectoriesLoaded", e); > dispatchEvent(ev); > } > > /** > * > */ > public function getFile(url:String):void > { > var responder:Responder = new Responder(onGetFile, onFault); > > // THIS IS WHAT IS MESSING UP HELP!!! > //service("getFile", responder, file); > > _gateway.call(classPath + "." + "getFile", responder, url); > } > > /** > * > */ > private function onGetFile(resultData:*):void > { > resultData = resultData.split("\r").join(""); > dispatchEvent(new ResultEvent(ResultEvent.LOADED, > resultData)); > } > } > } > > Anyway, this was written ON THE FLY, not rfactoring yet. It works great! > > Peace, Mike > > On 3/20/06, mvbaffa <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > > I have a new project and I would like to do it in Flex 2.0 The problem > > is that I don't know which server technology to use. > > > > Have you already tested any of these technologies. Which one is > > working ok for the Beta 1 of Flex 2.0. > > > > Wiil I need to use FES ???? > > > > Thanks in advance > > > > > > > > > > > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.com > > > > > > > > SPONSORED LINKS > > Web site design development<http://groups.yahoo.com/gads? t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2= Computer+software+development&w3=Software+design+and+development&w4=M acromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L -4QTvxB_quFDtMyhrQaHQ> Computer > > software development<http://groups.yahoo.com/gads? t=ms&k=Computer+software+development&w1=Web+site+design+development&w 2=Computer+software+development&w3=Software+design+and+development&w4 =Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig =lvQjSRfQDfWudJSe1lLjHw> Software > > design and development<http://groups.yahoo.com/gads? t=ms&k=Software+design+and+development&w1=Web+site+design+development &w2=Computer+software+development&w3=Software+design+and+development& w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.s ig=1pMBCdo3DsJbuU9AEmO1oQ> Macromedia > > flex<http://groups.yahoo.com/gads? t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+sof tware+development&w3=Software+design+and+development&w4=Macromedia+fl ex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZ I36cYzBjw> Software > > development best practice<http://groups.yahoo.com/gads? t=ms&k=Software+development+best+practice&w1=Web+site+design+developm ent&w2=Computer+software+development&w3=Software+design+and+developme nt&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166 &.sig=f89quyyulIDsnABLD6IXIw> > > ------------------------------ > > YAHOO! GROUPS LINKS > > > > > > - Visit your group "flexcoders<http://groups.yahoo.com/group/flexcoders>" > > on the web. > > > > - To unsubscribe from this group, send an email to: > > [EMAIL PROTECTED]<flexcoders- [EMAIL PROTECTED]> > > > > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of > > Service <http://docs.yahoo.com/info/terms/>. > > > > > > ------------------------------ > > > > > > -- > What goes up, does come down. > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

