Creating a class for a Flash symbol in Haxe?
I am having trouble including graphic assets created in Flash with my Haxe code.
In Flash IDE, I created a symbol named link "MySprite"
. I will compile this into assets.swf
. I know that in order to use symbols in this .swf
from my Haxe code, I need to add the following option when using the Haxe compiler:
-swf-lib assets.swf
Now I would like to write a class with a name "MySprite"
that is associated with this symbol, for example:
class MySprite extends Sprite {
public function new() {
// ...
}
}
Basically, I would like to achieve something similar to the technique presented in this tutorial :
package {
import flash.display.*;
[Embed(source="assets.swf", symbol="MySprite")]
public class MySprite extends Sprite {
public function MySprite() {
// ...
}
}
}
It's not clear from the Haxe documentation if this can be done, or for the syntax for doing this.
source to share
I think so, but I'm not sure Haxe does not override classes from assets.swf
with the classes you declared. This was discussed on the mailing list (old, not google groups) and it was a decision ... I don't know why this decision was made.
You can still do this with SamHaxe . At least on the days I was able to. Unfortunately SamHaxe has been abandoned, and if there are bugs or something doesn't work the way you want it to, you're on your own. It's good that Sam is a relatively small project. It wrote in Haxe and I was able to build it from sources.
You can also try: http://code.google.com/p/hxswfml/ The project seems to be functional and the author used to reply to users. However, this can be a little tricky. I'm pretty sure it could have been done, but you may have to ask the author / figure it out yourself.