Why most of open-fl samples use flash package, but not open-fl package itself?

In open-fl samples like pirate-pig, most of the packages being used are having root as flash eg.

flash.display.MovieClip
flash.events.Event etc.

While when i see a port of away3d into haxe, eg. View3d.hx , they use openfl package as root eg.

openfl.display.Sprite
openfl.events.Event

So, what is the difference ? Can they be used interchangeably ?

Maybe this needs to go in an FAQ, because it keeps coming up.

Short answer: they can usually be used interchangeably, but openfl is preferred.

This was made consistent a while ago:

https://github.com/openfl/openfl-samples/blob/master/PiratePig/Source/piratepig/PiratePig.hx

Originally, OpenFL favored the flash namespace, but a while ago (when OpenFL 2 was released, I believe) it was changed to favor the openfl namespace instead. It’s still backward compatible, but this allows for cleaner/better code completion, better consistency across all targets and better clarity about what you are using, and what features are available :slight_smile:

2 Likes