Flex - IPValidator
{
import mx.validators.Validator;
import mx.validators.ValidationResult;
public class IPValidator extends Validator {
// Define Array for the return value of doValidation(). private var results:Array;
// Constructor. public function IPValidator() {
// Call base class constructor. super();
}
// Define the doValidation() method. override protected function doValidation(value:Object):Array {
// Clear results Array. results = [];
// Call base class doValidation(). results = super.doValidation(value);
// Return if there are errors. if (results.length > 0)
return results;
if (String(value).length == 0)
return results;
var pattern:RegExp = /\b(25[0-5]|2[0-4][0-9]|[01]?[0-9]
[0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4]
[0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/;
var r:Array = pattern.exec(String(value));
if (r == null)
{
results.push(new ValidationResult(true, null, "NaN",
"You must enter an IP Address"));
return results;
}
return results;
}
}
}
Clarifying the Definition of Frameworks
Developing Flex RIAs with Cairngorm Microarchitecture
- Part 1: Introducing Cairngorm
Author: Steven Webster
Link: http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html
In software development, the term framework is one of the most overloaded and overused terms within and between development teams. When developers write large pieces of code that they consider significant enough to consider leveraging on other projects, they tend to supplement the code with this term. Thus there are many types of frameworks: persistence frameworks, transaction frameworks, logging frameworks, aspect-oriented frameworks, animation frameworks, unit-testing frameworks, and the like.
Application Frameworks
When a framework provides highly granular class libraries that give a high degree of flexibility to application developers, or when a framework provides application-level services that are useful across multiple developer projects, I call it an "application framework
Architectural Frameworks
Architectural frameworks are different beasts entirely. Typically the job of an architectural framework is not to provide any additional services to application developers except an infrastructure around which an application can hang--to provide the skeleton or internal structure of moving parts, around which the flesh and muscle particular to a business domain can be layered.
What Cairngorm Teaches You
Cairngorm is a microarchitecture that addresses three key areas that we have always tried to provide as best-practice recommendations for our customers and partners:
Handling user gestures on the client Encapsulating business logic and server interactions Managing state on the client and representing this state to the user interface Cairngorm offers a microarchitecture (collection of design patterns) that aids us in consistently solving these recurring design challenges.
Cairngorm is an architectural framework that provides a suggested implementation of a technical architecture upon which you can build your own, more complex, application-specific architectures.
By basing your application on the Cairngorm architecture, however, there are some generic and fundamental design challenges that you won't have to solve by yourself while leveraging the benefits inside Flex, such as how to handle user gestures in an elegant fashion, how to handle server interaction and business logic in an elegant and scalable fashion, and how best to manage state on a rich and immersive client application.
How to Use Tween in an ActionScript Project (Flex Builder 2)
To use the Tween class in an ActionScript Project in Flex Builder 2 you must include all dependent class libraries in the application's library path. Specifically, you must include the Flex framework's framework.swc and the appropriate version of framework_rb.swc, depending on the current language.
Using the TabNavigator Container
All will load all the infomation on all the tab at the begining.
Auto will load the information once tab is selected.
None you control the loading of the infomation.
Event Handlers using Inline ActionScript
Examining Flex events and funtionalities of AS3 that we have at our disposal.
Architecting an Application with MXML Components
One thing you want to avoid when creating a Flex application is one big long MXML file. Divide the API with separate blocks and managable pieces. All of the components will be initiated within the main mx:Application tag and the component wont have and mx:Application tag.
