1、在flash中设计好动画。并为关键帧设置名称,再导出成FLEX元件的SWC
2、将SWC添加进FLEX的LIB中
3、扩展此FLASH元件 如
package net.highall.uicomponents
{
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.MouseEvent;
import mx.controls.TextInput;
public class HATextInputSkin extends TextInput_skin
{
public function HATextInputSkin()
{
super();
addEventListener(Event.ADDED,initStateHandler);
}
private function initStateHandler(event:Event):void{
if(!parent)return;
var textInput:TextInput=parent as TextInput;
this.stop();
textInput.addEventListener(FocusEvent.FOCUS_IN,motionHandler);
textInput.addEventListener(FocusEvent.FOCUS_OUT,motionHandler);
textInput.setStyle("paddingLeft",12);
textInput.setStyle("paddingTop",5);
}
private function motionHandler(event:Event):void{
switch(event.type){
case FocusEvent.FOCUS_IN:
gotoAndStop("focusIn");
break;
case FocusEvent.FOCUS_OUT:
gotoAndStop("up");
break;
case MouseEvent.MOUSE_OVER:
break;
}
}
}
}
4、引用此皮肤
<mx:TextInput x="108" y="148" width="186" height="28" borderSkin="net..uicomponents.TextInputSkin"/>