1

In Flash Builder, if I new a Flex Mobile Project, and paste the following code:

<?xml version="1.0"?>
<!-- Simple example to demonstrate the Halo Canvas layout container. -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:Group/>
    <mx:Canvas/>
</s:Application>

The "Canvas" line fails to compile. However it's OK in a Flex Project. My question is, is there any way to use Canvas or other halo controls without modifying the legacy code in Flex Mobile Project? Or, is there any way to use Native Extension in Flex Project? If both are NO, it would be a nightmare.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
willzeng
  • 915
  • 1
  • 8
  • 19
  • Adobe recommends not using mx components for any mobile applications, as they are not optimized for it. Obviously this does not solve your problem, but it does explain why you are having it. Usually they will work, just not well. Canvas flat out does not work on Mobile, however. – Josh Oct 23 '12 at 16:52
  • I thought the recommendation is for new projects. For old ones, better get them run before re-factory. Even it's slow, you can optimize the mx components away as you like, part by part. – willzeng Oct 24 '12 at 07:32

1 Answers1

3

My question is, is there any way to use Canvas or other halo controls without modifying the legacy code in Flex Mobile Project?

Yes, you have to add the mx.swc to the library path of your mobile project. It should be located in a place similar to this:

[FrameworkRoot]\frameworks\libs\mx\mx.swc

I'm not sure I'd recommend it; as the MX components are not optimized for mobile usage. I'm unclear what a Canvas would offer you that you couldn't get from a Group.

is there any way to use Native Extension in Flex Project?

No; Native Extensions are an AIR feature; you will not be able to use them in a browser based project.

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
  • Thank you very much. I'll try it. The reason I still want to use mx controls is simply that I don't want to modify tons of existing code. – willzeng Oct 23 '12 at 02:47
  • You're probably going to have to modify tons of existing code if you want to get good performance on a mobile device. But, it depends on the device and you'll have to try it and see. – JeffryHouser Oct 23 '12 at 02:50
  • It worked. Thanks a lot! (But the mx.swc alone seems not enough, I also added [FrameworkRoot]\framesworks\libs\sparkskins.swc to remove all errors.) – willzeng Oct 23 '12 at 03:24
  • You shouldn't need sparkskins.swc to use the MX Canvas object. IF this solves your problem, please mark this answer as completed. There should be a "checkbox" right next to the voting bar. – JeffryHouser Oct 23 '12 at 13:20