Tag Archive for 'ActionScript'

DistinctArrayCollection extends ArrayCollection

Newest Update: Please read “GroupingCollection -> HierarchicalCollectionView” for a(nother/ better) solution to this problem.

Previous Update: Please read “Distinct Data Providers with GroupingCollection” for a solution.

Have you ever needed to display distinct items from an ArrayCollection based on a property of the objects in the collection? Here’s an example. An ArrayCollection populates a DataGrid with a list of people displaying the following properties: name, job and position. Beside the DataGrid you would like to display a distinct list of the jobs and positions from the data provider.

Continue reading ‘DistinctArrayCollection extends ArrayCollection’

Flex Part 03: The ModelLocator

The ModelLocator is an Action Script Class that is stored in the model directory.

This is a concept used in every Cairngorm application (see here for example) but you don’t need the Cairngorm library in your project to use it. In fact, you don’t need to know anything about Cairngorm to get started.

About the name

The ModelLocator holds instances of Model Objects, making them easy to locate and accessible from anywhere in the application.

Benefits of using the ModelLocator

The ModelLocator will make Flex development easier and more enjoyable. Here’s how: All application data will be stored in one single place, accessible from anywhere in the application at any time. That one place is, of course, the ModelLocator.

Continue reading ‘Flex Part 03: The ModelLocator’

Flex Part 02: Value Objects & Model Objects

Value Objects

Value Objects are ActionSrcipt classes which are stored in the project’s vo directory.

Think of a Value Object as a row in a database table. Let’s imagine a table named
schools with columns for name, phone, address and ranking. Imagine also a related table of students.

Table: schools (one school has many students)
+------------+---------------+
| Field      | Type          |
+------------+---------------+
| id         | Number        |
| name       | String        |
| phone      | String        |
| address    | String        |
| ranking    | Number        |
+------------+---------------+

Table: students
+------------+---------------+
| Field      | Type          |
+------------+---------------+
| id         | Number        |
| school_id  | Number        |
| name       | String        |
+------------+---------------+

Each row in the schools database table will have several properties which effectively describe a single School. The properties of a School contain simple values: strings, numbers, dates etc. This is the essence of a Value Object (VO).

Continue reading ‘Flex Part 02: Value Objects & Model Objects’

WordPress Code & Syntax Highlighter Plugins

Current: I am now using the IG:Syntax Highlighter plugin. This plugin has many features that the others mentioned do not. The plugin is used by wrapping code in the post editor in [language]code here[/language] tags.

Previously: I was using the WP-Syntax plugin for displaying code. This plugin is used by wrapping code in the post editor in <pre lang="language">code here</pre> tags.

Let's see some ActionScript 3.0:

Actionscript:
  1. package {
  2.     class HelloWorld extends HelloUniverse implements ISay {
  3.         /**
  4.          * Constructor
  5.          */
  6.         public function HelloWorld()
  7.         {
  8.             trace("Hello World!");
  9.         }
  10.     }
  11. }

The IG:Syntax Highlighter is available here

The WP-Syntax plugin is available here.