Translating between ActionScript and Objective-C

… and how to keep your cool while doing it.

So you took the cross-language rout of programming. It’s fun, it provides variety and it often feels as if you are a tour guide for families visiting each other’s countries. Done that in real life, trust me. You have several people tugging at your sleeve and asking things like “So what’s that in Canadian dollars?” or “I don’t speak ounces. Why won’t they use the metric system?!” Usually all at the same time, as everyone knows it isn’t impolite if you interrupt in a foreign language.

tour_guide_v5_text

 

When it’s two programming languages tugging at your sleeve, rather than well-meaning relatives, you find you initially spend most of your time working out how to translate different data types from one to the other and vice versa. The good thing about this is that it’s usually a one-off exercise and you gradually build a small library of tricks and shortcuts that make your life easier and the development – faster with each new project.

The goal of this series of tutorials is to share with you the library of tricks and shortcuts that we have built and to put wind in your development sails even on your very first iOS + AIR project.

How are the tutorials structured?

  • We will first see how ActionScript data is represented in C.
  • Next, we’ll have a look at some auxiliary functions that will be used throughout the rest of the tutorials to help with: sending events to ActionScript, checking FREResult, dealing with exceptions from FRE* functions, reading and setting properties of ActionScript objects on the native side.
  • Then we’ll introduce functions for converting numeric and Boolean types.
  • We’ll see how to work with strings.
  • How to work with date and time.
  • How to work with objects.
  • We will deal with containers like Dictionary, Set, Array and Vector.
  • If the tutorials generate interest, we can get into using byte arrays, JSON, dealing with image data.

Have a suggestion?

Let us know in the comments below.

Info: For a comprehensive data conversion guide and how to make it into a library download our eBook “iOS vs. ActionScript Data Types Guide”.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">