Source: Diadraw Blog

Diadraw Blog 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? We started with an introduction of what to expect from the series and how tutorials will be structured Then we laid some ground work and saw how ActionScript data is represented in C You have so far added the following auxiliary functions to your helper function library: sendMessage - a shortcut for sending events from iOS to AIR; isFREResultOK, which checks the FREResult returned by AIR C API functions; hasThrownException, which does another check: did your last call to an AIR C API throw an exception and if yes, what did that mean? setFREObjectProperty to help you change the properties of ActionScript objects on the native side of your ANE. 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 [crayon-577fe7bf1362e125012597/] 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: [crayon-577fe7bf1363b254362345/] Result Now you can read the hours property of a Date ActionScript object (represented by dateAS below) in your native code like this: [crayon-577fe7bf1363f388130931/] What's next? TODOThe post Reading properties of ActionScript objects in your iOS native code appeared first on Easy Native Extensions.

Read full article »
Est. Annual Revenue
$100K-5.0M
Est. Employees
1-25
CEO Avatar

CEO

Update CEO

CEO Approval Rating

- -/100