rss
twitter
    Find out what I'm doing, Follow Me :)

Ping Me!

Following on the heels of Ray's, announcement, 'ping' is also now available for All Your Flex Are Belong To Us

To ping AYFABTU, all you need to do is set up your blogging software to ping :

http://www.allyourflexarebelongtous.com/ping.cfm?BURL={your blog URL}

Where {your blog URL} matches exactly as it is stored in the DB.  To find out the exact URL we are using, simply look up your blog on the Feeds Page.

AYFABTU Update

It seems that some people have been taken aback by the length of the domain name, AllYouFlexAreBelongToUs.com, for the new Flex blog aggregator.  Well, thanks to Scott Pinkston, fear no more, you can now access ATFABTU by using flexbloggers.com as well.

Thanks, Scott!

New Flex Aggregator

I would like to announce that I am throwing my hat into the aggregator ring by launching All Your Flex Are Belong To Us.  This aggregator uses the same code base used in ColdFusion Bloggers and will, for now, aggregate blogs which discuss Flex (It's possible I may add blogs which discuss AIR as well).  The code was used with the permission and blessing of Ray Camden.

I would like to thank Ray and Dan Wilson for helping me come up with the name.  I know its a bit long, but I think it is easy to remember.

Doing 'screenshots' in Flex and sending them to ColdFusion

This weekend I was doing some research about capturing 'screen shots' of a Flex application, or even specific UI components, and passing the 'image' back to the server for processing.

While there are a few ways to do this, I am going to discuss the 'easiest'.  Using the JPGEncoder class packaged as part of the AS3 CoreLib on Google Code. Using this class to encode the data on the client side means that very little needs to be done server side to save the data as an image.

Its fairly easy to use this encoder to create binary data and pass it to CF.  I have set up an example here. If you enter some text into the text area inside the panel and click 'Send Image', Flex will create a JPG of the panel and send it off to CF.

Here is a look at some of the code, you can also view the source from the Flex application.

First, I import the JPGEncoder class. I store a lot of AS libraries and components in one location and add them to the 'source path' of my application.

view plain print about
1import com.adobe.images.JPGEncoder;

Next, I create a method that converts a UI component into BitmapData.

view plain print about
1private function getBitmapData(target:UIComponent ) : BitmapData        {            var bitmapData:BitmapData = new BitmapData(target.width, target.height);            var matrix:Matrix = new Matrix();            bitmapData.draw(target, matrix);            return bitmapData;        }

As you can see, this method can take any UI element as an argument. This method returns the bitmap data of the UI element that was passed in.

Next, I create a method that handles calling the above method, and then sends the result to ColdFusion:

view plain print about
1private function sendImage(target:UIComponent):void{            var bitmapData:BitmapData = getBitmapData(target);            var jpgEncoder:JPGEncoder = new JPGEncoder(90);            var imgData:ByteArray = jpgEncoder.encode(bitmapData);            imageService.saveImage(imgData);                     }

This method also takes any UI element and uses it when calling getBitmapData(). It also creates an instance of the JPGEncoder class.  The '90' that is passed into the constructor of JPGEncoder is the 'quality' of the resulting JPG.

Next we need to create a<mx:remoteObject> to talk to ColdFusion.

view plain print about
1<mx:RemoteObject id="imageService" showBusyCursor="true" destination="ColdFusion" source="path.to.cfc">    <mx:method name="saveImage" result="onResult(event)" /></mx:RemoteObject>

The CFC itself is very simple, it contains 1 method whose only argument is the binary data that is our image.

view plain print about
1<cfcomponent name="Image Service" displayname="Image Service" output="false">    <cffunction name="saveImage" access="remote" output="false" returntype="any">       <cfargument name="data" type="binary" required="true" />       <cffile action="write" file="c:\Temp\flex_image.jpg" output="#arguments.data#"/>    </cffunction></cfcomponent>

You will see that inside the method all we do is a <cffile> to write the data to a file. 

Lastly, we need some code that will fire off this entire event inside our Flex application.

view plain print about
1<mx:Panel layout="absolute" id="panel" title="My Title" width="400" height="400">        <mx:TextArea left="5" top="5" bottom="5" right="5"/>    </mx:Panel>    <mx:Text text="Enter some text in the text area above and click 'Send Image'" />    <mx:Button label="Send Image" click="sendImage(panel)" />

In my online example I  have other code that will open a new browser window and show you the image you just captured.  You can view the source by right-clicking the application and slecting 'View Source'.

Using this technique, you can do a screen shot of your entire application, or just individual UI components.

I Have Pownce Invites

I have 7.   If your interested, leave a comment, the first 7 (if I even get 7 responses) will get one.

Scottish ColdFusion User Group Preso

I will be giving a presentation to the Scottish ColdFusion User Group (SCFUG) this evening/afternoon (depending on where you live) at 8:PM GMT (3:00 PM EDT).

The presentation will be on Filtering and Sorting Data in Flex 2.

For more details, visit the SCFUG web site.

Hope to see you there!

Alagad is hiring...again!

As Doug notes here, Alagad is looking for one or two senior level developers who have experince with ColdFusion, Flex and other Adobe products.

I have only been with Alagad for a few weeks, and the fact that we need more talent already shows me the company is indeed growing quite nicely. And Doug is a great guy to work for/with.

Check out Doug's posting for more details on what Alagad has to offer.

Flexmaniacs was great!

The past Monday and Tuesday, I had the opportunity to attend and speak at Flexmaniacs.  Flexmaniacs was the first Flex-centric conference held on the East Coast. The conference was hosted by Fig Leaf Software in Washington DC.

If you have a cursory interest in learning Flex, or want to take your Flex skills to the next level (regardless of what level you are currently at), you will want to attend Flexmaniacs next year.  

Being a first year conference, there were some hiccups, but I did not hear any attendees complain.  The topics covered spanned across all skill levels.  There were sessions for n00bs, there were sessions for the mid level developer and even sessions for expert level developers. This is the first technical conference that I attended that had such a even mix of subject matter.

Steve, Courtney and the rest of the Fig Leaf staff should be commended for doing such a great job.

Off to Flexmaniacs, then CFUnited

I am getting ready to make the hour or so trip down to Washington DC for Flexmaniacs. If you have not heard of it, Flexmaniacs is the first Flex-centric conference on the East Coast.  I am giving two presentation during the 2 day conference.  My session topics are 'Printing in Flex 2' and 'Sorting, Filtering and Paginating Data in Flex 2'.

After the conference ends on Tuesday, I will be heading up the road for CFUnited. As I mentioned here, there were some scheduling issues with my 'Prototyping Applications in Flex' session.  TeraTech has graciously given me a 'Birds Of a Feather' (BOF) session on Wednesday night, at 9:00 PM, to discuss the materials which would have been presented during the originally scheduled time slot.

Its going to be a busy, but fun week.  Hope to see you at one or both of the conferences!

CFunited Presentation

After reading Sean Corfield's recent entry about the limited seating sessions at CFunited and this recent CFUnited Blog Entry, I felt I should let people know that due to circumstances beyond my control, I will not be presenting the session titled "Prototyping Applications in Flex 2".  I am not certain at this time who will be presenting this topic.

I will, however, still be in attendance at CFunited, so I hope to see you there.

Previous Entries / More Entries