Skip to main content
Participant
January 31, 2013
Question

Could someone help me to convert this AS3 into AS2 please?

  • January 31, 2013
  • 1 reply
  • 308 views

I'm really new to AS3 and I built my first clickable menu thingy a few weeks ago. But the system the SWF needs to play through doesn't allow AS3, which is not something I was told before writing it. I'm only just muddling through AS3, so converting this to AS2 is proving really tricky. Can someone help please? I've tried a few things but nothing works, so a point in the right direction would be great! Thanks!

lightingButton.addEventListener(MouseEvent.CLICK, addlightingpopup);

var movieClipLight:LightingPopup

var buttonCloseLight:Close

function addlightingpopup(event:MouseEvent):void

{

  movieClipLight = new LightingPopup();

  _visible(movieClipLight);

  movieClipLight._x = 500;

  movieClipLight._y = 240;

 

  buttonCloseLight = new Close();

  addChild(buttonCloseLight);

  buttonCloseLight.x = 820;

  buttonCloseLight.y = 56;

 

lightingButton.removeEventListener(MouseEvent.CLICK, addlightingpopup);

buttonCloseLight.addEventListener(MouseEvent.CLICK, removelightingpopup);

}

var movieClipLightComplete:CompleteIcon

function removelightingpopup(event:MouseEvent):void

{

  movieClipLightComplete = new CompleteIcon();

  addChild(movieClipLightComplete);

  movieClipLightComplete.x = 830;

  movieClipLightComplete.y = 48;

 

  removeChild(movieClipLight);

  removeChild(buttonCloseLight);

  movieClipLight = null;

  lightingButton.removeEventListener(MouseEvent.CLICK, removelightingpopup);

  buttonCloseLight.removeEventListener(MouseEvent.CLICK, removelightingpopup);

}

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
January 31, 2013

The closest thing to creating a dynamic instance of an object in AS2 would probably be to use the attachMovie function/method to add an object from the library.  The removeMovieClip function is used to remove it.  If you search Google using terms like "AS2 attachMovie" you should be able to find a tutorial to help you thru whatever you need to do.