1 Reply Latest reply on Nov 4, 2009 10:27 AM by ab1301

    Newby Question: Can AIR app have BOTH use HTML and Flex?


      I need to make a desktop app using HTML and JavaScript but I want 99% of the logic to be written in Flex.  Is that possible?


      Also, do I need to buy Flash in order to compile Flex?  Or does AIR SDK include a compiler?



        • 1. Re: Newby Question: Can AIR app have BOTH use HTML and Flex?

          Yes, it is possible.  For Air apps, Flex has an html control that is basically a self-contained webkit browser you can drop into your application.  You can insert html either by loading an html string, or pointing the browser to a particular location on your filesystem or on the internet.  As far as javascript, it can either be part of the site you load into the browser, or you can "cross-script" javascript in action script.  Cross-scripting may be better in certain instances, because then you can use controls written in flex to access or manipulate the html content.  To cross-script, you do something like this: var dom:Object = html.window.document, where "html" is the id of your html control.  Then, you can access javascript methods and properties through the dom object, like this: var p1:Object = dom.getElementById("p1").  See the webkit docs for available javascript methods and properties.


          No, you don't need to buy Flash.  The Flex SDK has a compiler.  You still might want to get Flex Builder (or the upcoming Flash Builder, which is the same as Flex Builder, but very different than Flash--not confusing at all...).  Or I think there are some third party IDEs for Flex, one or more of  which might be free, but I'm not sure.  I imagine it would be pretty hard for someone just learning flex and air to start building apps without Flex Builder.  Also, I think the beta of Flash Builder is still available for free, if you want to try it out.