-->

Archive for 23 February 2009

Flash symbols with Actionscript3 in Flex

by devarni on 23 February 2009, under Programming

The difference

Don’t forget: Flash != Flex. Flex uses elements from Flash but is built on own classes. If Flash and Flex should play together we need a interface.
MovieClip is a display object in Flash and UIComponent is a display object in Flex. But we can wrap a MovieClip into a UIComponent, so the Flex UIComponent becomes a container for our Flash MovieClip.
Here both files, at first the MXML file:





And the Actionscript file with the class:


package {
	import mx.core.Application;
	import mx.core.UIComponent;
	import flash.display.MovieClip;

	/*****************************************************************
	 * File: FlexApp.as
	 *****************************************************************/

	public class FlexApp {
		private var _app:Application;

		public function FlexApp(app:Application) {
			_app=app;

			var btn:MovieClip=new BtnStop();
			var flexui:UIComponent=new UIComponent;
			flexui.addChild(btn);
			app.addChild(flexui);
		}

		static public function initApp():FlexApp {
			return new FlexApp(Application(Application.application));
		}

		public function get app():Application {
			return _app;
		}
	}
}

How it works

applicationComplete in the MXML file is the eventhandler called from the application. Here we provide our handler, which must be a static member function of a class so it can be called later.
initApp() creates our class and passes a application object to the constructor.
Inside the constructor we create the MovieClip from the imported Flash symbol “BtnStop” (this symbol comes from a swc lib, created with Flash). Then we create a Flex UIComponent container and add our MovieClip as a child. The UIComponent can now be added as child of the Flex application.

Leave a Comment :, more...

The Tools…

by devarni on 22 February 2009, under IDEs & Development Tools

Overview of development tools for Flash/Flex

Tool Price Link
FlashDevelop 3 rc1
Flex, Actionscript IDE (Windows) free http://flashdevelop.org

Adobe® Flex SDK3
Flex Software Development Kit (Compiler, Framework…) free Flex download

Adobe® Flash® CS4
Design and programming of Flash animations $699/831€ 30-day trial

Adobe® FlexBuilder3® Professional
Flex programming and visual design of MXML, based on Eclipse Standard: $249/213€
Professional: $699/593€
30-day trial

Ensemble Tofino
Flex plugin for Microsoft Visual Studio® free http://www.ensemble.com
Leave a Comment :, more...

FlexBuilder3 with Aptana/Eclipse 3.4.1 “Ganymede”

by devarni on 22 February 2009, under IDEs & Development Tools

FlexBuilder3 is based on Eclipse 3.3.1 and doesn’t work unfortunately with Eclipse 3.4.1 “Ganymede”.
But Eclipse “Ganymede” has a feature for easy integration of plugins called “dropins”, therefore under Eclipse 3.4.1 exist a “dropin” folder…

Close Eclipse and copy the complete Flexbuilder folder (standalone or plugin) inside this “dropin” folder. Restart Eclipse and now you should have the complete Flexbuilder envoirenment available!
Flexbuilder can be found with the default installation path at C :\Program Files\Adobe.

3 Comments :, , , more...

FlexBuilder vs FlashDevelop

by devarni on 22 February 2009, under IDEs & Development Tools

A short comparison of Flexbuilder3 with FlashDevelop 3

FlexBuilder 3


Pro

  • Easy debugging and profiling
  • Automatic adding of imports and organizing of imports
  • Visual designer for MXML
  • Because of Eclipse: support for other languages (eg. with Aptana, PDT…) and extendible with Eclipse plugins. So features like “Code Snippets” (CFEclipse), automatic code generation for Getter/Setter (Monkey Script) are usable
  • Class Wizard
  • Support for ASDoc comments
  • Support for virtual folders/files (links to external files/folders handled intern by Eclipse, so also working on Windows)
  • Refactoring (renaming of classes, functions, properties with automatic adaptation of dependencies)

Con

  • Commercial license
  • Plugin doesn’t work with all versions of Eclipse (eg. is not working with Eclipse Ganymede 3.4.1 or 64bit versions)
  • Searching, adding and configuring the missing features with Eclipse plug-ins is often complex
  • Code assist average and sometimes buggy eg. if correct imports are missing (“java.lang.NullPointerException”)
  • No Code Formatter or automatic generation of getter/setter (only with Eclipse plugins like Monkey Scripts, CFeclipse, Flexformatter “FlexPrettyPrintCommand”...)
  • No package explorer for SWC files

FlashDevelop

Pros

  • Free and OpenSource (developed with C#)
  • Lightweight
  • Best available Code Assist for Actionscript
  • Contextual code generation (getter/setter, variables, event handlers)
  • Code Snippets
  • Automatic adding of imports
  • Extendible with plug-ins
  • Support for ASDoc comments
  • Package explorer (shows classes and symbols from SWC files)

Cons

  • Only for Windows
  • Plugins often not working in newer versions and many plug-ins are only rarely updated
  • Debugging only with a plugin and more at an early stage
  • No visual designer for MXML
  • No class wizard
  • No code formatter
  • No support of virtual folders/files (“links”) insides the project
  • No refactoring


My recommendation:

For debugging, visual design of MXML: FlexBuilder
For mostly coding of Actionscript under Windows: FlashDevelop.

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Archives

All entries, chronologically...

© 2009 by Frank Arnold | About