Reading properties of ActionScript objects in your iOS native code

In this instalment of our Translating between ActionScript and Objective-C we add the mirror function of the one you implemented for writing properties of ActionScript object: now you will see how to read ActionScript object properties in your native Objective-C code.

What was covered so far?

What will this part cover?

Being able to read an ActionScript object’s property in your C code is just as useful as being able to set it. Both the object we read from and the property we read are wrapped in FREObject. The helper functions you will define in the next articles will help you convert the value of the FREObject property to a native type: int, NSString, etc.

The AIR C API call to note here is FREGetObjectProperty.

The implementation

You can throw in more convenience functions, as you need them, to not only read a FREObject’s property, but to get the result as a native type. For example, you will find the need for this one in the next articles:

Result

Now you can read the hours property of a Date ActionScript object (represented by dateAS below) in your native code like this:

What’s next?

TODO

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

Warning: count(): Parameter must be an array or an object that implements Countable in /home/easyna6/public_html/easynativeextensions_wp/wp-includes/class-wp-comment-query.php on line 399

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="">