Generate UML from Flex Projects - apache-flex

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

Related

How to use the htmlWrapper in Flex4?

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

what package I should import to use DataProvider class

I need to use DataProvider class and i cannot find the package that contains it. In all examples I saw they use fl.data, but I'm using flex builder sdk 3.4 beta and it doesn't have such a package. Any clue?
Thanks,
Nava
fl.data.DataProvider is a Flash authoring tool specific class and cannot be imported to a flex project. Check out ArrayCollection or XMLListCollection for flex.
As far as Adobe's classes are concerned, packages starting with
fl.* are CS3/4 only.
mx.* are Flex/AIR only.
flash.* are available everywhere.

ModuleBase vs. Module

Does anyone have insight into when to use mx.modules.ModuleBase over mx.modules.Module? The documentation that I have seen isn't very clear on what each was designed for. What do they mean by "interacts with the framework" exactly? Does it just come down to visual vs. non visual components? Obviously a BaseModule which doesn't interact with "the framework" isn't going to be very useful so any realistic subclass of BaseModule would probably interact with the framework in some capacity. My guess is that Adobe provided ModuleBase so that developers could extend from the minimal amount of code necessary to just get something loaded into the vm at runtime. Any ideas? Thanks
Flex Developer's Guide pg.990
Extending the Module class is the same
as using the tag in an
MXML file. You should extend this
class if your module interacts with
the framework; this typically means
that it adds objects to the display
list or otherwise interacts with
visible object.
... they go on to say
If your module does not include any
framework code, you can create a class
that extends ModuleBase. If you use
the ModuleBase class, your module will
typically be smaller than if you use a
module based on the Module class
because it does not have any framework
class dependencies.
Very cool, thanks everyone. Yes, I've read those comments as well. As I've worked with Flex modules over the past couple months I believe my original interpretation was fairly close "...Adobe provided ModuleBase so that developers could extend from the minimal amount of code necessary to just get something loaded into the vm at runtime." I feel that the doc's explanation is too general though. For example I have several ModuleBase classes that "interact with the framework". They are not visual components themselves - but utilize various framework classes to fulfill a kind of service role in my applications. I think that a more accurate description of ModuleBase would be to say that "If your module is not a DisplayObject then extend from ModuleBase".
ModuleBase is for non-flex modules.
Module is for flex based modules. If you're using any flex components inside your module, this is for you. Or if you intend to use the module inside a flex app, you probably want this as well.
According to a comment inside of the ModuleBase.as file:
The base class for ActionScript-based dynamically-loadable modules. If you write an ActionScript-only module, you should extend this class. If you write an MXML-based module by using the <mx:Module> tag in an MXML file, you instead extend the Module class.
... and within Module.as:
If your module does not include any framework code, you can create a class that extends the ModuleBase class. If you use the ModuleBase class, your module will typically be smaller than if you create a module that is based on the Module class because it does not have any framework class dependencies.
So basically, if you are writing an MXML component, or if you are using flex framework classes, then you should use the Module class. Otherwise, ModuleBase is more appropriate.

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