3 Replies - 7731 Views - Last Post: 07 February 2006 - 09:47 PM

#1 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1876
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Convert ActionScript 1.0 to 2.0: Remoting

Posted 18 January 2006 - 11:08 AM

We are using AS 1.0 at work but they won't work in Flash 8 anymore. I guess we need to convert the remoting code to AS 2.0. Can someone point me in the right direction or help convert this code:

#include "NetServices.as"
#include "NetDebug.as"

remotingServer = "https://" + server + "/flashservices/gateway";


NetServices.setDefaultGatewayUrl(remotingServer);
var gw = NetServices.createGatewayConnection();
var server = gw.getService("menu.threatcon", this);



server.getFPCon();



function getFPCon_Result(result) {

  var fpcon = result;
  if (fpcon=="Alpha") {
  loadMovieNum("fp_alpha.swf", 3);
	}
	else if (fpcon=="Bravo") {
  loadMovieNum("fp_bravo.swf", 3);
	}
	else if (fpcon=="Charlie") {
  loadMovieNum("fp_charlie.swf", 3);
	}
	else if (fpcon=="Delta") {
  loadMovieNum("fp_delta.swf", 3);
	}

}

server.getInfoCon();

function getInfoCon_Result(result) {
 	 var infocon = result;
  if (infocon=="Alpha") {
  loadMovieNum("info_alpha.swf", 4);

	}
	else if (infocon=="Bravo") {
  loadMovieNum("info_bravo.swf", 5);

	}
	else if (infocon=="Charlie") {
  loadMovieNum("info_charlie.swf", 4);

	}
	else if (infocon=="Delta") {
  loadMovieNum("info_delta.swf", 4);

	}

}


Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Convert ActionScript 1.0 to 2.0: Remoting

#2 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: Convert ActionScript 1.0 to 2.0: Remoting

Posted 19 January 2006 - 01:37 AM

You have to consider the fact that the problem might be in one of the *.as you are including.

I have no experience with remoting though, sorry :/

From what you have given I don't see a problem...

things you might try:

* instead of loading external movies into a level using loadMovieNum(), load them into a movie clip placed on the stage...
eg.
// mc is the movie clip on stage
mc.loadMovie("movie.swf");


This isn't a better way. Just suggesting.

* create strict variables like:
var remotingServer:String = "https://" + server + "/flashservices/gateway";


...especially for the remoting specific stuff.
Was This Post Helpful? 0
  • +
  • -

#3 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: Convert ActionScript 1.0 to 2.0: Remoting

Posted 19 January 2006 - 12:25 PM

... and... do you get any error messages in Flash? or just blank and doesn't work?
Was This Post Helpful? 0
  • +
  • -

#4 davetowers  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-May 03

Re: Convert ActionScript 1.0 to 2.0: Remoting

Posted 07 February 2006 - 09:47 PM

Hi,
The netServices class has now been deprecated and although it is still supported for the purposes of backward compatibility, the netServices.as and netDeBug.as files aren't included in the Flash 8 remoting components package.
I had the same propblem and had to decide whether to 'bite the bullet' and learn the new way or stick with the old as I was in the middle of a project when I got Flash 8.
Luckily in Flash 8 the help files are unusually (for Macromedia) very good: help>all books>Flash Remoting has two sections here.
Basically you need to import the following packages:

import mx.remoting.Service;
import mx.services.Log;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.remoting.PendingCall;
import mx.rpc.ResultEvent;
import mx.remoting.RecordSet;
mx.remoting.debug.NetDebug.initialize();

I found that I needed to import these for each service instance as the service wouldn't work otherwise. This is and extract from one of my apps which works, it calls a microsoft access database and the returning recordset is bound to a combo box called type_cb, I've left in the comments from my app but also added new ones:
//===================================
//var myService = new Service("http://127.0.0.1/flashservices/gateway",null,"put the path to your coldfusion file in here seperated by commas not slashes");
//====================================

// populate the boxes
// property types
var propCall:PendingCall = myService.getProp();// this is the service call

propCall.responder = new RelayResponder(this, "getProp_Result","getProp_Fault");

function getProp_Result(Result:ResultEvent){
DataGlue.bindFormatStrings(type_cb,Result.result,"#type#","#ID#")
type_cb.addEventListener("change",onType_Change);

}//end _Result
function getProp_Fault(Fault:FaultEvent){


}//end _Fault

Hope this has helped
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1