Author Archive

Rotate Effect and Non Embedded Fonts in Flex 4

Thursday, September 25th, 2008 by Greg Jastrab

One big improvement in Flash Player 10 is that fonts no longer need to be embedded in order to rotate text or alter it’s alpha. Below is a simple example demonstrating both of these features by using the Rotate and Fade effects in Flex 4.

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Check out how simple the code is below!

(more…)

Migrating Serialization Changes Within an AIR Application

Thursday, September 11th, 2008 by Greg Jastrab

I just submitted my entry to the AIR Cookbook for the AIR Cookbook Cook-off.

It solves the problem of having your AIR application store an IExternalizable class on disk but then later adding more fields to that class. How would you read the old version of the class without encountering a runtime error if you tried to read the new field that wasn’t present in the older serialization?

Go check it out the cookbook entry to find out how to do this and please rate the article!

Serialization Error/Bug When Using a ByteArray and readObject in an IExternalizable Class?

Wednesday, August 27th, 2008 by Greg Jastrab

I’ve encountered some odd behavior that I would have expected to work when calling readObject() to de-serialize an array of anonymous objects. If anyone knows what’s going on here, please enlighten me. I’ve also filed a bug on Adobe’s bug tracking system if anyone wants to follow the progress at Adobe’s end.

I’m trying to read all of the bytes in the readExternal() function of a class implementing IExternalizable, so that I may use the position property to move back in stream in case I need to do so. The problem only seems to occur if I am trying to de-serialize an Array of anonymous objects. If I put plain old Strings in the Array it will work fine. I find this odd since I would expect

public function readExternal(input:IDataInput):void {
  var arr:Array = input.readObject() as Array;
}

to have the exact same behavior as:

public function readExternal(input:IDataInput):void {
  var ba:ByteArray = new ByteArray(); 
  var inputBytes:uint = input.bytesAvailable;
  input.readBytes(ba);
  var baBytes:uint = ba.bytesAvailable;
  var arr:Array = ba.readObject() as Array;
  trace("inputBytes == baBytes ?= " + (inputBytes == baBytes)); // traces "inputBytes == baBytes ?= true
}

AIR installer and code attached below… (more…)

Recreating Ely’s Flex 4 List Component Series: Part 3 - Adding Transitions

Saturday, August 23rd, 2008 by Greg Jastrab

In Part 2 we added hovered and selected states to the ItemRenderer for the list items. In this part we’ll add some transitions to make the list look more like an Accordion. Since screenshots won’t do the example justice this time, I’ll show a screencast I made demonstrating the result first:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
(Sorry for the embed being cutoff, still figuring out the params to this word press plugin. Click through for the full embed on its own page.)

Keep reading for the source…

(more…)

Getting Subclipse to Work in Gandymede (Eclipse 3.4)

Thursday, August 21st, 2008 by Greg Jastrab

I just upgraded Eclipse to 3.4 (Gandymede) since the latest upgrade to Flex Builder included support for Gandymede. I did my typical install by extracting the Gandymede tarball and then installed Subclipse through the Software updates (now in Help -> Software Updates…).

It looked like everything installed okay but then when I tried to do an update in an existing project I got an error:

"Unable to load default SVN Client"

The key is to include the SVNKit Adapter JavaHL Adapter when you install Subclipse:

Include JavaHL when installing Subclipse.

Include JavaHL when installing Subclipse.

Hope that saves some people some time.

NOTE: Thanks to Mark for pointing out the recommended usage of JavaHL instead of SVNKit!

Recreating Ely’s Flex 4 List Component Series: Part 2

Tuesday, August 19th, 2008 by Greg Jastrab

In Part 1 of this series we learned how to create an ItemRenderer for a List in Flex 4. I wanted to get through 2 steps tonight, but only have the code for the next step finished. This code creates the item renderer seen at ~4:20 of Ely’s video.

(more…)

Recreating Ely’s Flex 4 List Component Series

Saturday, August 16th, 2008 by Greg Jastrab

If you haven’t seen Ely’s video on Adobe TV about improving the designer/developer workflow (which is an updated version of what he infamously previewed at MAX last year), you should probably check that out to see what the goal of this series is.

I’m going to attempt to go through the steps and recreate what he demonstrated, which was to take a simple list and iteratively transform it into a rich, accordion-like interactive list. To get started, be sure that you’re setup to compile Flex 4 code and that you have Flash Player 10. Here we go…

(more…)

Creating Your First Custom SkinnableComponent in Flex 4

Saturday, July 19th, 2008 by Greg Jastrab

It took me a couple of days to get to my next Flex 4 example, but here we finally are. I wanted to try making a component which had optional SkinParts, so I came up with the following example (get the source). For those who don’t know, Flex 4 targets Flash Player 10 so you’ll need that in order to run the SWF.

In this example we will build a component called QuestionAndAnswer which will include a text field containing a question, a check box, and a text field containing an answer to the question. The check box and answer are both optional, so if the Skin file doesn’t include those SkinParts, they won’t be a part of the view. If they are included, then clicking the check box will show the text field containing the answer. Let’s see what the code looks like.

(more…)

Creating a Custom Layout Class in Flex 4

Wednesday, July 16th, 2008 by Greg Jastrab

So apparently I’m giving a week long series on getting started with Flex 4. I would have titled my content as such, but I guess I wasn’t sure if I would have learned enough to provide a week’s worth of content. Let’s give it a shot anyway.

As I briefly touched upon in yesterday’s post, layout is handled in new layout classes in Flex 4. Let’s dive in to making a simple, custom layout manager.

(more…)

Skinning A Button in Flex 4 Using FXG

Wednesday, July 16th, 2008 by Greg Jastrab

In yesterday’s post I walked through how I got the Flex 4 SDK setup, compiled, and ran the first Hello World application in Flex 4. I said I would follow up today with skinning a Button using the new declarative graphics tags known as FXG (previously referred to as MXML-G), so here we are.

Today I want to explore using the new layout property as well as using a Skin file to describe how the button should look. Let’s get started…

(more…)