Give us a call 203-379-0773
Check out our Angular Book Series.

Why can't I access mobile skins in my Flex Library Project?

I'm working on a version of the Flextras AutoCompletComboBox for mobile devices. Many if you may have seen me demoing an early version of that at the 360|Flex conference. With the formal release of Flex 4.5 on the horizon, I came across a problem.

When trying to create a Flash Builder Library Project that supported mobile components, I could not access mobile skins. This seemed odd to me; as I could access them in a Flash Builder Mobile project. As best I could tell the list of SDK SWCs was identical. After some digging, I think I found the issue and a possible solution.

The Issue

One of the things I've done to prep the AutoComplete component for mobile usage is to create a custom, mobile optimized skin. Our AutoComplete is a composite of Skin Parts which do have mobile support, such as the Button, TextInput, and List. I wanted to apply the mobile skins for those components to the default AutoCompleteComboBox skin. Unfortunately, this gave compiler errors for trying to access undefined classes.

I believe the issue relates to where the mobile component skins are stored. They are compiled into a specific theme class; which is not automatically applied to mobile library projects. I suspect in many use cases, you wouldn't want to apply a theme to a Flex Library that may be overwritten when a real project is compiled. However, with the new Spark Architecture; where skins are classes [not necessarily just CSS and assets] it seems that referencing skin classes inside a library project seems more likely.

The Solution

The fix I found was to add add the mobile theme SWC to the library path. Details are here:

  1. Bring up project properties -> Flex Library Build Path -> Library Path
  2. Click "Add SWC" button
  3. Enter "C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.5.0\frameworks\themes\Mobile\mobile.swc" and click okay.
  4. Click Okay on the dialog window
  5. click okay in project properties

I still get compiler warnings, which is undesirable, but it's better the compiler errors that do not allow me to create a SWC at all.

The full details of my work around are in this bug post. Please vote for it; as that will raise its awareness in Adobe. I believe the more people who vote, the more likely it is to be fixed.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Jason San Jose's Gravatar If you expand the SWC in the build path page, double click on link type and change it to external, this should get rid of the compiler warning and eliminate duplicate classes (from mobiletheme.swc) from showing up your SWC.
# Posted By Jason San Jose | 5/15/11 10:11 PM