How to use the htmlWrapper in Flex4? - apache-flex

How to use htmlWrapper in Flex4?

How do you code your flex applications? If you use Flex Builder, it's automatically generated.
Otherwise, there are also a ANT task and a FlexMojos goal.
If you want to create it manually from scratch, look at the official documentation : http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7ba8.html

Related

Using mx components in an "actionscript project" in Flash Builder

In Flash builder, I want to create an "Actionscript Project" that uses the mx datagrid component. Unfortunately the mx/spark components don't seem to be available unless your project is a "flex project". Is there a way around this? (I really don't like using that mxml mark-up, and just want to write pure code)
thanks!
In ActionScript Build Path, you have to manually add SWC libraries outside Flex library as shown below (add additional libraries as per your requirement):

Unable to use playn JSON classes in Eclipse

I'm not able to access the playn.core.json.* classes inside eclipse even though everything else works in general. I have used this http://code.google.com/p/playn/wiki/GettingStarted in setting up my eclipse project.
However the following classes are visible -
JsonImpl
JsonParserException
JsonSink
JsonTypedArray
JsonWriterException
When I go to the referenced libraries in Eclipse, I can see playn.core.json and
can see all classes inside it. I'm just not able to use them inside my
code.
Thanks!
Just saw the samples.
You're supposed to use the interface Json.Object/Json.Array.
Use PlayN.json().createObject() to create a new Json.Object instance, and PlayN.json().createArray() to create a new Json.Array instance.
Make sure you have statically imported playn.core.PlayN.*

Generate UML from Flex Projects

Are there any good tools to generate UML class diagrams using the source code from a Flex Builder project? I have been trying IntelliJ but for some reason it generates the inherited class structure from the SDK and not everything below my main app.
You could try UML4AS - UML for ActionScript and Flex.
You may have a look on the following program:
Commercial:
http://www.sparxsystems.com/products/ea/index.html
http://www.visual-paradigm.com/support/documents/vpumluserguide/12/13/5963_aboutvisualp.html
Free:
Using StarUML to Generate ActionScript 3.0
Edit: 29 May
http://www.uml4as.com/flower-platform/ the alpha version can be download now.
I think the best option for now is to use Crocus Modeller, UML for Flex & AS3

How about using FLEX 3 component inside Flash file?

Is it possible to use Flex 3 component/code inside Flash (cs4) SWF file ?
I know its possible in the opposite direction.
With my minimal testing it seems you can't use Flex components when building a "pure AS3" project. (Can we start calling it PAS3 or something? Like "passé". Or "pastry". :)
I did this admittedly limited testing by creating a test project with one AS class as the "document class", which would instantiate and addChild one mx.controls.Button. I copied the whole mx package from the path mentioned by hasseg into the project source path.
This is what I found out:
By removing the use of mx_internal from a certain Version.as file, I got Flash IDE to compile my test project without warning. Nothing showed up on the stage though.
Using Flex Builder (and the flex compiler, obviously) I also managed to compile the project without errors. I put breakpoints in the code and watched it build itself in the debugger. The components were instantiated flawlessly, but still nothing showed up on the stage. This swf also crashed the browser numerous times.
I haven't used Flex code in a "pure AS3" project myself, but I don't see why you couldn't do that.
You can download the Flex SDK and get the Flex components from there, both as an swc file (under /frameworks/libs) and as AS3 source code (under /frameworks/projects/framework/src).
It looks like this can be done after all: http://labs.wichers.nu/2007/12/25/using-flex-compiled-code-within-flash/
In general you need to use MXML to initialise the Flex framework and use Flex components.
Mike Chambers from Adobe says:
There is not support for using the Flex Framework in an AS only project. While it is theoretically possible, you would have to manually bootstrap a lot of the application initialization code that Flex handles (something which would be rather complex). - Source
To see how complex, you can tell the compiler to keep the intermediate AS3 files that it generates from the MXML. Open your AS3 project properties and set -keep-generated-actionscript as an argument to the compiler. Compile your project then look in the obj/generated folder. Using Flex 4, I get 13 small files the main of which extends spark.components.Application and overrides a few methods.
So it's possible but you probably wouldn't want to do it. Flex is meant to make your life easier, not harder.

Trouble linking SWC file

I am trying to link the as3corelib library to use their JSON functionality following this tutorial. But am having trouble compiling it. My command looks like:
mxmlc --strict=true -library-path+=as3corelib.swc --file-specs myapp.mxml
But I am getting this error:
_divided_mx_managers_SystemManager.as(13): col: 14 Error: Interface method getVisibleApplicationRect in namespace mx.managers:ISystemManager not implemented by
class _divided_mx_managers_SystemManager.
public class _divided_mx_managers_SystemManager
What is the problem?
Update: Is this because I am using Flex 3? The tutorial seems to be for Flex 2. If so, what do I need to do for Flex 3?
I found an older version of the library bundled with some tutorial which worked. Submitted a bug report to as3corelib, of course I am not entirely sure how valid the bug is.
If you are using Flex Builder 3 you can actually just take the swc file and put it in the libs directory. This will automatically add it to your classpath and you should be able to use it from then on. You may need to subsequently do a clean on the project to make sure it takes it in though.
I faced a similar issue in Flex builder 4. I had to put the as3corelib sources into my source code for it to work alright.
Are you using the flex Gubmo sdk?
Looks like the method it's complaining about is in an interface that's part of Gumbo.
If so, then as3corelib probably won't work with it.

Resources