Skip to main content
Inspiring
February 10, 2009
Question

How do you convert this code from AS3 to AS2?

  • February 10, 2009
  • 3 replies
  • 341 views
Hi,
I created some AS3 code that is working perfectly for us. However now we need to convert it to AS2 so that it can be Flash Player 8 compatible. If it could also be compatible for Flash Player 7 that would be ideal but not a requirement.

Thanks in advance.
This topic has been closed for replies.

3 replies

Craig Grummitt
Inspiring
February 11, 2009
i'm sorry i've not seen partigen before and don't know enough about what you're trying to do to comment. So I'll pass on that one! (Others feel free to answer)
Inspiring
February 11, 2009
Thanks these tips should definitely get us the right track.
We know how to do this in simpler situations.

My only other question is would you recommend an AS2 compliant plugin like Partigen as a better approach to dealing with particles before AS3?

Thanks again!
Craig Grummitt
Inspiring
February 11, 2009
Are you wanting someone to do the conversion for you, or are you asking for general tips for doing the conversion yourself?

i can give you tips:

have a look at the ActionScript 2.0 Migration page.

In this you'll find the property conversions eg(going from AS3 to AS2). y becomes _y, height becomes _height, scaleX becomes _xscale, void becomes Void etc.

you'll find that events need to be converted, eg.
particle.addEventListener(Event.ENTER_FRAME, animateParticle);
becomes:
particle.onEnterFrame=animateParticle;

the onEnterFrame class doesn't pass an Event parameter to the event listener. Instead, the event listener is automatically in the scope of the event dispatcher, so instead of 'event.target' you will be able to just target 'this'.

You'll need to use setInterval() instead of the Timer class.

You'll need to use attachMovie() instead of addChild().