05 Aug, 2008
Posted by: jason In: All
With the Flash / Flex community buzzing about Adobe’s partnering with the PHP Zend framework, Lee Brimelow has put up two fantastic introductions to using AMFPHP within Flash at theFlashBlog.com. Both of the video screen cast are geared towards getting developers familiar with using AMFPHP, and as usual are quick, to the point, and efficient. Absolutely worth a look.
Jason
25 Jul, 2008
Posted by: jason In: All
I’ve been using the Flex Integration Kit to create my own custom components in Flash for use in Flex lately. Coming from an all ActionScript (not necessarily MXML) background there are a few things to watch for. One of them being Custom Events in your newly created component.
In order for Flex to recognize your Custom Event you need to include the event meta data in your AS Class file. For example, in an AS setting your class could fire off an event like so:
private function updateHandler(e:MouseEvent):void
{
var evt:MyEvent = new MyEvent(MyEvent.VOLUME);
evt.volume =//some volume value;
this.dispatchEvent(evt);
}
In an all ActionScript setting this works fine. However when you compile this UIMovieClip into a swc file and use it in a Flex Project, Flex has no way to recognize the MyEvent.VOLUME. In the Flex Editor it won’t appear as a code hint. If you manually force it into the MXML, you’ll get an error. In order to allow Flex to know of the event you will need to include some Event meta data at the top of your ActionScript Class. For example:
[Event (name="volume", type="com.knomedia.events.MyEvent")]
public class VolumeControl extends UIMovieClip
{
//Class members here
}
The meta data needs the ‘name’ of the Event. This is the string literal that the event constant holds. In this case MyEvent.VOLUME holds the value “volume”. The type attribute is the fully qualified name of your Custom Event Class. The placement of the meta data is important, it needs to be on the line above your class declaration. Once you have that in place you can compile your swc.
My only beef with the technique is that you need to use the actual string literal. I understand the need (for ease of use in MXML), but I am more comfortable using class constants of the Event Class… Anyway.
In MXML you can now set the volume attribute to listen for the event to fire:
<swc:VolumeControl id="vol" volume="{volumeHandler(event);}" />
The switch from all ActionScript to MXML is pretty painless. Occasionally a small issue like this will make you feel stupid, but overall it isn’t a big jump.
Jason
23 Jul, 2008
Posted by: jason In: All
I put together a simple AIR app in Flex for a co-worker the other day. It’s a simple panel that allows the user to enter a number in any form (binary, octal, decimal, hexadecimal) and it will display all of the other number types for you. At first I didn’t think it was all that useful. But in a recent project I needed to double check that a value that I had entered as hex was correct. When I traced out the value, the output window displayed it as a decimal number… Hey, my little app came in handy!!! I thought I’d make it available.
The icons were made using Clockmaker Icon Generator another widget type AIR app.
One of the things I love about AIR and Flex is how quickly you can put together a simple little ‘widget’ type of app like this. As I continue to learn more and more about the Flex framework, the more I’m liking it.
You can download the application using the install badge below. (If you haven’t seen it yet, you should check out Peter Elst’s AIR Badge WordPress plugin)
Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.
jason
23 Jul, 2008
Posted by: jason In: All
Capitan’s log July 23, 2008
Getting the blog started today. I should be working on a current freelance project, but I’ve wanted to get the blog started for some time now. Plus I needed a break to let my brain chill out a bit. I would post the usual junk about my intentions with the blog… blah blah blah. As I come across issues, and more importantly solutions to flash / flex / actionscript development, I’ll post them. How about that?
jason madsen