If you’re a Fireworks user you’ll be happy to know that the team has been hard at work improving the FXG export feature so you can more easily take your designs from Fireworks and use them in Flash Catalyst. The new script is available over on Adobe Labs and includes a ton of fixes to the old FXG script as well as some new functionality based on a more finalized FXG specification:
lineHeight for Text element was always exported as %, now it’s exported based on a value selected in Fireworks ( % or exact)
Tab indention was not correct for elements that were exported as bitmaps
Exporting invisible bitmap elements caused script errors
Updated Rectangle primitive object to export transformation matrix and roundness value
Modified / Added Application Private Data for all elements (d:userLabel , d:type, etc.)
Exporting effects applied on Groups and Symbols
So fear not Fireworks users, Flash Catalyst may not have native file format import for you, but you’ll still be able to use the tool you know and love and bring those designs easily into Flash Catalyst with the “Open from FXG” feature.
Pamela Fox‘s talk at Web09 got me all hyped up on using custom map markers in Google Maps and it’s possible in Degrafa but I figured with Catalyst and Illustrator out there supporting FXG, it should be possible in FXG as well. Luckily the answer is “mostly yes”.
I’m hoping to do a deep dive on FXG later but I’ll give the main points here. There’s a difference between MXML Graphics and FXG. They use the same tags but MXML Graphics can be altered at runtime. FXG files are more like static assets that can’t change. This means you get a bit more performance because they’re optimized at compile time. Using MXML graphics as marker icons isn’t possible because there doesn’t seem to be a way to get a DisplayObject from MXML Graphic assets. But in the latest nightly builds of the Flex 4 SDK you can treat FXG assets just like an image or SWF and reference it that way in your code. That makes using FXG for custom markers simple. It also means it’s very easy for a designer and a developer to work together and be able to use things like source control while the designer and developer are each working in their tools. The screencast below shows what I mean.
The first thing you need to do is create an FXG file. This can be done with Illustrator or Fireworks CS4, just create some artwork and save as an FXG. Note that you can take any freely licensed SVG file and turn it into FXG using Illustrator CS4. Once you’ve got that, drop the FXG file into your Flex project. It’s a good idea to follow normal class naming conventions with the first letter being capitalized.
Once that’s done you can create an instance of that asset like you would any other ActionScript class and then set the icon property of your MarkerOption class to your FXG asset. In the case below I’ve got an FXG file called HikerIcon in the assets folder.
1
2
3
4
5
6
7
8
9
10
11
12
import assets.HikerIcon;
// this is in the onMapEvent handlervar hikerIcon:HikerIcon = new HikerIcon();
var markerOptions:MarkerOptions = new MarkerOptions();
markerOptions.icon = hikerIcon;
markerOptions.tooltip = "FXG Test";
markerOptions.iconAlignment = MarkerOptions.ALIGN_HORIZONTAL_CENTER;
markerOptions.iconOffset = new Point(0,0);
marker = new Marker(map.getCenter(), markerOptions);
map.addOverlay(marker);
That’s it, you’re all set. As I mentioned, I did a screencast below that talks more about the workflow for designers and developers using FXG. Because FXG is XML-based, it fits with how developers think about the project and can be modified if need be by developers inside of Flex Builder. But since these are graphical assets, designers have the option to make changes just like they would be able to with other external images. Since this is a big screencast, I suggest you click on this link to watch it instead of trying to view it in the small area below (or use full screen mode).
I’m working on some Flash Catalyst samples that use Illustrator instead of Photoshop and I’m finding that Illustrator is really hard. It’s also going to be a very, very powerful way to create graphics and content for Flex applications because of FXG. For those that don’t know, FXG is an XML-based graphics format that is part of the Flex Framework and works with a lot of the CS4 tools. What makes Illustrator so great is that since it’s vector based, almost anything you do can be represented as tags in FXG. FXG supports a number of Bitmap Filters and Effects but I wasn’t sure which of those you can actually create in Illustrator and have represented as a property in FXG (as opposed to a rasterized BitmapGraphic). I asked around internally and Sanjay Kumar, an engineering manager on the Illustrator team, gave me a quick rundown:
DropShadowFilter: Stylize->Drop Shadow
GlowFilter with Inner = true: Stylize->Inner Glow
GlowFilter with Inner = false: Stylize->Outer Glow
BlurFilter: Blur->Gaussian Blur
For the most part they’re pretty straightforward, but there are a few, such as BevelFilter, GradientGlowFliter, and ColorMatrixFilter that you can’t create from Illustrator. Hopefully we’ll add more in both future versions of FXG and Illustrator. There’s a ton of stuff in the FXG spec that’s worth checking out.
I’m starting a new show on Adobe TV called Tech Talk with Ryan Stewart. In my first episode I chat with Matt Chotin about new features in Flex 4 and then do a small demo on how to get started with FXG. It’s a little out of date because we recorded it awhile ago, but there is still some solid info from Matt.
And no, we didn’t coordinate haircuts or wardrobe, but I think we look pretty snappy.
A few minutes ago we posted a new build of the Flex SDK which includes a lot of the stuff we’re doing for Flex Next. This is your first chance to jump in and start playing with Flex Next features. A couple of my favorites are FXG and the new states model.
Ely Greenfield has a good video on Adobe TV about the new designer/developer workflow in Flex 4. We’re making a ton of improvements around the designer/developer workflow. That includes FXG, it includes Thermo, and it includes making it easier to work with our current design tools.
Now that it’s live, I’m going to be trying to do a ton of content/tutorials/info about how to use these. Right now I’m working on an online/offline sync demo for my talk at 360|Flex, but if this stuff interests you and you haven’t registered for MAX yet, you should – *hint*.