Archive

Archive for the ‘flex’ Category

Adobe Air Auto-Update blank screen bug in Flex SDK 3.5

January 6th, 2010

After spending a long time yesterday trying to get the Adobe Air Auto-Update to work I realized it was a bug with Flex SDK 3.5.  What happens under Flex SDK 3.5 when you run the auto-update is you only see a blank / gray screen pop-up with no wording.   At first I thought it was my code so I tried it using Greg Wilson’s sample.  Compiled under Flex SDK 3.5 it doesn’t work at all, but then I tried it under 3.4 it works great.

I have filed a bug with Adobe, so please vote for it so we can get a quick fix -http://bugs.adobe.com/jira/browse/SDK-24919

Ryan Knight flex

Flash Builder Bugs filed with Adobe

September 4th, 2009

James Ward asked me to file bugs for some of the issues we have been seeing with flex builder.  I have posted them here in hopes you will go vote for them.  This is only some of the many issues we are seeing using Flash Builder

Allow multiple instances of an AIR app to run at the same time. – There was a previous issue for this which was closed, so I created a new issue with more details.

Need to be able to navigate to classes and methods that implement an interface

Flex Server ate my bin! – This bug was already in the system, but looks like it is stuck on waiting on Info -  Hopefully voting on it will get it moving.

After changing a project type from Flex Server I still can not set my output folder in Flex Build Path

Multiple runnable Air applications in the same project using locale causes tabs display name to be null

Should be able to navigate into script source with Go to Definition

Looking through the bug database it looks like several of the renaming bugs have recently been fixed, so maybe renaming will work in the latest release.

admin flex

Hey Adobe! What about us Flex developers?

July 21st, 2009

Having developed Flex for several years now I am getting really tired of Adobe’s lack of support for developers. I was hoping they would bring at least modest improvements to Flex Builder (now Flash Builder) 4, but it is not much better. Re-factoring support is almost non-existent, something I consider fundamental to the development process. Even simple renaming and moving of classes and variables doesn’t work properly.  Code Formatting is still missing.   And why can they still not get proper code navigation?  What I mean is why can you only navigate up the class hierarchy and not down?

The most painful part of the development experience for me is how slow visual design is. The visual editor is useless.  So all layout has to be done by hand.  But even making a single change to the layout of a component, it re-compiles the entire project.

And there seem to be an endless amount of bugs.  For example we recently found you can not have multiple projects that use locales.  Or odd behavior, like changing the server side support in project properties messes up the entire project.

If I where to choose a new UI framework today I would have to seriously re-consider whether to use Flex. I would want to look at the entire development eco-system around alternatives.  I think this is where JavaFX might be able to take the lead.  It all depends on what Oracle does with NetBeans and JavaFX of course, but we can always hope.

admin flex

End of Life for Anvil Flex

February 23rd, 2009

I have decided to stop development on anvil flex.  It had a good 2 year run, but it’s sorely out of date.  Mostly it has been replaced by other frameworks.  Flex has made dramatic changes in the past several years and made a lot of anvil out of date.  The Spring BlazeDS project provides much better back-end support and integration.  On the Flex side the biggest downside is most of the data is passed using custom events.  Today I would rewrite this using something like Swiz.

It has been really interesting developing anvil flex and I have learned a lot.  Probably the biggest lesson is how hard it is to keep an open source project up to date.  It gives you a much deeper appreciation for major open source projects and the amount of commitment it takes.

Some parts of anvil flex are still useful.  It allows dynamically loading and managing modules.  It also has a unique portal framework.  The code will remain available on sourceforge and provides some good sample projects.

admin flex

Anvil Flex is on Ohloh.net

February 3rd, 2009
Comments Off

Ohloh is a really great site with interesting metrics on open source projects. Here is the link to Anvil Flex.   It is interesting to look at the analytics, but not sure how where the 67,000 lines of XML come from.  I would believe the 20,000 lines of Action Script though!

Ryan Knight flex

Featured on Drunk on Software

January 21st, 2009
Comments Off

I was on Drunk on Software today.  Had a great talk with Jon Rose and James Ward about Anvil and Enterprise Flex.  This is my first time having my video on the web, but it turned out well.

Ryan Knight flex

An Introduction to Anvil

January 12th, 2009
Comments Off

OVERVIEW

Anvil was designed to help make enterprise flex projects easier and to provide a portal environment for running flex applications. Today Anvil best serves as a sample of how to build enterprise applications. We are working on making it easier to quickly create a customized environment for flex.

What we have found was the biggest challenge with developing a large enterprise framework was how to cleanly divide the application into multiple modules that can be built, maintained and loaded separately. One of the primary challenges with multiple modules is how to cleanly separate the handling of non-visual events. An example would be having one module call a service in another module. Another issue we ran into was how to isolate events with-in a module, especially if there is multiple copies of the same module in an application. An example of this is when you have a portal framework where the user can display the same sub-window multiple times. The standard event dispatcher does not work for these cases and most frameworks do not handle this situation either. For example the popular cairngorm framework was designed to only work in a monolthic environment and event handling gets messed up when you have duplicate copies of a module.

Anvil comes with two sample applications to help you get started. One is a basic sample in the basicSample directory and the other is Anvil Portal in the anvilPortal directory. The biggest difference is the basic sample does not use any security. The anvil/dist directory has pre-built war files so you can easily see what basic Anvil applications look like.

The anvil/dist directory also contains compiled distribution files of the core Shell flex library, the FlexMDI flex library, the shell and utility jar files and the war files for the basic sample and anvil portal.

In the shell directory is the core library files of Anvil for both the Flex and Java side. Then in the layouts directory is the primary visual layout library, FlexMDI, based on code from the Flex Lib project.

The utils directory contains a Java project with a number of utilities for working with Flex. This includes a tool to create ActionScript Data Objects from Java Data Objects. Another utility is Taz, a flex compiler built on top of mxmlc and compc that makes compiling large projects much faster and easier. There are samples of how to call Taz from ant build scripts. And the final utility is a FlexBuilder project file generator.

QUICK START

For the impatient here is a quick overview of setting up the sample applications. Install Java and Tomcat to just run the samples. We have a detailed post on this here. Also install Flex and Ant to build the samples. Be sure to setup the appropriate home environment variables, like JAVA_HOME, CATALINA_HOME, ANT_HOME and FLEX_HOME.

You can copy the sample war files out of the dist directory into your favorite servlet container. Then to run anvil use the following url in your browser:
http://localhost:8080/anvilPortal/

To rebuild the application you can run ant at any directory level. So running ant under shell will re-compile the shell and under anvilPortal will rebuild the sample. Running ant war will rebuild the war files under anvilPortal/build and basicSample/build.

SETTING UP FLEX BUILDER

To setup the Flex Builder project files for any subproject, cd to that directory and modify anvil.conf. Probally the only change will be to where you want it to output files and then run:
ant gen-proj

This will also work from the top level directory.

If you want to reset your project files run:
ant clear-proj

Then in Flex Builder go to file -> import -> other and then under General choose Existing Projects into Workspace. For the root directory first choose shell. Once you have shell imported and build, then import FlexMDI, anvilPortal and basicSample.

USING THE ANVIL UTILITIES

Both the Taz compiler wrapper and the FlexBuilder project file generator use the same config files. The root config file is called anvil.conf and contains the default values, like output directory and the order library files should be compiled in.

Then each project directory has its own config file, like anvilPortal.conf or basicSample.conf. This contains information about each application, module or library.

The files are very short and simplistic, hopefuly making it easy to configure new projects.
To run the taz compiler there is a common ant macro definition in flex.ant.xml called .

For an example of using it see the anvilPortal build.xml file.

To run the actionScript project generators there is a script in the root directory called runAsGen.sh.
This has the following parameters
1 – the input directory of the compiler java class files. By default it is in out/production/shell
2 – the library directories to scan for the necessary jar files
3 – the output directory – this defaults to newAsClasses

BUILDING YOUR OWN APPLICATION BASED ON ANVIL

By using the AnvilPortal framework as a template, you can jumpstart a Flex Application with a Java, Spring, and Spring Security back end. For now it requires a little bit of tedious copy and pasting, but hopefully in the future we can automate it with Maven.

First set up the basic directory structure for your project and then copy in the necessary files from Anvil. The way anvil portal is organized is their is one directory for each module and then inside of there a src/flex and src/java.

As you copy across the files, you will want to get rid of the .svn directories. The easiest way to do this is run this command from the starting directory of the project, before you import it into SVN!
find . -name ‘.svn’ | xargs rm -rf

Be sure to not put a * at the end, that will delete a lot more than expected!

Based on the AnvilPortal sample there are several file and directories we are going to need:

1 – The common ant build files from the anvil/dist:
flex.ant.xml java.ant.xml utils.ant.xml
2 – The config files from anvil/anvilPortal/etc – these are use to configure the basic security and java application options
3 – The /anvil/anvilPortal/web directory – be sure to delete the crossdomain.xml file! These file configure BlazeDS remoting and the starting web page
4 – From the main /anvil/anvilPortal directory copy the following files:
anvil.conf – This file configures the anvil compile process and the eclipse project file generator
common.ant.xml – This defines the common ant build tasks for the project. This makes it easier to reuse ant tasks across multiple modules.
build.properties – This defines the basic build properties
build.xml – The main build file

Now we need to modify the files to fit the new project. Here is a list of recommended changes:

1 – build.properties – change the project.name. Also if you want to use a non-standard directory layout you can change where the files are located in this file. project.root is the parent folder of the project. project.tail is the directory of the current module that is being compiled.
2 – In build.xml change anvil.root to point to the same directory as the project.root (or even better you could do a global search and replace across the entire project and replace anvil.root with project.root).
3 – Now in build.xml change the project name and the name of modules you are defining.
4 – Modify the config files in the etc directory according to your project.

Ryan Knight flex

Intro to flex mojo’s for maven

December 19th, 2008
Comments Off

Velo has put together some nice mojo’s for compiling flex with maven. Here is some quick tips on quickly settings up and using them. Note that you don’t even have to download the mojo’s to use them. They will be automatically downloaded the first time you compile your project.

The first thing to understand is that the mojo’s use the standard maven way of doing things and only use jar files and library files from a maven repository. That means that they don’t look in the flex sdk directory for the necessary files, so these need to be installed in your repository. Also I ran into the problem that compiling on a remote server I ended up needing the data visualization libraries?

First be sure you have the current version of maven, which is 2.0.9:

mvn -version

On the Mac OSX, maven 2.0.6 is installed be default. To upgrade just overwrite the files in /usr/share/maven

Now install all the necessary dependencies in your local repository. These are propietary jar files, so they can be distributed from a central repository.

First cd to your flex sdk directory and the under the lib directory. In there you should a whole bunch of jar files. Then run the following commands:

mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=license -Dversion=3.0.0.477 -Dpackaging=jar -Dfile=license.jar

mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=aglj32 -Dversion=3.0.0.477 -Dpackaging=jar -Dfile=aglj32.jar

mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=flex-fontkit -Dversion=3.0.0.477 -Dpackaging=jar -Dfile=flex-fontkit.jar

mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=rideau -Dversion=3.0.0.477 -Dpackaging=jar -Dfile=rideau.jar

Now it is likely that you will end up needing the data visualization libraries, so do the following.

cd to the flex frameworks dir flex-sdk-3.0.0/frameworks/libs and run the following commands:

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=datavisualization -Dversion=3.0.0.477 -Dpackaging=swc -Dfile=datavisualization.swc

then cd to the flex locale dir flex-sdk-3.0.0/frameworks/locale/en_US and run the following commands:

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=datavisualization -Dversion=3.0.0.477 -Dclassifier=en_US -Dpackaging=swc -Dfile=datavisualization_rb.swc

Now you are all set to run the flex compiler on your project! I have put a sample pom file here.

Here are a couple of tips to setting up your compile process:

1 – To configure all the different options of the compiler find the option you need on this page and then in your pom add it to the build -> plugins -> plugin (flex-compiler-mojo) -> configuration. For example I set the name of the sourceFile in there.

2 – To add library dependencies, for example swc libraries first add them to your repository. For example to use the flexlib files use the following command similar to this :

mvn install:install-file -DgroupId=com.googlecode.flexlib -DartifactId=flexlib -Dversion=2.4 -Dpackaging=swc -Dfile=flexlib.swc

Then add a dependency tag to your pom. In the sample it is the dependency with the flexlib artifact id.

The types can be one of the following:

external to -compiler.external-library-path

internal to -compiler.include-libraries

merged to -compiler.library-path

rsl to -runtime-shared-library-path for SWF files

caching to -runtime-shared-library-path for SWZ files

test to -compiler.library-path only for test running

Good luck!

Ryan Knight flex

Java and Flex Setup Tips

December 19th, 2008
Comments Off

I have put together fairly extensive instructions on setting up a complete development environment for flex, java and ant. You can read about after the jump.

Jump to Tips on Flex, Java, Tomcat, Ant, Mac OS X and Windows.

OVERVIEW

1) I like to install all the development tools under a common apps directory so they are easier to access from the command line. (i.e. apps on Unix systems or c:apps on Windows). Also there can be problems when accessing the Flex SDK from a directory with spaces in the path.

2) Environment variables on Unix systems (i.e. Mac OS X or Linux) are set with the export NAME=value. For example:

export JAVA_HOME=/apps/jdk1.6.0_04

Here is sample script that sets up all the necessary envrionment variables.

You can set the environment variables for the current window by running the following command:

. ./setjava.sh

FLEX SDK SETUP

The Flex SDK is only needed if your a building the project from the command line. On windows be sure there are no spaces in the path where flex is installed. This will break the build! We are currently using Flex SDK 3.

There are two ways you can set it up:

1) Download it from Adobe.

2) Use the Flex SDK that comes with Flex Builder.

After you have setup the Flex SDK you need to set the FLEX_HOME environment variable:

FLEX_HOME=c:appsflex_sdk_300477

or FLEX_HOME=/apps/flex_sdk_300477

JAVA TIPS

Anvil has been developed with Java 1.6 and is compatabile with 1.5 with some small changes.

When you install the JDK be sure to do a custom setup, so you can install in another directory other than the default which is c:progam files. I recommend using apps for everything.

After installing Java be sure to:

1) Set the JAVA_HOME environment variable to the home directory of java.

2) Add the Java bin directory to the FIRST of the PATH environment variable. There is often several versions of Java on your machine, so it needs to be at the first of the PATH environment variable.

3) From the command line test to be sure the right version of Java is running with the following commands:

a. java –version — This should return Java 1.6

b. on cygwin or Linux you can also run which java to be sure it was installed in the right directory.

SETTING UP TOMCAT

Installing Tomcat is as simple as unzipping it. Be sure to use Tomcat 5 or Later.

See the notes below about using the Tomcat server bundled with Adobe BlazeDS.

1) Download the Tomcat Core zip or tar file.

2) Unzip it into your apps directory (or the directory where you are putting all of your development tools).

3) Set the CATALINA_HOME environment variable to the home directory of where tomcat is. Catalina is just another name for tomcat.

4) To make Tomcat easier to run add the tomcat bin directory to the PATH environment variable. i.e.

export PATH=$PATH:$CATALINA_HOME/bin

or on Windows – %CATALINA_HOME%bin

5) You should now be able to go to the command line and run either:

Linux / Mac OS X varieties – <a href=”http://catalina.sh/”>catalina.sh</a> version

Windows – catalina.bat version

6) To run the Tomcat manager application you need to add an administrative user:

Under the tomcat home directory is a conf directory. In there modify the tomcat-users.xml file.

Add the following line to the file:

&lt;user username=”admin” password=”admin” roles=”manager,tomcat,role1″/&gt;

7) Sometimes when you run Tomcat you will get a conflict with the port it listens on. By default this is port 8080. On Blaze DS the port is changed to 8400. To change this modify the server.xml file in the conf directory.

Modify the line that starts with:

&lt;Connector port=”8080″ Also modify the shutdown port:

&lt;Server port=”8005″ shutdown=”SHUTDOWN”&gt;

Start tomcat from the command line by running:

Linux / Unix vareties – <a href=”http://catalina.sh/”>catalina.sh</a> run

Windows – catalina.bat run

9) You can also start tomcat in a new window by running <a href=”http://catalina.sh/”>catalina.sh</a> start. Tomcat will output the log file to the catalina.out file in the logs directory.

10) To connect to the tomcat manager use the URL:

<a href=”http://localhost:8080/manager/html”>http://localhost:8080/manager/html</a>

Adobe BlazeDS comes with a bundled Tomcat Server. Some things should be noted when using it with Anvil.

1) Under the Blaze DS Tomcat directory is a lib directory. Under there is an activemq4.1.1 directory. The libraries in this directory conflict with the anvil libraries. So this directory either needs to be deleted or moved out of the tomcat directory.

2) BlazeDS Tomcat runs on port 8400 so the URL is localhost:8400

3) Be sure to set the catalina home environment variable to the BlazeDS Tomcat Server, i.e. CATALINA_HOME= C:appsblazeds_b1_121307tomcat

SETTING UP ANT

Installing Ant is as easy as unzipping it. Ant is only needed if you want to build from the source

1) Download Ant and unzip it. It is recommended to put it in the apps directory.

2) Set the ANT_HOME environment variable, i.e. ANT_HOME= C:appsapache-ant-1.7.0

3) Add the ant bin to the PATH environment variable, i.e. %ANT_HOME%bin or $ANT_HOMEbin

4) You should now be able to test ant by running ant -version

JAVA ON MAC OS X TIPS

The latest Mac OS X now has Java 1.6 included, but it is not enabled by default.

2) Java on the Mac OS X is installed into the directory:

/System/Library/Frameworks/JavaVM.framework/Versions

From there you need to specify the version you want to use.

3) The Java binaries are in the Commands directory, instead of the usual bin directory. This breaks a lot of scripts. A simple fix is to cd to the Java home directory and run:

sudo ln -s Commands bin

sudo causes the command to be run with root permissions. ln -s creates a soft link from Commands to bin.

You can then modify the <a href=”http://setup.sh/”>setup.sh</a> script to point to the version of Java you want. Here is my file.

WINDOWS SETUP TIPS

The first tip for setting up Windows would be simply don’t! Move to another platform such as Ubuntu or Mac OS X if at all possible, it makes development so much easier!

1) Setting environment variables on Windows:

a. Right click on my computer or go to control panel and select system.

b. On the dialog box select the advance tab and then select environment variables.

c. Add a new environment variable

d. For example on my machine JAVA_HOME= C:appsjdk1.5.0_07

e. You can reference other environment variables using %NAME%. For example to add the Java bin directory related to the JAVA_HOME environment variable to PATH, you would add – %JAVA_HOME%bin to the FIRST of the PATH environment variable.

2) For Windows I recommend using Cygwin which provides a Linux-Like environment.

a. Download Cygwin and run the installer.

b. When you install cygwin you can change the view in the upper right from packages to full. Some optional packages that are worth installing are:

Subversion

OpenSSH

Ryan Knight flex