22 juil. 2013

OpenFL : Embedding a MovieClip with timeline

With the latest versions of OpenFL, the Assets Class works great but if you use it for a swf containing a MovieClip with a timeline, you can't use your mc properly (currentFrame, totalFrames ... does not work).

Has it took me a lot of time to figure it out, I'm copying here a solution that I found from the creator himself : http://www.openfl.org/forums/general-discussion/openfl-problems-swf/

The trick is to put
<haxeflag name="-swf-lib" value="path/to/your.swf" if="flash" />
in your build file.
Then, you can use it like this :
import MovieClipName;
var mc = new MovieClipName(); 

With HaXe and FlashDevelop, it's somehow easier as you can right-click on your lib and select "Add to library ..." and it will change the build command for you.

Aucun commentaire:

Enregistrer un commentaire