Hello :) You can try to use my OpenSource AS2/AS3/SSAS Framework who contains a remoting package :
- http://vegas.riaforge.org/ 1 - install the sources in your system with subversion or the zip file in RIAForge 2 - use Vegas in your flex AS3 or MXML project 3 - use the package asgard.net.remoting : Example : 1 - class test.User package test { import flash.net.registerClassAlias ; public class User { // ----o Constructor public function User(name:String="", age:uint=0, url:String="") { trace( "> User constructor : " + this ) ; this.name = name ; this.age = age ; this.url = url ; } // -----o Public Properties public var age:uint ; public var name:String ; public var url:String ; // ----o Public Methods static public function register():void { registerClassAlias("test.User", User) ; } public function toString():String { return "[User name:" + name + ", age:" + this.age + ", url:" + this.url + "]" ; } } } 2 - main class to test the AMFPHP services : package { import asgard.events.ActionEvent ; import asgard.events.RemotingEvent ; import asgard.net.remoting.RemotingService; import asgard.net.remoting.RemotingAuthentification; import flash.display.Sprite ; import test.User ; public class TestAsgardRemoting extends Sprite { // ----o Constructor public function TestAsgardRemoting() { // ----o Register your shared Class. User.register() ; // ----o Create Service var service:RemotingService = new RemotingService() ; service.addEventListener(RemotingEvent.ERROR, onError) ; service.addEventListener(RemotingEvent.FAULT, onFault) ; service.addEventListener(ActionEvent.FINISH, onFinish) ; service.addEventListener(RemotingEvent.RESULT, onResult) ; service.addEventListener(ActionEvent.START, onStart) ; service.addEventListener(RemotingEvent.TIMEOUT, onTimeOut) ; service.gatewayUrl = "http://localhost/work/vegas/php/gateway.php" ; service.serviceName = "Test" ; service.methodName = "getUser" ; service.params = ["eka", 29, "http://www.ekameleon.net"] ; // ----o Launch Service service.trigger() ; } // ----o Public Methods public function onError(e:RemotingEvent):void { trace("> " + e.type + " : " + e.code) ; } public function onFinish(e:ActionEvent):void { trace("> " + e.type) ; } public function onFault(e:RemotingEvent):void { trace("> " + e.type + " : " + e.getCode() + " :: " + e.getDescription()) ; } public function onProgress(e:ActionEvent):void { trace("> " + e.type ) ; } public function onResult( e:RemotingEvent ):void { trace("-----------") ; trace("> result : " + e.result) ; trace("-----------") ; } public function onStart(e:ActionEvent):void { trace("> " + e.type ) ; } public function onTimeOut(e:RemotingEvent):void { trace("> " + e.type ) ; } } } in the PHP services you can use class mapping : 1 - The User php class in services/test directory : /** * @author ekameleon */ class test.User { // ----o Constructor public function User(name:String, age:Number, url:String) { if ( name != null ) this.name = name ; if ( age > 0) this.age = age ; if ( url != null) this.url = url ; trace( "> User constructor : " + this.name ) ; } // -----o Public Properties public var age:Number ; public var name:String ; public var url:String ; // ----o Public Methods static public function register():Void { Object.registerClass("test.User", test.User) ; } public function toString():String { return "[User:" + name + ", age:" + this.age + ", url:" + this.url + "]" ; } } 2 - The Test service class in services/ directory <?php require("test/User.php") ; class Test { // -----o Constructor function Test () { $this->methodTable = array <http://www.php.net/array> ( "getUser" => array <http://www.php.net/array>( "description" => "Returns a user.", "access" => "remote", "returns" => "test.User", ) ) ; } // ----- Methods /** * @desc Returns User instance. * @access remote */ function getUser( $name, $age, $url ) { return new User( $name, $age, $url ) ; } } ?> You can change the class mapping of AMFPHP in the file *advancedsettings.php * : <?php /** * This file defines settings regarding custom class mappings * Custom class mapping is an advanced feature that enables mapping instances of * custom Flash objects to PHP objects and vice-versa. If you want to implement * VOs (value objects) this is the perfect feature for this * * If you have no idea what a VO is chances are you don't really care about these * settings * * Most of the time you will probably want to change the outgoing settings only * since incoming mappings are done for you automatically */ //One may choose to put mapped classes (incoming) outside of the services folder also $gateway->setBaseCustomMappingsPath('services/vo/'); //Set incoming mappings $incoming = array <http://www.php.net/array>( ); $gateway->setCustomIncomingClassMappings($incoming); //Set outgoing mappings $outgoing = array <http://www.php.net/array>( 'user' => 'test.User' ); $gateway->setCustomOutgoingClassMappings($outgoing); ?> I don't test this example with AMFPHP 1.9 ! only 1.5.x More informations in french in my blog : http://www.ekameleon.net/blog/index.php?2006/08/28/48--amf-class-mapping-difficile-en-as3 PS : the documentation of VEGAS and ASGard AS3 comming soon :) EKA+ :) 2006/12/22, T. Michael Keesey <[EMAIL PROTECTED]>:
One of the comments was asking how to set credentials. You can do it like so: gateway.addHeader("Credentials", true, {userid: xxx, password: xxx}); I've actually developed a little AS3 package for AMFPHP remoting. It includes these classes: Credentials, RemoteCall, RemoteMethod, RemoteService. I'll try and post it later. On 12/22/06, Morten Reinholdt <[EMAIL PROTECTED]> wrote: > Hey All > > If it is of any interest I have made a small and simple tutorial about > how to connect actionscript 3 whit AMFPHP 1.9 you can find it on my blog > at http://flashorbit.com/?page_id=53 > > -- > > Morten Reinholdt - Flash Developer - TBWA\PLAY > blog: flashorbit.com <http://flashorbit.com> > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > -- T. Michael Keesey Director of Technology Exopolis, Inc. 2894 Rowena Avenue Ste. B Los Angeles, California 90039 -- The Dinosauricon: http://dino.lm.com Parry & Carney: http://parryandcarney.com ISPN Forum: http://www.phylonames.org/forum/ _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com