0

I have sample code for NetConnection in as3 :

  var good:Boolean;
  nc = new NetConnection();    
  nc.connect("rtmp://ip:port/MyDemo/");
  nc.addEventListener(NetStatusEvent.NET_STATUS,getStream);

  function getStream(e:NetStatusEvent):Void
    {
         good=e.info.code == "NetConnection.Connect.Success";
         if(good)
         {
           var responder = new Responder(adder);
           nc.call("addSomething",responder,2,3);
         }
     }

  function adder (obj:Object):Void
  {
    trace("Total = "+obj.toString());
  }

i have a method "addSomething" in my Test.java which extends ApplicationAdapter class.

My question is that can i use this code in actions of an fla file using as2 or not. If yes than how ?

If not than what changes have to made to use this code in as2 ?

Thanks

1 Answers1

1

Nope, you cannot use this code in any form inside an AS2 project. Unfortunately, you will have to rewrite this from pretty much from scratch to work. Event listeners, Responder(s), and callback functions by reference are not usable in the same form in the AS2 language.

However, what you're trying to do is possible in AS2. Read into this link below on the differences between languages for NetConnection: http://www.justskins.com/forums/actionscript-2-0-vs-127566.html

Jonathan Dunlap
  • 2,581
  • 3
  • 19
  • 22
  • Hi Jonathan, thanks for the response. But i want to know that what we can use in as2 for event listeners and responder. Thanks. –  Jan 19 '12 at 08:35