This week InsideRIA published an article boarding this subject.
Here they will go the links of post and of the attachment
This week InsideRIA published an article boarding this subject.
Here they will go the links of post and of the attachment
In 1st of February arose the question "what is better to use to the persistence, some AMF?" in the forum flex-dev, that I share with you.
--
Soon, as well, Flash Builder will let of being beta, but while it is in beta do not advise the use for production, because it will not have official support.
In the own list is going to find several framework and languages server options. I do not am going to argue about which better language, because that is a personal choice, the most professional that is the person, it finishes being a personal choice, influenced by the politics of the company, for conviction, for ideology... respect all the reasons ...
Today you have some services AMF, but we see, you are going to work with a language created by the Adobe, we will reduce the number of services AMF to three, in other words, BlazeDS, LiveCycle and ColdFusion Remoting, who are developed by the fabricate of the language of Flex. It is worth search among excluded services, performance, compatibility, portabilidade, and it will finish arriving to this same list.
LiveCycle and BlazeDS were implemented the most generic that was possible for the current servers, and ColdFusion Remoting was implemented by the team of LiveCycle and of BlazeDS, however this implementation was together with the rest teams who implemented the remaining of the server in this server version ColdFusion 9.
The rest only searching, accomplishing studies, and things of the gender.
If you want to start (cf9 obviously), here will go some links:
- paginas 60-64 http://locaweb.digitalpages.com.br/default.aspx?edicao=17&pag=1 - http://blog.pcsilva.com/index.cfm/Flex - http://www.mxstudio.com.br/coldfusion/coldfusion-9/
I believe that the friends will indicate other links.
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.
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.
/** * * @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;
Event"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; } Bindable"validatechange")] Inspectable"noblank,string,email", name='validateType')]
public function set validateType(v:String):void {
_validateType = v; if(_initialized){ dispatchEventCustom(); }
} public function get message():String {
return _message; }
Inspectable'String', name='message')]
public function set message(v:String):void {
_message = v; }
public function get source():String
{ return _source; }
Inspectable'String', name='source')]
public function set source(v:String):void {
_source = v; }
public function get required():Boolean
{ return _required; } Inspectable'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; } Bindable] Inspectable'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
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.