[osflash] alternative to mx classes

eka ekameleon at gmail.com
Thu Jul 26 01:33:08 EDT 2007


The AS3 version of the remoting class in VEGAS :

http://svn1.cvsdude.com/osflash/vegas/AS3/trunk/src/asgard/net/remoting/

With an example :

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 ) ;
		}


	}
}
More information about this example in my blog in french about the
difference between the classmapping in AS3 and AS2 tutorial :

http://www.ekameleon.net/blog/index.php?2006/08/28/48--amf-class-mapping-difficile-en-as3


EKA+ :)


2007/7/25, Ryan Christensen [draw.logic] <del at kartoon.net>:
>
>  Sample net connection and responder in AS3.  AS3 has remoting built in.
>
> Sample
>
>
> package B.As3.Game.TileEngineService
> {
>  import flash.net.NetConnection;
>  import flash.net.ObjectEncoding;
>
>  public class TileEngineService extends NetConnection
>  {
>   function TileEngineService(url:String <http://String>)
>   {
>    // Set AMF version - AS3 = AMF3, AMF0 is for older as2 etc.
>    objectEncoding = ObjectEncoding.AMF3;
>    // Connect to gateway
>    connect(url);
>   }
>  }
> }
>
> package B.As3.Game.TileEngineService
> {
>  import flash.display.*;
>  import flash.events.*;
>  import flash.filters.*;
>  import flash.geom.*;
>     import flash.net.*;
>  import flash.utils.*;
>
>  import B.As3.Util.*;
>  import B.As3.Game.TileEngine.*; // our connection to the service
>
>  public class TileEngineServiceAPI
>  {
>   // our service connector, NetConnection
>   private var rs:TileEngineService;
>   private const namespacePrefix:String = "
> B.Net2.Game.TileEngine.TileEngineServiceAPI.";
>
>   function TileEngineServiceAPI(url:String <http://String>)
>   {
>    trace(namespacePrefix + " started...");
>    rs = new TileEngineService(url);
>   }
>
>   public function GetTemplateItems3(str:String)
>   {
>    var responder:Responder = new Responder(GetTemplateItems3_onResult,
> GetTemplateItems3_onFault);
>    rs.call(namespacePrefix + "GetTemplateItems3", responder, "testing");
>   }
>
>   private function GetTemplateItems3_onResult(result:Object):void
>   {
>
>    trace("result:" +result);
>    //trace("result:" +result.result);
>
>    for(var items:String in result)
>    {
>     trace("items" +items);
>     if (typeof(result[items]) == "object")
>     {
>      //mediaList.push(list[items]);
>      for (var d:String in result[items])
>      {
>       trace(d + " - " + result[items][d]);
>      }
>     }
>    }
>   }
>
>   private function GetTemplateItems3_onFault(fault:Object):void
>   {
>    trace( fault);
>   }
>  }
> }
>
>
>
> RYAN CHRISTENSEN
> MCSD C#.NET | MCSD C++ | MCAD.NET | Java
> Bridgeware.com | eMarketinginc.com
> drawk. llc.
> design and programming services
> ryan at drawk.com
> 480.612.4957
> C# | Java | PHP
> MS SQL | Oracle | mySQL
>
> ----- Original Message -----
> *From:* Ryan Christensen [draw.logic] <del at kartoon.net>
> *To:* Open Source Flash Mailing List <osflash at osflash.org>
> *Sent:* Wednesday, July 25, 2007 11:01 AM
> *Subject:* Re: [osflash] alternative to mx classes
>
> I would go straight to AS3 where these classes are part of flash.netnamespace.
>
> http://livedocs.adobe.com/flex/2/langref/flash/net/NetConnection.html
>
> AS2's time is over.
>
>
>
> RYAN
>
> RYAN CHRISTENSEN
> MCSD C#.NET | MCSD C++ | MCAD.NET | Java
> Bridgeware.com | eMarketinginc.com
> drawk. llc.
> design and programming services
> ryan at drawk.com
> 480.612.4957
> C# | Java | PHP
> MS SQL | Oracle | mySQL
>
> ----- Original Message -----
> *From:* izak marais <izakmarais at yahoo.com>
> *To:* Open Source Flash Mailing List <osflash at osflash.org>
> *Sent:* Wednesday, July 25, 2007 6:37 AM
> *Subject:* Re: [osflash] alternative to mx classes
>
> Hi
>
> Wow, that looks excellent! I just started learning flash (open source from
> the start) so I've been  getting along without the mx packages, but there
> are some features here that look really useful.
>
> Does everyone else agree that eka's packages are the way to go?
>
> Izak
>
> *eka <ekameleon at gmail.com>* wrote:
>
> Hello :)
>
> you can use my opensource framework and this extensions :
>
> http://code.google.com/p/vegas/
>
> To install my framework read :
> http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN
>
> Replace for example the NetConnection class of macromedia with my
> NetServerConnection :
>
> http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/asgard/net/
>
> If you want use remoting you can use my asgard.net.remoting package :
>
> http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/asgard/net/remoting/
>
> etc....
>
> The examples are in the directory : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/bin/test/
>
>
>
> EKA+ :)
>
> 2007/7/25, distinctinteractive <jim at distinctinteractive.com>:
> >
> > Hi all.
> >
> > I've been developing in Flash for several years no, but have recently
> > taken the plunge and started to use open source software/components as
> > i've now finished university and didn't want to fork out a load of cash
> > for the Flash IDE. I am using FlashDevelop and have decided to try and
> > figure out the aswing component set (although if anyone can suggest an
> > alternative.....?)
> >
> > I was told recently that i will be unable to use the NetConnection
> > class(along with the other classes in the mx package) as they are tied
> > to the Flash IDE licence. I had a search on OSFlash but the shear number
> > of alternatives is rather baffling.
> >
> > Can anyone please suggest an alternative to these classes?
> >
> > Thanks
> >
> > _______________________________________________
> > osflash mailing list
> > osflash at osflash.org
> > http://osflash.org/mailman/listinfo/osflash_osflash.org
> >
>
> _______________________________________________
> osflash mailing list
> osflash at osflash.org
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>
>  ------------------------------
> Need a vacation? Get great deals to amazing places
> <http://us.rd.yahoo.com/evt=48256/*http://travel.yahoo.com/;_ylc=X3oDMTFhN2hucjlpBF9TAzk3NDA3NTg5BHBvcwM1BHNlYwNncm91cHMEc2xrA2VtYWlsLW5jbQ-->on
> Yahoo! Travel.
>
> ------------------------------
>
> _______________________________________________
> osflash mailing list
> osflash at osflash.org
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>  ------------------------------
>
> _______________________________________________
> osflash mailing list
> osflash at osflash.org
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>
> _______________________________________________
> osflash mailing list
> osflash at osflash.org
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20070726/29b5dcc9/attachment-0001.html 


More information about the osflash mailing list