Last December Mrinal Wadhwa did a great presentation on Custom Components in Flex 4 at the Adobe DevSummits in Chennai and Hyderabad. We were so impressed with the slide deck that he posted that we asked him to present at our Boston Flex Application Incubator group meeting this Tuesday. He’ll be presenting via Acrobat Connect so you can join us from anywhere. Meeting starts at 6:15 PM Eastern Daylight Time.
Full details are here.
See you there.
June 17th, 2009
You would think that it would be fairly simple to include the Flex framework source code in a project, rather than using the framework.swc library. Simply include the [SDK]\frameworks\projects\framework\src folder in your source path and delete framework.swc from your library path, and you’re good to go, right? Well, it’s not quite that simple.
First of all, you also need to include the [SDK]\frameworks\projects\framework\assets folder, or you’ll get a lot of compile errors similar to this: “Invalid Embed directive in stylesheet – can’t resolve source ‘Embed(source = “Assets.swf”, symbol = “__brokenImage”)’”.
You’ll now be able to compile without any errors, but if you run your project it will throw this error – “TypeError: Error #1010: A term is undefined and has no properties.” – in StyleManagerImpl.initProtoChainRoots(). I’m not going to go into detail on why this occurs, but the root cause is that the compiler doesn’t find the default.css file in the [SDK]\frameworks\projects\framework folder. As a result the info() method in the generated* _[your_app's_name]_mx_managers_SystemManager file contains a line that looks like this:
mixins: [ "_ClassFactoryDemo_FlexInit", "_advancedDataGridStylesStyle", "_ClassFactoryDemoWatcherSetupUtil" ]
instead of like this:
mixins: [ "_ClassFactoryDemo_FlexInit", "_richTextEditorTextAreaStyleStyle", "_DividedBoxStyle", "_alertButtonStyleStyle", "_textAreaVScrollBarStyleStyle", "_headerDateTextStyle", "_globalStyle", "_ListBaseStyle", "_todayStyleStyle", "_windowStylesStyle", "_ApplicationStyle", "_ToolTipStyle", "_CursorManagerStyle", "_opaquePanelStyle", "_TextInputStyle", "_errorTipStyle", "_dateFieldPopupStyle", "_dataGridStylesStyle", "_DataGridStyle", "_popUpMenuStyle", "_headerDragProxyStyleStyle", "_activeTabStyleStyle", "_DragManagerStyle", "_ContainerStyle", "_windowStatusStyle", "_ScrollBarStyle", "_TextAreaStyle", "_swatchPanelTextFieldStyle", "_textAreaHScrollBarStyleStyle", "_plainStyle", "_activeButtonStyleStyle", "_advancedDataGridStylesStyle", "_comboDropdownStyle", "_ButtonStyle", "_HDividedBoxStyle", "_DataGridItemRendererStyle", "_weekDayStyleStyle", "_linkButtonStyleStyle", "_ClassFactoryDemoWatcherSetupUtil" ]
which is how it should look. In particular, the missing “_globalStyle” bit causes you app to break.
So you need to either include the [SDK]\frameworks\projects\framework folder in your source path, which will cause ‘overlapping source path’ warnings, or copy this file to another folder and include that folder in your source path. Personally, I just copy it into the [SDK]\frameworks\projects\framework\src folder, which accomplishes the same thing.
Now I know what you’re thinking. You’re thinking, “This is all wonderful, Douglas, but why would I want to do this in the first place? It works just fine to use framework.swc. Flex Builder sets up new projects so that this and other SWCs have a ‘source code attachment’. You can set breakpoints and step through the code, etc. Why do you need to actually compile the framework source code as part of your project?”
Well, in my case I’m doing this because, while all of that is true, it doesn’t seem that Eclipse’s ‘Mark Occurrences’ feature works with ‘source code attachments’. I rely heavily on this feature when I’m trying to figure out what code is doing, which is the whole purpose of this exercise in the first place.
But it seems as though there must be a simpler way to do this. If you know of one, please add a comment!
* If you aren’t familiar with generated code, try adding the ‘-keep’ option to your compiler options. Then recompile and look for a ‘generated’ folder your project’s main source folder. It will contain the ActionScript classes that are created based on your MXML files. These files are normally compiled into your project’s SWF then deleted. Turning on the -keep option simply tells the compiler not to delete them when it’s done with them.
September 3rd, 2008
Please change this!:
(Google currently claims the right to publish anything you submit through Chrome.)
Boston Flex Application Incubator Group :: Online / In-Person Meeting Monday :: Marc Hughes :: Creating a Simple Diagram Application Using Degrafa and ObjectHandles
July 4th, 2008
Details here: http://www.bfaig.org/blog/?p=85
Note – to avoid confusion:
- Boston has two Flex user groups.
- BFUG will be having a great meeting on Tuesday – details at http://www.bostonfug.org – meeting will not be available online.
- BFAIG is having the above referenced meeting on Monday – you can attend in person or online – Marc Hughes will be presenting remotely.
Please join us for both!
Boston Flex User Group Meeting Next Tuesday :: T. R. Coffey :: Advanced CSS Techniques and Programmatic Skinning
July 3rd, 2008
February 20th, 2008
I’ve just updated my Google custom search engine to include over a hundred Flex-related URLs, and think it now worth announcing to the Flex community. Here’s its URL:
I’ve posted a list of all the included URLs at http://www.brightworks.com/technology/google_custom_searches/adobe_flex.html.
If your site isn’t listed and you’d like to be included, or if you have suggestions for improvements, please let me know using the contact form here.
Thanks, and enjoy.
January 21st, 2008
Challenge: I’m using Flex Builder 3, I wanted to change my project’s HTML wrapper file, and I wanted the changes to stick, even if I cleaned my project.
Solution: Edit /html-template/index.template.html
July 20th, 2007
I occasionally start getting errors such as these:
- An internal error occurred during: “Updating links to source folders…”
- An internal error occurred during: “Refreshing workspace”
When I Google them I don’t find any answers so perhaps this is worth a post. As far as I can see the solution is refreshingly simple: Restart FlexBuilder.
If this doesn’t work for you, or you know of other fixes, please add a comment!
When I set the source property for a SWFLoader this string works fine:
…but this string gives me the above error:
I couldn’t easily Google an answer to this, so it may be worthwhile to post what I learned.
I found two causes for this problem. First of all, for some reason you need an additional slash when you use @Embed, like this:
Second, the location of the SWF (or GIF, JPEG, PNG or SVG) may need to be different if you’re using @Embed, so that the compiler can find and embed the file at compile time. A copy of the file should be placed in a location relative to the source file that contains the SWFLoader.
Example: In my case I’m placing my SWFLoader in a custom component that is part of a code library. The code library lives in a separate location from the project that’s using the component.
For the non-embed example above I can place MyFile.swf at [MyProject'sMainSourceFolder]/images/MyFile.swf. FlexBuilder copies it to [MyProject'sOutputFolder]/images/MyFile.swf and the SWFLoader finds it there at run time.
But when I use @Embed, when the compiler sets about embedding the file it expects to find a copy at [MyLibrary'sOutputFolder]/images/MyFile.swf.
Update: Just found some info in on this in the docs, here:
May 8th, 2007
If your PNG files aren’t displaying with their transparent areas transparent, take a look at this post by Doug McCune. While it’s title is Problem with Transparent PNGs in Flex using @Embed, it also solved my problem which didn’t involve @Embed.
Simply stated, I couldn’t get transparency when trying to display a PNG in an Image component. Once I applied Doug’s solution, the problem disappeared.
It’s not clear why most PNGs work fine in Image but a few don’t. Doug seems to think that it may have something to do with how the PNG is encoded. In any case, Doug’s fix seems to remove the problem. Perhaps Adobe should incorporate his fix into the standard Image component.