I’ve moved onto new gigs and part of that move is migrating my home office to the MacBook Pro and FlashBuilder (I still want to call it Flex 4). I’ve been working with Jason on getting Degrafa setup with FlashBuilder and finding out what issues are involved with migration. This is the first in a series of posts on this issue.
When importing the Origin branch from SVN [branches/Origin/Degrafa], setup the project as a Flex Library Project. Under Project Properties, Flex Library Build Path | Classes Tab – Select classes to include in the library. Make sure com is checked. FB wants to setup the main source folder as src. Leave it blank.
Select the Flex Library Compiler settings. For now, we need to use the Flex 3.5 SDK. Set the namespace url to http://www.degrafa.com/2007 . On the next setting below Namespace URL, browse to the project manifest file and select it.
Click here to see a screenshot of my settings.
When you build the project, there should be a .swc in the bin folder.
When creating a new project, go to the Flex Build Path settings in Project Properties, Library Path. Click Add Project and select your Degrafa source project.
Now, a few things have changed. In the new FB 4 universe, Canvas is out and the spark BorderContainer is the new kid on the block. Degrafa plays nicely with the new kid, but the Degrafa declarations should go inside the fx:Declarations tag. Here is a minimal example,
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:degrafa="http://www.degrafa.com/2007"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="600" minHeight="400">
<fx:Declarations>
<degrafa:RegularRectangle width="100" height="100" graphicsTarget="{ [myCanvas] }">
<degrafa:stroke>
<degrafa:SolidStroke color="0xff0000" />
</degrafa:stroke>
</degrafa:RegularRectangle>
</fx:Declarations>
<s:BorderContainer id="myCanvas" width="300" height="300" />
</s:Application>
There are some issues, currently with fills. Jason is looking into current issues and a full-on Flex 4-compatible release (ah, I like Flex 4 much better). I will expand on fills and style-related issues in future posts. Once I get some reasonable examples up and running, it will be time to return to spline goodies. Flex setup … boring … math stuff … fun 🙂
It seems like there are some compatibility issues with Degrafa fills in Flex 4 – is this the case? I get an odd error every time I try to use them: Error #1053: Illegal override of SolidFill in com.degrafa.paint.SolidFill. (and something similar for the LinearGradientFill)
Yes, that’s what I was talking about; a conflict with the F4 fill; Jason’s looking into it.
I had the same issue with fills and I look forward to seeing what Jason finds. At least the Degrafa method of creating visualizations helped prep me for the Flex 4 (yes, I prefer that term as well – also the SDK is Flex 4 SDK).