Archive for the 'Flex 2' Category

The State of the RubyAMF State of the Union

I've been slowly considering the use of RubyAMF in a couple of new Rails projects. By "slowly" I mean that there have been some more pressing projects that have prevented me from really "diving in" and experimenting with RubyAMF; only leaving enough time to read some docs and follow the Google Group.

Consider my previously stated credentials when I say that RubyAMF looks great. Given the following recent events it appears that the project has a lot of momentum:

  • Restful Rails integration by use of the respond_to block
  • Mixbook's adoption (especially the Aaron & Aryk collaboration that led to huge performance gains)
  • Peter Armstrong, the author of Flexible Rails has adopted, contributed to, and promoted RubyAMF over WebOrb
  • Creation of new Rails generators
  • and more I'm not aware of...

The latest RubyAMF blog posting, RubyAMF State of the Union (doubly posted on the Google Group) is basically a well-structured "rally the troops" announcement to the community. The project founder, Aaron, is moving on to some new projects leaving it to the community to keep up the momentum. I'm happy for him. I can't imagine how time consuming the almost-sole development of RubyAMF has been. This is the real test. How will the project fair on the shoulders of the community?

(Remember: I'm not in the know on the project, I'm seeking your thoughts and opinions, and for good times I'll pull out the good ole' "Jump To Conclusions Mat.")

It's too early to tell for sure, but from my point of view I'm a little disappointed (imagine me hypocritically pointing) with the lack of any community responses to either the blog post or the Google Group post. I say, "my point of view" because I'm hoping that there have been responses and things working that I'm unaware of.

One week ago RubyAMF had good momentum with a promising future. Is that still true today? Is it a bad time to start using RubyAMF?

FlexFM

FlexFM is an open source project created by the folks at Soliant Consulting as an alternative to Flex4Filemaker. This is great news! It's not that I wish Flex4Filemaker to die, but it wasn't setup for success from the start. Flex4Filemaker was created by my lonesome self as a favor with zero (afaik) production usage. I had hoped that someone/s would join in the project, but that never happened.

I am officially discontinuing development of Flex4Filemaker. I will not remove the project from google code, as I think at the very least it could be used for reference.
FlexFM is setup for success with big plans for continued development. I would highly recommend anyone interested in Flex4Filemaker to take a good look at FlexFM.

Flex4FileMaker - New Open Source Adobe Flex 2 API to FileMaker

There's a new API in town... one that you probably don't know or care about, but...

Well... that's all I've got. Lets try again...

Flex4FileMaker is a new Google Code project that currently allows an Adobe Flex 2 client to access a FileMaker database via the FileMaker Web Publishing Engine. By modeling Flex4FileMaker after the FileMaker API for PHP and leveraging Adobe Flex 2, the library accomplishes it's primary goal of enabling FileMaker developers to inexpensively build new, distributed, "cutting edge" user interfaces to new and existing FileMaker databases.

Some things to consider:

  • The project is young.
  • Flex4FileMaker currently only provides "find" capabilities. (Feel free to join in and help grow this)
  • Columns/properties of resulting Record instances are accessible via "dot" notation
    • aRecord.column_name
    • aRecord.JoinedLayoutName.column_name is equivalent to JoinedLayoutName::column_name
  • Flex 2 applications using Flex4FileMaker are subject to Flash Player's Security sandbox rules
  • The XML result set parsing works, but is probably not the most efficient and should be refactored.
  • Although FileMaker.as constructor accepts a username and password, I wouldn't recommend embedding database credentials in a compiled SWF, but rather accept credentials in the application.

The compiled library can be downloaded and the source is available primarily from the Google Code SVN repository, but has also been published for viewing.

Many thanks to Abdul Qabiz for publishing his HTTPURLLoader that facilitates BASIC HTTP Authentication.

Click here to launch an example application using Flex4FileMaker. Right-click on the application to view and download the source or alternatively download the entire FlexBuilder project source here or from SVN

Enjoy!

Adobe Flex 2 SDK Source Available

If you've got the Flex 2 SDK, then you've got the source; at least most of it. It's nothing new, but I don't think it's well known. The source can be found at [Flex SDK Install DIR]/frameworks/source. If you've never downloaded the SDK by itself and only use FlexBuilder, then you'll find the SDK under your FlexBuilder install directory.

I point this out because I've imported the source into FlexBuilder for easy reference and code navigation. If you're curious how the Flex team does something, then now you know.

Enjoy!

The Well-Behaved ActionScript 3 Enum

ActionScript 3 doesn't have an enum language construct built in, but that doesn't mean that you can't create your own. That is an enumerated value that is an object with behavior. It's not rocket science, but I've included my attempt to mimic an earlier post, "The Well-Behaved Java 5 Enum." There are some things you should note while viewing the source:

  • There is no such thing as a "private" constructor in AS3. Several work-arounds have been introduced and discussed on other websites. This source doesn't include any of these, but also doesn't prevent someone from including it in their own.
  • Comparing the MenuItem.as to MenuItem.java (in the previously mentioned post), you'll notice that the AS3 version doesn't include the DOUBLE_CHEESE_MEAL value. The AS3 version doesn't allow "inline" overriding of definitions as does the Java enum. I would think it's possible to do in AS3 (passing a function to the constructor orsomethinglikethat), just not the same as in Java 5.
  • I've also added a public static const values:Array which is an array of the defined values - This provides similar benefits as the Java 5 Enum.values() method, but unlike Java, it requires developer maintenance.

It's far from perfect, but please feel free to correct/comment as you like.

Flex 2: How to get URL query-string variables within Flex application

This has been a reoccurring problem on flexcoders and in the small circle of Flex developers I know. It is a problem that I had encountered and thought that I had found an answer; Abdul Qabiz's Blog posting (duplicated) had described a (in his own words) "quick-and-dirty" solution. That method works well for pulling the String value of the parameters passed in the query-string, but what do you do when those values are URL Encoded? Below is my (and I use my very loosely as it isn't much to claim) solution that provides similar behavior as described in Abdul's posting, but requires significantly less code and is much more readable:

Source and Usage

Given the URL:
http://deepthoughts.orsomethinglikethat.com?myParam=My%20Value

the return value is "My Value".

This may not be the ideal solution if the URL is pointed directly to the SWF or if you choose to make your parameters available via FlashVars.

Flex 2: addExternalEventListener( … )

I've recently been looking for a way to invoke an ActionScript/Flex function based on a browser event… say window.unload (orsomethinglikethat). The ability to hook into Application creationComplete is present, however I am unaware of any built-in Flex/FlashPlayer unload/shutdown hook points.

I’ll now turn my attention to letting the browser notify the Flex Application of events. There are a couple of ways to accomplish this, both of which involve using the flash.external.ExternalInterface.addCallBack() to expose a Flex function to the containing browser:

    • Embed or import JavaScript in the Flex application’s HTML wrapper to hard code the browser event handlers to invoke the exposed Flex callback functions.
    • Assign the browser event handlers in the Flex code.

Both options have a time and place, but for my purposes, I’ll choose the latter option. I prefer not to maintain additional JavaScript and/or custom HTML wrapper code, and ideally I’d like to be able to directly map a browser event to a Flex function.

Source and Usage

Steps #1 & 3 are uninteresting and strictly interact with ExternalInterface.
Step #2 is a bit more interesting as it involves constructing the JavaScript statement that binds the browser event to the callBackAlias.
Since ExternalInterface.call() uses the functionName parameter as a pointer to a function that has been defined in the tag, it is not possible to pass in a String of JavaScript as we would with the JavaScript eval() function. Instead we “wrap” our JavaScript in an anonymous function to be executed upon ExternalInterface.call() invocation. The script we have just “wrapped” assigns the browser event handler to another anonymous function that contains the script to invoke the provided Flex callBack function by the provided alias.

Categories

  • Blogroll

  • Monthly Archives