Developing Android applications with Flash Builder

The first step is to install the AIR 2.5 sdk

Go to the page on Adobe AIR for Android at Adobe Labs. Signup for the prerelease.

Follow all the steps necessary to download the AIR 2.5 sdk. Unzip the archive. You should end up with a folder of the like:

AIR25_mac_sdk_20100517

Navigate to the sdks folder of FlashBuilder, within the Application folder.

/Applications/Adobe\ Flash\ Builder\ 4/sdks/

Assets for mini-game content

I attended Scratch day last Saturday. The Wellington event was organized by Learning Media. A very successful event.

I mentioned that I had a few sprite and game assets stored somewhere on my hard disk. I was invited to share. It may take me some time to sort them all.

Here is a starter.

Developing Android applications with Flex

I am lucky enough to have a Nexus One (my first smartphone). That means that I can experiment with Flex on touch phones.

I will provide more details as I continue to experiment. I had a quick go at producing a hello world solution. Well, that was a conference name badge ("hello my name is") but you get the idea.

Flash Player 10 on Android

Quite gobsmacked. I have now Flex applications running on my Nexus one.

There were some rumours of Froyo only available in June. Then other rumours of it being already pushed over the AIR. But that appeared to be mostly for phones given to the Press.

Thanks to giz http://bit.ly/cF9os6 got froyo on the nexus1.

Once Froyo was installed, I had to point the browser on the device to the labs download page

http://labs.adobe.com/downloads/flashplayer10.html

States in components inheriting from a custom class

A standard recommendation is to separate view from controlling code. A good way to achieve this in Flex is to have a mxml class that contains nothing but view and to move all the controlling code to a superclass.

LoginScreen.mxml


<p:LoginScreenClass xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:p="path.to.LoginScreenClass.*" />

LoginScreenClass.as


package path.to.LoginScreenClass
{
import mx.containers.VBox;
public class LoginPanelClass extends VBox {}
}

Model View Controller

Writing this down as a reference card:

Elements of the triad

MODEL

  • models a real world system by emulating its state and functionality.
  • defines queries for reporting state, commands for altering state, and notifications to inform observers (that is, views) that a change has occurred

CONTROLLER

  • responsible for defining the behavior.
  • receive mouse and keyboard input and map this user stimulus into application response – by executing the model's command, for example.

VIEW

  • manages a rectangular area of the display and is responsible for data presentation and hit testing.

Coupling

VIEW (listen to events from controller, read from model)

  • always knows about the model, listening to messages but also reading directly from the model. It should never write to the model.
  • every view keeps a reference to its model. Because a view knows about its model but a model doesn't know about a view, a single model can act as the model for many views.

MODEL (dispatch and listen to events)

  • should never have a reference to the view or the controller. It communicates with other components by way of messages (loose coupling).
  • export its services through queries, commands, and notifications to any interested party. Therefore, the view and controller should have one-sided knowledge of their model's capabilities.

CONTROLLER (dispatch events to view, write to model)

  • knows about the model and has for job to update it in response to user interaction or system events.
  • view and controllers are tightly coupled, sometimes reduced to a single class (model-view).
  • typically, the controller will create the passive view (the component that don't receive any user interaction) as well as the interactive elements.
  • when the controller receives a mouse event, its first order of business is to request a hit test from the view. The view returns the hit object, and the controller decides what to do with it.

[Adapted from 'Advanced Actionscript 3 with Design Patterns', by Joey Lott and Danny Patterson; Distributed MVC: An Architecture for Windows® DNA Applications]

Flex Builder autocompletion problems

Writing this down as a memory refresher as I bump across the issue on a regular basis.

On some projects, autocompletion seems to not work properly. In particular, within the flash package. flash.events.Event, flash.display.Bitmap are nowhere to be seen. If you add them manually, it compiles fine. But if you make any change to your script, then Flex Builder may attempt to reorganize your import statements and the flash.events or flash.display imports disappear most annoying.

Cutouts and Blends

Exploration of Blend effects and how they apply on a cutout masking an image.

This is a strictly actionscript project. Control panels come from the minimalComps library by Keith Peters.



Demo | Source

Terrain Editor

Something I had wanted to figure out. The LandscapeMapEditor on wondefl provided all that was required to get started. The original code was under a MIT license and that license is therefore carried on.

This is a strictly actionscript project. Label and InputText controls come from the minimalComps library by Keith Peters.

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

NOTE. It looks like I changed the controls for the diameter of the circle. Use the up arrow and down arrow to increase/decrease the radius of the circle.

Demo | Source

Terrain generation in Flash

Background Information

Generating Random Fractal Terrain by Paul Martz. A good overview of the theory behind terrain generation (midpoint displacement and other techniques).

Actionscript 3

An extensive list of links on terrain rendering in Flash by Bruce Jawn

Impressive ones at wonderfl

Code found on wondefl can be executed within Flex Builder. Create a project File > New ... > Actionscript Project. Make sure that you have the Flex SDK 3.5 installed and that this project makes use of it (Project > Properties > Actionscript Compilers > Flex SDK Version). If Base64Decoder is required for the project to run, download the SDK source for 3.5. Locate mx.utils.Base64Decoder. In your project, create a folder mx/utils/ and copy there the class Base64Decoder. Delete the line that define the resource metadata as this requires the Flex framework (not included in an Actionscript project). Run your project,

Syndicate content
Powered by Drupal, an open source content management system