Archive for the ‘Flex’ Category

Flex based Land Rover US Certified Pre-Owned Inventory Search

Wednesday, March 3rd, 2010

We have just launched a site for Land Rover in the US, it is designed to be a rich user experience for finding a certified pre-owned Land Rover cars in the USA.

View it at Land Rover Certified Pre-Owned Inventory Search by selecting the Enter Flash Site option.

Non-US users; why not try 90210 for the Zip Code :-)

It is power by Flex and ColdFusion technologies.


Flex Enumerator Class

Monday, January 25th, 2010

This is my take on creating an Enumerator class in Flex.

AS3 does not support Enumerators so a class with static constants is used as per the Java Enumerator class pattern.

This implementation is type safe and final. It also contains static helper functions; values() which returns an array of the Enumerator objects (useful for iterations) and getByValue() which allows for easy retrieval of a typed Enumerator object from its primitive value.

  1.  
  2. package
  3. {
  4. import flash.errors.IllegalOperationError;
  5. import flash.utils.Dictionary;
  6. import flash.utils.describeType;
  7.  
  8. /**
  9. * Example Enumerator Representing different RGB Colors
  10. */
  11. public final class ColorEnum
  12. {
  13. /* PUBLIC */
  14.  
  15. public static var RED:ColorEnum = new ColorEnum('RED', PrivateEnforcer);
  16. public static var GREEN:ColorEnum = new ColorEnum('GREEN', PrivateEnforcer);
  17. public static var BLUE:ColorEnum = new ColorEnum('BLUE', PrivateEnforcer);
  18.  
  19.  
  20. /**
  21. * Constructor
  22. */
  23. public function ColorEnum(value:String, privateEnforcer:Class)
  24. {
  25. // Force private call only
  26. if (privateEnforcer != PrivateEnforcer)
  27. {
  28. throw new IllegalOperationError("Invalid constructor access");
  29. }
  30.  
  31. // Add Enum value
  32. this._value = value;
  33. }
  34.  
  35.  
  36. /**
  37. * Get all Enumerator Values
  38. */
  39. public static function values():Array
  40. {
  41. /* LOCALS */
  42. var values:Array = new Array();
  43. var value:ColorEnum = null;
  44.  
  45. if (ColorEnum._values == null)
  46. ColorEnum.buildValues();
  47.  
  48. for each (value in ColorEnum._values)
  49. values.push(value);
  50.  
  51. return values;
  52. }
  53.  
  54.  
  55. /**
  56. * Get an Enumerator instance by its primative value
  57. */
  58. public static function getByValue(value:String):ColorEnum
  59. {
  60. if (ColorEnum._values == null)
  61. ColorEnum.buildValues();
  62.  
  63. return ColorEnum._values[value] as ColorEnum;
  64. }
  65.  
  66.  
  67. /**
  68. * override value
  69. */
  70. public function valueOf():Object
  71. {
  72. return this._value;
  73. }
  74.  
  75.  
  76. /**
  77. * override toString
  78. */
  79. public function toString():String
  80. {
  81. return this._value;
  82. }
  83.  
  84.  
  85.  
  86. /* PRIVATE */
  87.  
  88. private var _value:String = '';
  89.  
  90. private static var _values:Dictionary = null;
  91.  
  92.  
  93. /**
  94. * Build static dictionary of all Enum consts and values
  95. */
  96. private static function buildValues():void
  97. {
  98. /* LOCALS */
  99. var metaData:XML = describeType(VehicleTypeEnum);
  100. var node:XML = null;
  101.  
  102. // Create values Dictionary
  103. ColorEnum._values = new Dictionary();
  104.  
  105. // Add Each Enum const and value
  106. for each (node in metaData.children())
  107. {
  108. if (node.name() == 'variable' && node.@type == metaData.@name)
  109. ColorEnum._values[ColorEnum[node.@name].toString()] = ColorEnum[node.@name];
  110. }
  111.  
  112. }
  113. }
  114. }
  115.  
  116. class PrivateEnforcer {}

Flex based Jaguar Certified Pre-Owned Inventory Search

Sunday, December 27th, 2009

For those of you in the US who have had to use UK Postcodes to try out our Used Vehicle Locators, struggle no more! We have just launched a site for Jaguar in the US.

It is designed to be a rich user experience for finding a certified pre-owned Jaguar car in the USA.

View it at Jaguar Certified Pre-Owned Inventory Search by selecting the Enter Flash Site option.

Non-US users; why not try 90210 for the Zip Code :-)

It is power by Flex and ColdFusion technologies.


Flex based Kia Used Car Locator

Sunday, November 8th, 2009

Our flex based used car locator application continues to shift like hot cakes.

The latest one is for Kia UK and is meant to be a rich user experience for finding an approved user car.

View it at Kia used cars by selecting the Enter Used Vehicle Locator option.

It is power by Flex and ColdFusion technologies.


Flex based Land Rover used car locator

Friday, July 10th, 2009

We launched yet another flex application a few days ago.

It is a user car locator for Land Rover UK and is meant to be a rich user experience for finding an approved user car.

View it at Land Rover used cars by selecting the Rich Experience option.

It is power by Flex and ColdFusion technologies.


Flex based Mazda used car locator

Sunday, May 17th, 2009

We launched another flex application a few days ago.

It is a user car locator for Mazda UK and is meant to be a rich user experience for finding an approved user car.

View it at Mazda used cars by selecting the Rich Experience option.

It is power by Flex and ColdFusion technologies.


Flex based Jaguar used car locator

Wednesday, December 3rd, 2008

We launched the project I have been working on the last few months a few days ago.

It is a user car locator for Jaguar UK and is meant to be a rich user experience for finding an approved user car.

View it at Jaguar used cars by selecting the Rich Experience option.

It is power by Flex and ColdFusion technologies.


Storing Typed Objects in Flex’s Local Shared Objects

Saturday, August 2nd, 2008

Flex's Local Shared Objects provide a convenient way to persist data on the client, in a similar way that cookies are used in web applications. Shared Objects are much more powerful however, allowing the persisting of structured data, with a default client set limit of 100kB of storage.

Typed objects can be added to the store by setting properties of the Shared Object's data property to the value of the typed object (Example). However by default, when the object is read from the store, it will lose its type information and cannot be cast to type either. To make the object retain its class info, you must register the class before persisting. This is done using the registerClassAlias function. This is called with the full class name (package.Class) and the class itself.

Each class and sub-classed of the object must be registed this way, if you want to persist complex objects such as Value Objects and Presentation Objects (used with a presentation model). The easiest way to achieve this is to add the [RemoteClass] meta data to each class definition.


Embedding Multiple File True Type Fonts in Flex

Friday, January 18th, 2008

Many True Type Fonts (TTF) are made up of multiple .TTF files. One file will be for the normal font, while another file is for the Bold version of the Font. For example, the Verdana font that comes with Windows XP consists of four separate files.

The following code shows how to include multiple TTF files into a Flex CSS file.

  1. @font-face
  2. {
  3. src:url("font/verdana.TTF");
  4. font-family: EmbeddedVerdana;
  5. font-weight: normal;
  6. font-style: normal;
  7. }
  8.  
  9. @font-face
  10. {
  11. src:url("font/verdanab.TTF");
  12. font-family: EmbeddedVerdana;
  13. font-weight: bold;
  14. font-style: normal;
  15. }
  16.  
  17. @font-face
  18. {
  19. src:url("font/verdanai.TTF");
  20. font-family: EmbeddedVerdana;
  21. font-weight: normal;
  22. font-style: italic;
  23. }
  24.  
  25. @font-face
  26. {
  27. src:url("font/verdanaz.TTF");
  28. font-family: EmbeddedVerdana;
  29. font-weight: bold;
  30. font-style: italic;
  31. }
  32.  
  33. Application
  34. {
  35. font-family: EmbeddedVerdana;
  36. }

Rotating Text in Flex

Friday, January 11th, 2008

The Flex docs tell you that in order to use Fade effects with Text controls, you have to embed a True Type Font to use in the Flex application. The default Fonts available within Flex (Aerial, Verdana etc) will not fade.

This also applies to rotating Flex controls, which is not mentioned in the docs - as far as I can see.


Copyright © 2005, David Beale

  • Valid XHTML 1.0!
  • Valid CSS
  • Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0