I created an example application to manage users for groups. For that used the database MySQL and in a database with two tables (group, user). To leave of this created CFCs ORM for them, with their respective files services, which here I called DAO, then grouped all DAOs' Operations in Facade. In Flash Builder created the Pointing you the classes CFC ORM, and a ModelLocator as controler pointing destination ColdFusion contend Facade CFC.

Accompany the of this mini application.

Since my last post about Flex containing script, already does time, to break that ice, I am going to show you "the way" to automate creation forms in Flex.For that are going to start by the class Event. We will call this class CustomEvent, your objective will be create a validator inside the event (mx.events.FlexEvent) creationComplete of the field, was necessary add three properties of the class, which are: validateType of the Object type who will receive the information to configure validator, validator of the special type so that it get easier to working with several validators different (here I am going to just to work with mx.validators.StringValidator and mx.validators.EmailValidator) and the constant containing event's name that is going to characterize the configuration called VALIDATECHANGE.

/**
 * 
 * @author Pedro Claudio
 * @see mx.events.FlexEvent 
 */

package core.events {

import flash.events.Event; import mx.events.FlexEvent; import mx.validators.EmailValidator; import mx.validators.StringValidator; public class CustomEvent extends FlexEvent

{ static public const VALIDATECHANGE:String = 'validatechange'; private var _validateType:Object; private var _validator:*; public function CustomEvent(type:String,validateType:Object, bubbles:Boolean=false,cancelable:Boolean=false)

{ super(type, bubbles,cancelable); setValidator(validateType); }

public override function clone() : Event {

return new CustomEvent(CustomEvent.VALIDATECHANGE,validateType); }

public override function toString():String {

return formatToString('CustomEvent','type', 'bubbles', 'cancelable', 'validateType','validator'); }

public function get validateType():Object {

return _validateType; }

public function get validator():*

{ return _validator; }

private function setValidator(params:Object):void

{ if(params.validateType.length < 1){

return; } _validateType = params; switch(params.validateType){

case 'string': case 'noblank': _validator = new StringValidator(); if(params.message.length > 0){

_validator.requiredFieldError = _validator.requiredFieldError = _validator.tooLongError = _validator.tooShortError = params.message; }

_validator.minLength = 1; break; case 'email': _validator = new EmailValidator(); if(params.message.length > 0){

_validator.requiredFieldError = _validator.invalidCharError = _validator.invalidDomainError =

_validator.invalidIPDomainError = _validator.invalidPeriodsInDomainError = _validator.missingAtSignError = _validator.missingPeriodInDomainError =

_validator.missingUsernameError = params.message; } break; }

_validator.source = params.source; _validator.property = params.property; _validator.required = params.required; _validator.triggerEvent = params.triggerEvent; _validator.enabled = true; } }

}

Validators are classes/tags separated of the field, to speed the development we will need the validators in the field, for that are going to manipulate a class based on TextInput (spark.components.TextInput), of form to allow of the basic configuration of validator in tag, we will work with for tag CustomInput adding these attributes, which are them: validateType that will distinguish the type of validator, message containing the text that will be sent to the navigator in case error, required characterizes as required or not. For internal manipulation were created the properties: _initialized responsible in inform if is the first time that the valitor will be created, _params responsible in the storage the configurations for the creation of validator, e _validator o validator.

/**
 * 
 * @author Pedro Claudio
 * @see spark.components.TextInput 
 */
package core.mxml
{

import core.events.CustomEvent; import core.model.CustomModelLocator; import mx.events.FlexEvent; import mx.utils.ObjectUtil; import spark.components.TextInput;

"validatechange", type="core.events.CustomEvent")]

public class CustomInput extends TextInput {

private var _initialized:Boolean = false; private var _params:Object = {validateType:'',message:'',source:'',index:'',property:'text',required:false,triggerEvent:'change'};

private var _validator:* ; private var _model:CustomModelLocator;

private var _validateType:String; private var _message:String = ''; private var _required:Boolean = false; private var _index:int; private var _source:String; public function CustomInput()

{ _model = CustomModelLocator.getInstance(); super(); addEventListener(FlexEvent.CREATION_COMPLETE,onCreationComplete); }

private function dispatchEventCustom():void{ _params.validateType = _validateType; _params.message = _message; _params.required = _required; _params.source = this; _params.index = _index; dispatchEvent(new CustomEvent(CustomEvent.VALIDATECHANGE,_params)); }

private function onCreationComplete(event:FlexEvent):void {

id = this.id = super.id = name; addEventListener(CustomEvent.VALIDATECHANGE,setValidator); dispatchEventCustom(); _initialized = true; }

public function get validator():* { return _validator; }

private function setValidator(event:CustomEvent):void {

enabled = true; _validator = event.validator; _model[_source][event.validateType.index].validator = event.validator;

//event.currentTarget.parent.parent.dataConfig[event.validateType.index].validator = event.validator; } public function get validateType():String

{ return _validateType; } "validatechange")] "noblank,string,email", name='validateType')]

public function set validateType(v:String):void {

_validateType = v; if(_initialized){ dispatchEventCustom(); }

} public function get message():String {

return _message; }

'String', name='message')]

public function set message(v:String):void {

_message = v; }

public function get source():String

{ return _source; }

'String', name='source')]

public function set source(v:String):void {

_source = v; }

public function get required():Boolean

{ return _required; } 'Boolean', name='required')]

public function set required(v:Boolean):void {

_required = v; }

public function get index():int

{ return _index; }

public function set index(v:int):void

{ _index = v; }

}

}

The field will be created in the model of the class Form (mx.containers.Form), and as I want to let my form more generic, in other words, I want ids, labels and validadores more flexible, enabling a dynamic creation. Then it was created the tag CustomFormBase, which will receive the data for configuration of form, dynamically, in an unique property, and still will receive the action of submit (which was not worked so profoundly).

/**
 * 
 * @author Pedro Claudio
 * @see mx.containers.Form 
 */
package core.mxml

{ import core.model.CustomModelLocator; import flash.events.MouseEvent; import mx.collections.ArrayCollection; import mx.containers.Form; import mx.controls.Alert; import mx.events.FlexEvent; import mx.validators.Validator; import spark.components.Button;

public class CustomFormBase extends Form

{ public var send:Button; private var _source:ArrayCollection; private var _model:CustomModelLocator; private var _dataConfig:String; public function CustomFormBase()

{ _model = CustomModelLocator.getInstance(); super(); addEventListener(FlexEvent.CREATION_COMPLETE,doCreationComplete); }

private function doCreationComplete(event:FlexEvent):void {

send.addEventListener(MouseEvent.CLICK,submit); } protected function submit(event:MouseEvent):void {

var _validators:Array = new Array(); for(var i:int=0;i<_source.length;i++){

_validators.push(_source[i].validator); } _validators = Validator.validateAll(_validators); if (_validators.length == 0) {

Alert.show("Preenchimento correto", "SUCCESSO"); } }

public function get source():ArrayCollection

{ return _source; } public function get dataConfig():String

{ return _dataConfig; } 'String', name='dataConfig')]

public function set dataConfig(v:String):void {

_dataConfig = v; _source = _model[v]; }

} }

Our first MXML is very simple, using the class Repeater (mx.core.Repeater), disposing the tag of the way we wish for they are vizualizadas.

<?xml version="1.0" encoding="utf-8"?>
<!--
 @author Pedro Claudio
 @see core.mxml.CustomFormBase
-->
<mxml:CustomFormBase
        xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/halo"
        xmlns:mxml="core.mxml.*">

<mx:Repeater id="configure" dataProvider="{source}"> <mx:FormItem label="{configure.currentItem.label}" width="100%">

<mxml:CustomInput width="100%" source="{dataConfig}" name="{configure.currentItem.id}" message="{configure.currentItem.message}" required="{configure.currentItem.required}" validateType="{configure.currentItem.validateType}" text="{configure.currentItem.text}" index="{configure.currentIndex}" />

</mx:FormItem> </mx:Repeater> <mx:FormItem width="100%" horizontalAlign="right"> <s:Button id="send" label="Submit" /> </mx:FormItem>

</mxml:CustomFormBase>

Already that we create a construction standard, we will continue in him, separating ActionScript of the MXML during the creation of the reference file of the

[More]

Lee Brimelow it was last week here in South America (Salvador, Brasília, Rio de Janeiro, São Paulo and Bogotá, following the visits order) and it keep animating with the number of people involved with the Platform Flash, and it is proposing workshops, the only expense for the group/company/event would be the transportation.

See the proposal and between in touch with him direct by blog http://theflashblog.com/?p=1323

In the events the group has been asking Posters Flex, as I do not have printed, goes ouch pdf with Diagrams all Flex 3, of AIR and of AS3.

[More]

The Spark project it is an excellent initiative, kept by the Community Flash/ActionScript Open Source in Japan, which owns a repository SVN with countless examples and codes/classes.

[More]

The Adobe Tour will be in Brazil in days 16/08, 18/08 20/08, with the focus in the Platform Flash, the Evangelist who will be talking for we is Lee Brimelow.

[More]

ColdFusion comes forming pair with applications RIA since the birth of the term, and ColdFusion 9 improved this integration, allowing services ColdFusion are accessed by applications Flex directly, without needing of scripts in the server to do client's bridge with the service, here I am going to show how configure this Service ColdFusion available, and as this service should be configured in a project Flex.

Access ColdFusion Administrator by the browser, and soon after in tab Security the section Allowed IP Adresses, and it insert IP of the server that will execute the services requisitions. (image 1)

[More]

The Adobe makes available a vast material study for certification with its own livedocs, but the first step is to know about the exam, how she is divided, which the price of her, which the validity. The current certification costs U$150,00 and you only can sign with the certification, without specifying the version, when you have the current certification.

There is no exam of certification in Portuguese. In the file ACE_Exam_Guide_ColdFusion8.pdfit is possible to obtain the information on the exam ColdFusion, with a brief example of the proof. The exam Flex is found in English, French and German.

For studies ColdFusion recommend my Application.cfc in ColdFusion 8, the livedocs (uma dica, muita atenção nas notas em itálico), and the application CF8 Exam Buster.

In the studies Flex, I recommend much practice in AIR. Then we find to study Flex the livedocs and for help AIR, and still the application Attest.

Soon after, if to does not yet have, create one counts VUE and do the registration for the exam.

For other certifications accesses the Adobe list

More Entries