Skip to main content
New Participant
October 6, 2009
Question

AS2 to AS3 help please (hints or anything)

  • October 6, 2009
  • 1 reply
  • 967 views

Hello everyone,

I am a huge noob in flash, I am to change a code from AS2 to AS3, this function (is a display tracking) should send a request for a server, and load the movie after, please tell me how to change it, some alternatives, some hints, but remember, keep the level low.

var EMISJE = "http://server.com/_"+Math.ceil(Math.random()*1000000000)+"/id=234"; 

_root.MAI_catchEmision = function(url) {
if (_root.MAI_catchEmision_run == undefined || _root.MAI_catchEmision_run == false) {
_root.createEmptyMovieClip("MAI_catchEmision_target_mc",_root.getNextHighestDep th());
_root.MAI_catchEmision_run = true;
_root.MAI_catchEmision_target_mc._x = Stage.width+10;
_root.MAI_catchEmision_target_mc._y = Stage.height+10;
_root.MAI_catchEmision_target_mc.loadMovie(url);
}
}

Thank you very much

This topic has been closed for replies.

1 reply

Ned Murphy
Brainiac
October 6, 2009

I don't know what significance the first line has to the rest of the code, but it would not change.

var EMISJE = "http://server.com/_"+Math.ceil(Math.random()*1000000000)+"/id=234";

function MAI_catchEmision (url) {
if (MAI_catchEmision_run == undefined || MAI_catchEmision_run == false) {
  var MAI_catchEmision_target_mc:MovieClip = new MoiveClip();
  addChild(MAI_catchEmision_target_mc);
  MAI_catchEmision_run = true;
  MAI_catchEmision_target_mc._x = stage.stageWidth+10;
  MAI_catchEmision_target_mc._y = stage.stageHeight+10;
  var ldr:Loader = new Loader();
  var req:URLRequest = new URLRequest(url);
  var ldr.load(req);
  MAI_catchEmision_target_mc.addChild(ldr);
}
}

ghostly_1Author
New Participant
October 6, 2009

sorry fogot the last line:

_root.MAI_catchEmision(EMISJE);

so does this code work in AS3??

Ned Murphy
Brainiac
October 6, 2009

its an jpg file


I still have my doubts mainly because I  would epect to see a "jpg" somewhere at the end of that url in order for it to work, but if it somehow does deliver a jpeg image to the Loader, then it should work.  The only way to be sure is to try it, and that's up to you.