QuicksearchArchives |
Friday, January 25. 2008AS3 and RSL
Runtime Shared Libraries have been quite a puzzle for me for some time now. Here are a few problems that I solved:
Exporting an imported asset When in AS3 you want to import an asset from a swf, you get it by its linkage name. What if this asset needs to be imported from another swf? Flash only allows you to import OR export an asset for Runtime Sharing. Simple: in Flash, encapsulate the imported asset in a MovieClip, and export the parent clip with a different linkage name. Load swf with RSL dependencies If you use the Loader class to load assets into your AS3 app and the source swf has RSL dependencies, the Loader might not fire a COMPLETE event. Although you expect your app to go look for dependencies in the path relative to your source swf, it actually looks for it relative to the app. Since it doesn't find it, your app has unpredictable behavior. Solution: move shared.swf to root, make an alias in root or change the linkage path in myassets.swf (might be tiresome). Here is an example:
myapp.swf is an AS3 app that loads myassets.swf myassets.swf imports assets from shared.swf using the path "./shared.swf" myapp.swf will look for dependencies in "root/assets.swf", because that is the folder that contains the app. Solution:
It took me a long time and a bit of luck to figure it out. Hopefully you will benefit from it. Thursday, January 24. 2008Working with types in AS3
ActionScript 3 is strong-typed, which is great to detect possible errors at compile-time. Here are a few tips for working with types.
Type wildcard var someVar:*; This is not recommended (can cause runtime errors) but is possible. I suggest using a common parent (DisplayObject, for example) whenever possible. Type checking if (someVar is MovieClip) {}This is most useful. Example: getting the list of MovieClip children from a parent MovieClip (you don't want shapes and all). This line might prevent the whole app from blowing up in your face. Type casting var item:Object = ComboBox(event.currentTarget).selectedItem; This will prevent type-mismatch complile errors. The same applies to simple types, such as int and uint. Wednesday, January 23. 2008Touchless interface
Here is a really cool, futuristic interface (remember Minority Report?). It uses IR emitting gloves, Wiimote and Flash.
|
CategoriesSyndicate This BlogBlog Administration |
Powered by s9y - Design by Anna Filina