/metafas3

A small MVP framework for AS3, featuring runtime HTML5 views.

Primary LanguageActionScriptMIT LicenseMIT

Metafas3

Metafas3 (pronounced "metaphase") is a small MVP framework for AS3, inspired by Ruby on Rails, implementing the Supervising Controller/Presenter pattern. Metafas3 is built upon the Sprouts project-generation tool for ActionScript/Flash/Flex/AIR.

Why Metafas3?

  • MVP: Metafas3 implements the Supervising Controller/Presenter pattern as defined by Martin Fowler. Metafas3 is opinionated software, where Views are meant to be declarative and "dumb", Controllers to be event handlers for user gestures, and Models to provide business logic and data validation.
  • Runtime Views: Metafas3 X/HTML5 views may be compiled into the .swf, or loaded and rendered at runtime.
  • Lightweight: Less than 150k (and dropping) for a fully-loaded .swf compiled with fl.controls.ComboBox, RadioButton, CheckBox, TextInput, Button and UILoader. The equivalent .swf built with Flex exceeds 400k.
  • Declarative: Like Flex, Metafas3 provides a declarative markup language (X/HTML5) for views.
  • Data Bindings: Like Flex, Metafas3 provides a simple declarative data-binding syntax.
  • Validations: Like Flex, Metafas3 provides in-UX validations. Unlike Flex, Metafas3 applies validations in the Model layer, not in the View layer. The only exception: Like Flex, Metafas3 provides a shortcut 'required="true"' syntax for simple view-defined validations.
  • REST: Inspired, and partially copied from, Ruby on Rails, Metafas3's ReactiveResource models provide a simple method for interacting with REST web services.
  • BDD/TDD Unit Testing: Thanks to Sprouts, Metafas3 provides two automated testing suites:AS3spec and AsUnit.

Quick Start

Install Ruby, RubyGems

Windows XP, Vista, 7?

The Ruby Installer for Windows provides Ruby and RubyGems.

OSX 10.5, 10.6 (Leopard, Snow Leopard)

Xcode provides Ruby and RubyGems. Download from Apple or install from Developer Tools DVD.

OSX 10.4 (Tiger), 10.3 (Panther)

The Ruby One-Click Installer for OSX provides Ruby and RubyGems.

Other operating systems

Ruby installation instructions for other platforms

RubyGems installation instructions for other platforms

Install Sprouts

Open your favorite terminal emulator (Win: Console, PuTTY; Mac: iTerm, Terminal):

$ sudo gem install sprout

Windows users do not type "sudo". Mac users should also install the rb-appscript gem:

$ sudo gem install rb-appscript

Why Sprouts?

The Sprouts project provides a well written answer to that question. I'm not going to copy the entire Sprouts manual here. ;P

Try the Examples

See the examples/ directory.

Copyright and License

Copyright (c) 2009, 2010 Michael Fleet <fantasticmf.com> and friends. metafAS3 is free software, licensed under the terms of the MIT license. See LICENSE for details.