Steps for accessing your AnimateCC textfield in OpenFL

Categories AnimateCC, game development, games, HTML5, OpenFL
  1. I am using the OpenFL extension for AnimateCC (the one found here).
  2. I embedded the font in AnimateCC *
  3. In the project.xml file I have added “<assets path=”Assets/fonts” rename=”fonts” include=”*.ttf” /> “
  4. If the textfield is in another MovieClip, you need to export this one as a class for ActionScript too.
  5. In the Assets/fonts folder I have added the .ttf font file used in AnimateCC.

That’s it, you can now do the layout and animation in AnimateCC, including the dynamic textfield.

In case you need to know how to use you Layouts/Animation from AnimateCC, here is the other part:

Any MovieClip that you want to use in OpenFL, you need to export it as a class for ActionScript. For example in my setup, I have a main MovieClip with my game background, then I have multiple MC that contains the textfield I want to be able to change in Haxe. Each MC with the text is the same symbol, so I only copy what I need, arrange it around the stage area and give each one a different name.

For example my main MC, is exported as a class for actionscript with the name EqMc, to access it, I create a new instance in Haxe using var eq:EqMc = new EqMc();

Inside the main MC, there are smaller MCs with the text, that are named eq0, eq1 etc. Inside them is a the textfield I want to control, named tf. So to change the text in one I only have to do eq.eq0.tf.text = “my text”;

You could do this in code, but having the AnimateCC for the visual design cuts the development time. Not to mention all the nice effects you can now do.

Happy OpenFL developing 🙂

*it appears to work even without this step.

Share this
Facebooktwitter