Joeflash’s Enigmacopaedia

Flash-Flex Series on CMX: Flash S9 Skinning for a Flex DragPanel Component

Posted in Flash, Flex, Community MX, Flex Builder 2, Flex 3, Flex 2, Flash CS3, Flex Builder 3 by Joeflash on the June 25th, 2008

In part 3, part 4, and part 5 of the Flash-Flex Integration Series on Community MX, we show you how to build a scale-9 skin in Flash, apply it to a custom Flex component, and build a draggable, resizable “panel” component application in Flex. You can see the finished demo for this tutorial trilogy below.

This movie requires Flash Player 9

The skin was designed in Flash CS3, and implemented in Flex Builder 3. To find out how this was done, you can purchase these tutorials at the links below.

Flash-Flex Integration - Part 3: Flex Component Skinning with Scale-9
Flash-Flex Integration - Part 4: Skinning the Scale-9 Flex Component
Flash-Flex Integration - Part 5: Building the DragPanel Component

Flash-Flex Integration - Part 3: Flex Component Skinning with Scale-9 on Community MX

Posted in Flash, Flex, Community MX, Flex 3, Flex 2, Flash CS3 by Joeflash on the May 15th, 2008

I’ve a few new articles on the Flash-Flex Integration series on Community MX. This latest article is part one of two about creating a custom Flex component skin using Flash CS3 along with some deft scale-9 techniques and gotchas.

In this first article, we will design a skin in Flash CS3 for a Flex component, which is able stretch intelligently using a concept known as scale-9. We will look at several techniques for designing assets in Flash using scale-9 effectively, avoiding certain important gotchas along the way. We will also demonstrate how one Flash skin file may be applicable to multiple Flex components. In the following article we will implement this skin for a Flex custom panel component with drag and resize handles.

The completed Flash-Flex custom component skin

Flex Builder 3 Startup JVM Termination Error

Posted in Flex Builder 2, Flex Builder 3, Eclipse by Joeflash on the March 26th, 2008

So I just installed a new version of my firewall software, and now neither FB 2 or FB 3 will start. I get a JVM termination error popup, that’s it. As fortune would have it, Neil Webb had blogged about the same problem just today. So I looked up the issue on the Adobe bugbase, and there I found the answer after a little investigation.

JVM termination error dialog

Turns out I had some JVM performance tuning set in my shortcut.

-refresh -clean -vmargs -Xms512m -Xmx1024m

…and apparently it was too high. The moment I ran FlexBuilder.exe directly or the shortcut with a lower max mem at -Xmx768m , it worked, no problem. I found I could push it all the way up to 958m, but no more. At 959m, it crashes, just as before.

No idea why installing new software would affect the maximum memory allocation for the JVM, or why a max of 958. But at least it’s working now.

\*replaces hair torn out of scalp\*

Update 02-04-2008: logged an official bug with the Adobe JIRA bugbase

Flex Powertools: Explorers article on Community MX

Posted in Flex, Tools, Community MX, Flex Builder 2, Flex 3, Flex 2, Flex Builder 3 by Joeflash on the March 17th, 2008

I’ve a new article on Community MX entitled Flex Powertools: Explorers, in which I review over 20 of my favourite Flex 2 and 3 explorer utilities and resources, which includes component explorers, styling & skinning explorers and resources, visual effects explorers and benchmark explorers.

Flex 101: Part 14 - Using the Event Subclasses

Posted in Tutorials, ActionScript 3.0, Flex, Community MX, Flex 2 by Joeflash on the January 13th, 2008

The latest addition to the Flex 101 series is now available on Community MX. In this tutorial we go into the Event subclasses — what they are, when and when not to use them, complete with examples. We describe when certain event classes are dispatched from component interactions, what classes to type to depending on use, and the event class package and inheritance structure in Flex 2.

Flex 101: Part 14 - Using the Event Subclasses

Annoying Warnings Begone! (getting rid of compiler warnings in Flex Builder)

Posted in Flex, Flex Builder 2, Flex 2 by Joeflash on the December 31st, 2007

If you’re like me and still do manual versioning of files during a project (I do for spiking or prototyping), … and a bunch of the legacy versions of the file in your open project still give you annoying warnings or errors and you don’t want them to appear in the Problems view, you don’t have to close the project or move any files. Just remove them from the Flex Applications list under [project] > Properties > Flex Applications, and Clean your project.

The annoying warnings or errors for the undesirable files should then go away in the Problems view.

Writing the Flex 101 Series on Community MX

Posted in ActionScript 3.0, Flex, Community MX, Flex 2 by Joeflash on the November 23rd, 2007

Since early 2006 I’ve been authoring articles as a staff writer for Community MX, an online magazine and tutorial resource. It is a wonderful journey of discovery, which I came to define whist I was teaching at Humber College: that you only truly know what you know until you teach it, or in this case, write about it.

In each article, in each tutorial I write, I discover something new about what I do, programming with Adobe Flash Platform technologies. This is primarily because I need to be writing it from the perspective of someone who does not know what I know, so I cannot assume anything except a certain baseline of knowledge vaguely defined by the scope and difficulty rating of the article. That’s the challenge of technical writing: it makes me a better communicator and a better programmer.

In August of this year, I began writing a new series to test my knowledge of Flex fundamentals, and to share certain tricks I have picked up along the way. The series is called the Flex 101 series, currently up to Part 13, with many more to come.

Flex 101: Part 1 - Introducing Adobe Flex 2
Flex 101: Part 2 - What’s New In Flash Player 9
Flex 101: Part 3 - Using Flex Builder 2
Flex 101: Part 4 - Building in Design Mode
Flex 101: Part 5 - Using MXML

Flex 101: Part 6 - Components and Databinding
Flex 101: Part 7 - Events
Flex 101: Part 8 - AS3 in MXML
Flex 101: Part 9 - Custom MXML Components
Flex 101: Part 10 - Databinding Custom Components
Flex 101: Part 11 - The Event Class
Flex 101: Part 12 - Using the Flex 2 Debugger
Flex 101: Part 13 - Declaring Events in AS3

The first few articles in the series are free, with the rest available at $4 US. I hope you enjoy them as much as I did writing them!

External Classpaths in Flex Builder 2

Posted in Flex, Flex Builder 2, Flex 2 by Joeflash on the November 21st, 2007

One of the questions that I get asked occasionally from other developers learning Flex is, “How do I make the code completion work with an external project?”

What you may be trying to do is linking to an external folder, by way of Navigator view > [Project Folder] > right-click > New > Folder > Advanced > Link to folder in the file system > [folder path]. This will indeed create a reference to a folder external to your project, or even your workspace, but it will not help Flex reference an external classpath for compilation or code completion.

For that, we need to configure an external compilation source. For this, we select Navigator view > [Project Folder] > right-click > Properties > Flex Build Path > Source path > Add folder > [folder path].

Keep in mind that for external classpath referencing to work, you don’t want to direct to an external project source folder, but the root classpath such as the “com” or “net” or other root class package, otherwise the classpath referencing for code completion in the editor will be misdirected.

Error #2044: Unhandled IOErrorEvent - Solution

Posted in ActionScript 3.0, Flex, Design Patterns, Flex 2 by Joeflash on the November 18th, 2007

This past September, a good friend and trusted colleague of mine David Stiller came to me with a puzzling debug message: the dreaded Error #2044. At the time I didn’t have much to tell him, until I encountered it myself a few weeks later. Now I just had to find an answer.

Unfortunately the Adobe LiveDocs runtime error listings are not particularly helpful in this regard. Judah’s blog post on the matter does give some additional info, but neither David or I had encountered this error because of a problem uploading a file, nor did the try-catch solution seem to fit in our case.

The solution at first glance seems simple: make sure that either the file the application is loading, uploading or the server-side script it is referencing, is actually there, and it is not corrupted. All of the above can result in a #2044 error.

But what if you want the error handled without the runtime debugger being in your face about it? In both David’s and my case, we wanted to ensure that if files referenced by application were not there or corrupted, that the user (i.e. QA person/developer) would get a nice alert popup instead of a runtime error — or worse, having the app fail silently.

You would expect that the following would handle the error:

  1. loaderXML.addEventListener(ErrorEvent.ERROR, handleError);
  2. ...
  3. private function handleError(evtObj:ErrorEvent):void
  4. {
  5.    // do something
  6. }

But that doesn’t work. As the error implies, you need to use the IOErrorEvent class, not the ErrorEvent class.

  1. loaderXML.addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
  2. ...
  3. private function handleIOError(evtObj:IOErrorEvent):void
  4. {
  5.    // do something
  6. }

That works. But hang on, we’re not quite done. If you use a custom event bubbling scheme, as I had done in a custom MVC framework I built for a client…

  1. loaderXML.addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
  2. ...
  3. protected function handleIOError(e:IOErrorEvent):void
  4. {
  5.    dispatchEvent(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, IOErrorEvent(e).text));
  6.    trace(IOErrorEvent(e).text);
  7. }

… and you dispatch an IOErrorEvent.IO_ERROR event, you also need to handle it all the way up the chain… or you’ll get the same runtime debugger error.

Once all possible dispatches of that event were handled as it bubbled all the way up through my Services and my Controller classes, my View showed a nice Alert with the error text, no debugger crashes.

So the lesson here is: anywhere you load a file, access a script, or load or upload any data of any kind whatsoever, in order to build a robust application, you can’t just think about handling the ErrorEvent.ERROR event: you also need to account for the IOErrorEvent.IO_ERROR event as well, or your application will have holes in it which may let slip by the dreaded Error #2044.

Next Page »