Archive for April, 2009
ActionScript ArrayCollection Binding and Event Dispatching
Posted by brianr in actionscript, flex on April 22nd, 2009
We hear this one a lot, so I’m throwing it out there as a reminder for new and old Flex and ActionScript developers…
You’ll get some new collection data say from a remote service and you simply update your model level ArrayCollection (”AC”) property by doing:
myModel.myAC = responseFromRemoteService.myNewAC;
And low and behold the objects that are either binding to it or listening for the change event don’t do anything??? What? How the? But I debugged it and I saw that the new data was getting stored in my model-level AC…how come this thing isn’t working? Stoopid Flex…bleh.
Well, it’s simply because setting the original AC to a new AC doesn’t implicitly fire off any change events (which is the underlying implementation for data binding as well.) In order to make this function as expected, one simply needs to set the source property on an AC like so:
myModel.myAC.source = responseFromRemoteService.myNewAC.source;
The source property in an AC is not only the underlying Array for an AC, but also fires off that change event (I believe it’s the listChanged type event) that’s so important to binding and anyone else listening for changes on that AC. Truth be told, this is actually done in the underlying ListCollectionView class that an AC inherits from, but that’s just details.
Installing Flex 3.3 SDK + Data Visualization 3.3 SWC
Posted by brianr in flex, flex builder on April 22nd, 2009
I’ve seen a number of people ask how to install the Flex SDK 3.3 + Data Visualizations 3.3 SWC, so I thought I’d give some quick direcetions since it’s not on Adobe’s download site for the Flex 3.3 SDK.
- Download both the Flex 3.3 SDK and the Flex 3.3 Data Visualizations Components (”DVC”).
- Unzip them both somewhere on your local hard drive — I have all my SDKs for Flex in ~/dev/flex/sdks/<versionNumber>.
- Navigate into the DVC folder you just expanded and find the following files:
- ../frameworks/libs/datavisualization.swc
- ../frameworks/locale/en_US/datavisualization_rb.swc
- ../frameworks/locale/ja_JP/datavisualization_rb.swc
- ../frameworks/rsls/datavisualization_3.3.0.4852.swf
- ../frameworks/rsls/datavisualization_3.3.0.4852.swz
- ../libs/DMV-source.jar
- Now that you know where they are what you need from the DVC SDK, copy each one into the corresponding folders for the actual Flex 3.3 framework that you expanded earlier. So on my machine, I’d copy the datavisualization.swc from the DVC SDK to the Flex SDK like so:
- ~/dev/flex/sdks/3.3/flex_sdk_3/frameworks/libs/datavisualization.swc
- ~/dev/flex/sdks/datavisualization_sdk3.3/frameworks/libs/datavisualization.swc
to
- To use the new 3.3 SDK for a particular project, open up Flex Builder and click Project -> Properties -> Flex Compiler and click on the link on the right to “Configure Flex SDKs…”
- Browse to the Flex 3.3 SDK you just finished unpacking and adding the DVC files to and click OK.
- You can select this new SDK as your default here or just select this as the SDK for this project.
- Done.
Xcelsius 2008 SP1 SDK Not Compatible with Flex 3.x SDK
Apparently you can’t use the Flex 3.x SDK to create custom components with the Xcelsius 2008 SP1 SDK — you must use the Flex 2.01 SDK. Maybe I just overlooked it, but I didn’t see anything in the Xcelsius SDK’s docs/tutorials that you said you must use the Flex 2.01 SDK, so I’ve been banging my head against my new desk wondering why my custom componets wouldn’t work…oh, and as a side note, the only way you know your custom components bomb is that they blow up Xcelsius, meaning most commonplace functions like File -> Open are disabled…no error messages, no warnings, nada…good stuff.
Since I didn’t see this info in the docs, I started googling issues and I ran across this blog post — Top 10 Xcelsius 2008 SDK FAQs — thanks for tip.
Mac + Mouse Wheel in Flex
The fact that I use a Mac and I couldn’t use my mouse wheel to vertically scroll on our own Flex-based corp web-site drove me nuts during development, so I spent a good amount of time researching the issue and found 4 major players with different solutions — these have been listed on a number of other sites, so I’ll just share the one I ended up rolling with and why…
It’s simple really. The other 3 were all more complex be it with additional, accompanying JavaScript files to deploy or integration issues with commonplace embedding scripts like SWFObject, etc…however, Matt Giger’s “Simple solution for MOUSE_WHEEL events on Mac” is really just that. It’s just one, simple AS class — MacMouseWheelHandler — that’s it. Drop this bad boy in your app and you’re ready to start wielding that Mac Mouse Wheel of yours!
Some Thoughts On Internationalization in Flex
Posted by admin in flex, resource bundle on April 9th, 2009
Looking to develop a list of best practices for making the internationalization process of Flex apps go smoothly.
So, here goes!
- Resource files need to be in UTF-8 format when you create them. That’s when you create them. If you put characters in a file such as an accent grave and THEN try to save as UTF-8, the saving process will munge the character. (Note: this is when working within the Eclipse IDE)
- Adobe doesn’t seem to want to supply the language references for you except for en_US and ja_JP. You need to build them for all of the frameworks side stuff as well as for your own implementations. And when you change versions of FB, guess what? You gotta do it all over again. I suppose you could try just copying…..no, forget that.
- Don’t expect that third party libs you use will have the language references you need. Hopefully, you’ll be able to get their source resource file and be able to translate and then build.
- Make sure the font sets you’re using support the languages/characters you’re using.
- Do read this excellent article.
- …more to come
Enabling Different Permalinks to Work
We recently made some changes to the layout of our blog. In doing so, we chose to enable something other than the default permalink structure and suddenly we couldn’t see any pages. After a bit of searching, I stumbled across the fact that it was this change that was making things go awry.
But why could I get the other settings to work?
A few things that need to be in place when you want to use a different setting:
- Ensure that mod_rewrite is enabled. This will be in your httpd.conf file
- Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines)
- Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound ‘#’ sign from in front of the line)
- Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.
- Also, need to check that the individual .htaccess files you have out there are enabled. If AllowOverride is None then they won’t get picked up
<Directory />
Options FollowSymLinks
AllowOverride All - Should also enabled in the web directory specifically
<Directory /var/www/html>
AllowOverride All
</Directory>
Your mileage may vary based upon the server/host/etc you use but this should get you most of the way there.
In order for wordpress to use the permalinks capabilities, you also need to make sure you have a .htaccess file in your /wordpress root. If there isn’t one there, log in via shell to that root and do ‘touch .htacess’. Ther perms should be 755 at least. When you go to the Settings->Permalinks page on your WP Admin, hitting the Save Changes button will cause the mods to get written to this file.
iLog Elixir Components Pricing
So you’re bored of the plain-jane, out-of-the-box charting components for Flex and you want to spice it up with gauges, heat maps, and 3D charts, so you check out iLog’s Elixir Data Visualization components and you say — WOW, this is exactly what I’ve been looking for!!! Now take a deep breath and read the next line:
Although the company provides a free developer environment, with watermarks mind you, the full developer environment is a whopping $799!! It gets worse. If your client has net revenue of over $5 million per year, pricing can start at $15K per year!!
Isn’t the entire Adobe CS4 suite <= $1000??? And that’s like 10 products…
