Site Contents
My Blog
Wireless & Networking
Hardware & Gadgets
Software Picks
Contact Me

My Articles & Papers
Flex Performance
Server/Client Under the Hood
Multiple Instances of CFMX
Multiple Instance Config
NLB with ColdFusion
Clustering CFMX for J2EE
Multi-Tier Hardware LB w CFMX
Cisco CSS & Coldfusion MX
JRun 4 Jini based Clustering
WiFi Growth

2ID Tacweb

Other Hobbys
Body-For-Life Challenge

Personal Projects
Family Pool
Deck Gate



Welcome to, the personal homepage of Brandon Purcell. I started building many, many years ago to share information I ran across everyday in my role as a Support Engineer and Consultant for Macromedia/Adobe. As a support engineer and consultant I always had a lot to blog about but as I moved into managment roles at Adobe my technical content dwindled.

I currently work as the Director of Technology for Universal Mind. My primary responsiblity is managing the SpatialKey project and it has been an amazing experience. I have been spending a lot of time working with Amazon Ec2 and will share my experiences through the blog in the future. I truly believe that Cloud Computing is the IT platform of the future and we have built the SpatialKey architecture on top of Ec2.

Viewing Individual Entry / Main
January 26, 2005

The validators that are provided in Flex cannot be localized or have the error strings easily changed because they cannot have an id, which means they cannot be accessed from script and you cant bind objects that dont have an id. One solution is to subclass the various validators and override their error string properties so they access variables in the application. Then all you have to do is load in strings into those variables and youre all set.

In the example, if you type xyz and hit tab, you will see the validator kick in with the custom message from the app, that calls the invalidCharError() and in the AS file you will see that it returns the string defined in the MXML file. You can also type in a custom error in the second TextInput and change the error on the fly allowing you to localize the errors easily from an XML file or other source. Also try typing in 123 and hitting tab on the first input and you will see another customized error message. Just locate the different methods in the MXML AS API and override each of the methods you need custom errors for.Note that the validation logic itself doesnt change at all you are just overriding the error messages.

Thanks to Alex for providing a starting point for this example. You can download the code here and it is also shown below

MXML file:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" >
 var invalidCharError:String = 
 "Default Error for Invalid Phone Number!!";
 var wrongLengthError:String = 
 "Hey dummy the phone number needs to be at least 10 digits long!!";
   <mx:Model id="myModel">
   <MyPhoneNumberValidator xmlns="*" 
      field="myModel.employee.phoneNumber" />
 <mx:Label text="Phone Number"/>
 <mx:TextInput id="phone" />
 <mx:Label text="Custom Error Message"/>
 <mx:TextInput id="newError"/>
 <mx:Button click="invalidCharError = newError.text" 
 label="Change Error Message" />

Subclassed Validator (

// Simple age validator.  
//   Verifies: AS components
class MyPhoneNumberValidator extends mx.validators.PhoneNumberValidator
 // The default is "Invalid characters in your phone number."
 public function get invalidCharError():String
  return mx.core.Application.application.invalidCharError;
 // The default is "Your telephone number must be at least 10 digits in length."
 public function get wrongLengthError():String
  return mx.core.Application.application.wrongLengthError;


After I posted this I realized that Matt Chotin had an answer for this as well.

This post is throwing errors on your RSS feed. I tend to browse your blog through an Aggregator so I'd realy appreciate if you could fix this line:-

Then all you have to do is load in strings into those variables and you're all set.

You need to fix the apostraphe in you're.


Simon Baynes


      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

Subject Archives
Amazon EC2 (15)
ColdFusionMX (155)
Corvette (3)
Flash Lite (4)
Flash Media Server (5)
Flash Player (3)
Flex (39)
General Web Dev (14)
HDTV (3)
Jboss (1)
Jquery (2)
JRun (59)
Max 2003 (3)
Other (33)
PC Hardware (16)
Software (17)
SpatialKey (7)
Wireless (8)
Working Out (1)

RSS Feed
Feed Listing
Corvette - October 2005 brandonpurcell's Corvette - October 2005 photoset
Macromedia ColdFusion MX

Featured Links
Stock Footage
Page Render Time:203 user:""