Jul 22, 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.

Jul 15, 2013

Using FlashDevelop with Openfl

Just to make things clear, OpenFL is the sequel of NME. NME is working great with HaXe 2 and latest versions of FD but if you want to make FD, HaXe and OpenFL working hand in hand this is the trick :

  1. Install HaXe and Neko http://haxe.org/download
  2. Install the latest beta version of FlashDevelop http://www.flashdevelop.org/community/viewtopic.php?f=9&t=3529 It's 4.4.3 right now.
  3. You need to tell FD where the hell is HaXe. Go in Tools>Program Settings. Under HaxeContext, you have Installed SDKs. Click on the 3 dots
  4. Click Add and on the Path field, add the path to your HaXe install folder (might be something like C:\HaxeToolkit\haxe)
  5. Now you can build HaXe projects. To install OpenFL, I'm using haxelib. So open the Command Prompt. You can even do it from FD!
  6. Make sure you have a lib folder in your HaXe folder and type haxelib install openfl. Then haxelib run openfl setup. It might needs other libraries: haxelib install actuate, haxe install swf.
  7. Now you can go to Project>New Project... Under the HaXe section, you pick OpenFL project
  8. Press F5 to test and BOOM, it WORKS! (I sincerely wish it)