Hi to all,
i wish to build this scenario:
1)I have a simple Customer class (bindable with java pojo)
2)I wish to implement a CustomerEvent
3)ActionScript class for all CRUD operation
Then in my simple app i wish....
private function doCusomterAdd():void{
var o:ProductEvent = new
ProductEvent(customer,'customerAdded');
this.dispatchEvent(o);
}
Can you help me to make more clarify...?pls
I'm a bit confusion with example that i founded, because i see they
write into a mxml component the code of "CRUD" operation.
But if wish to use it in other side i wont to rewrite the code..
I wish that my mxml component use dispatchEvent and it will be my
"ActionScript CRUD" to do all work.
Last Question :-(
Why propertyChangeHandler don't change the TextInput.text with 'Ciao
Mondo'?
Thanks
Devis
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal" creationComplete="init()"
viewSourceURL="srcview/index.html" xmlns:local="*"
>
<mx:Binding source="d.text" destination="cli.name">
</mx:Binding>
<mx:TextInput id="d" text="{cli.name}"/>
<mx:TextInput id="dd" />
<mx:Button label="Nuovo" click="cli=new Clienti()">
</mx:Button>
</mx:Application>
package com.test
{
import flash.events.Event;
public class ClientiEvent extends Event {
public var cli:Clienti;
public function ClientiEvent(prod:Clienti, type:String,
bubbles:Boolean=false){
super(type, bubbles);
cli = prod;
}
public override function clone():Event{
return new ClientiEvent(cli, type, bubbles);
}
}
}
package com.test
{
import mx.collections.*;
import mx.collections.errors.ItemPendingError;
import mx.controls.Alert;
import mx.data.*;
import mx.data.events.*;
import mx.events.*;
import mx.rpc.events.*;
import mx.rpc.AsyncToken;
import mx.controls.Alert;
import com.test.*;
import mx.core.UIComponent;
[Managed]
public class Clienti
{
public var name:String = "";
public function Clienti()
{
super();
this.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE,
propertyChangeHandler);
this.addEventListener(StateChangeEvent.CURRENT_STATE_CHANGE, newHandler);
}
private function
propertyChangeHandler(event:PropertyChangeEvent):void
{
Alert.show(event.kind.toString());
if (event.kind == PropertyChangeEventKind.UPDATE &&
event.property == "name")
{
Alert.show(event.kind.toString());
event.newValue='CIAO MONDO';
}
}
private function newHandler(event:StateChangeEvent):void
{
//Alert.show(event.newState.toString());
This don't work i have no idea ;-)
}
}
}