Á½¸ö²»Í¬µÄflex×Ô¶¨Òå¿Ø¼þÔõôÏ໥¿ØÖÆ£¿
±ÈÈçµ±ÔÚÒ»¸öÖ»ÓÐadd·½·¨µÄ¿Ø¼þ¿òmxmlÀµ±Ìá½»³É¹¦µÄʱºò£¬Ôõô¸üÐÂÁíÍâÒ»¸öÓÐdatagird¿Ø¼þ¿òµÄmxml£¿
¾Í¿ÉÒÔÓÃÈçÏ·½·¨£ºÔÚÖ÷Ó¦ÓóÌÐòÀïÃæ£¬¶Ô×ӿؼþdatagird½øÐвÙ×÷£»
1¡¢parentApplication.refreshAdmin(); //ÔÚadd×ӿؼþ
2¡¢public function refreshAdmin():void //ÔÚÖ÷Ó¦ÓóÌÐò
{
adminsummary.refreshAdmin(); //adminsummaryΪdatagrid×ӿؼþ
} ......
Adobe Flex 3 Help > Flex Programming Elements > Using Events
Adobe Flex 3 Help
Flex Programming Elements / Using Events
Using events
Using events in Flex is a two-step process. First, you write a function or class method, known as an event listener or event handler, that responds to events. The function often accesses the properties of the Event object or some other settings of the application state. The signature of this function usually includes an argument that specifies the event type being passed in.
The following example shows a simple event listener function that reports when a control triggers the event that it is listening for:
<?xml version="1.0"?>
<!-- events/SimpleEventHandler.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp();">
<mx:Script><![CDATA[
import mx.controls.Alert;
private function initApp():void {
b1.addEventListener(MouseEvent.CLICK ......
µÚÒ»£ºÀ¸öDateFormatter ¿Ø¼þ
<mx:DateFormatter id="df" formatString="YYYY-MM-DD"/>
¾«È·µ½Ê±·ÖÃëÔòÊÇYYYY-MM-DD H:NN:SS
µÚ¶þ£ºÐ´¸öº¯Êý
private function formatStart(item:Object,column:DataGridColumn):String{
return df.format(item.startDate);// dfÊÇÒ»¸öDateFormatter£¬ÕâÀï¸ñʽ»¯itemÊý¾ÝÖеÄstartDate×Ö¶Î
}
µÚÈý£º
.........
<mx:DataGridColumn headerText="endDate" dataField="endDate" labelFunction="formatStart"/>
.........
ÓÐÁËÕâÈý¸ö£¬ÏÔʾÊý¾ÝÒѾûÓÐÎÊÌâÁË¡£ÆäʵҲ¿ÉÒÔÕâÑùÓã¬ÈçÔÚº¯ÊýÖÐ
regTime.text=df.format(memberResult.registeTime);//·µ»ØµÄ¸ñÁÖÖÎʱ¼ä¸ñʽ»¯ÎªYYYY-MM-DD¸ñʽ
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/jinxinxin1314/archive/2009/10/27/4731439.aspx ......
Flex EventºÍJS EventÒ»Ñù£¬¶¼´æÔÚÒ»¸öʼþÁ÷£¬Õâ¸öʼþÁ÷³£³£»áµ¼ÖÂһЩÌäЦ½Ô·ÇµÄBugÒÔ¼°´íÎó£»
Event Flow
l Capturing:
ʼþ²¶»ñ½×¶Î£¬Èç¹ûÒ»¸ö°´Å¥B1·ÅÔÚÒ»¸öPanel P1ÈÝÆ÷µ±ÖУ¬µ±ÎÒÃǽ²P1×¢²áµã»÷ʼþEP£¬½«B1×¢²áµã»÷ʼþEB,Panel p1µÄ¸¸ÈÝÆ÷ΪApplication app£»
b1.addEventListener(MouseEvent.CLICK,e1);
p1.addEventListener(MouseEvent.CLICK,e2);
app.addEventListener(MouseEvent.CLICK,e3);
´Ëʱ£¬µ±ÎÒÃǵã»÷B1µÄʱºò£¬·¢ÏÖEPͬʱҲ»áµÃµ½³ö·¢£»
´ÓRootÔªËØµ½µã»÷µÄÔªËØ£¬ÖмäµÄËùÓÐb1->parentËù×¢²áµÄͬÀàʱ¼ä¶¼»á´¥·¢£¬ÕâÖÖ´Ó¸ùµ½Êó±êʵ¼Êµã»÷µÄÄ¿±êÔªËØµÄ¹ý³Ì½Ð×öʼþµÄ²¶»ñ£»
App-----àp1----------
l Targeting
Ä¿±ê½×¶Î£º´Ëʱµ±¾ÀúÁËcapturing½×¶ÎÒÔºó£¬Ê¼þÁ÷Á÷ ......
ÔÚ±¾´ÎFlexÖ¸ÄÏÖУ¬ÈÃÎÒÃÇ¿´¿´ÈçºÎÔÚFlashÖÐʹÓÃCursorManagerÀà´´½¨Ò»¸ö¶¯»¹â±êÀ´Ì滻ĬÈϵļýÍ·¹â±ê¡£
1
. ´´½¨Ò»¸öеÄFlexÏîÄ¿ÃûΪAnimatedCursor£¬ÉèÖÃÖ÷MXMLÓ¦ÓóÌÐòÃûΪMain.mxml¡£
2
.
ÎÒÃǵÄ×Ô¶¨Òå¹â±êÊÇÒ»¸öswfÎļþ£¬Òò´ËÇë´ò¿ªFlashÀ´´´½¨×Ô¼ºµÄ×Ô¶¨Òå¹â±ê¡£Ö¡ÂÊÉèÖÃΪÊÊÓ¦FlexÖ¡ÂʵÄ24ÔÚÕâÀÎÒÃÇÖ»ÊǼòµ¥ÊÖ¹¤»æÖÆÒ»¸ö¼ý
Í·²¢´´½¨Ò»¸ö²¹¼ä¶¯»À´¸Ä±äËüµÄÑÕÉ«£¬ÄãÒ²¿ÉÒÔ×Ô¼º¿ª¶¯ÄԽÀ´´´½¨Ò»¸ö¸üÓд´ÒâµÄ¶¯»£¬È»ºó·¢²¼ÄúµÄswfÎļþ¡£
3
. ·µ»Øµ½Flex£¬Ìí¼ÓÒ»¸öCheckBox×é¼þ£¬µ±Æä·¢Éú±ä»¯Ê±µ÷ÓÃÎÒÃǼ´½«´´½¨µÄtoggleCursor·½·¨¡£
1.<mx:CheckBox label="Custom Cursor" change="toggleCursor(event)"/>
4.
Ìí¼ÓÒ»¸ö½Å±¾¡£Ê×ÏÈ£¬Ç¶ÈëÄúµÄSWFÎļþ£¬½«Æä×÷Ϊ×Ô¶¨Òå¹â±êʹÓá£
1.[Embed(source="cursor.swf")]
2.private var AnimatedCursor:Class;
5
. ÔÚtoggleCursor·½·¨ÖУ¬¼ì²é¸´Ñ¡¿òÊÇ·ñ±»Ñ¡ÖС£
Èç¹ûΪtrue£¬µ÷ÓÃCursorManagerÀàµÄsetCursor·½·¨²¢°ÑËüµÄÒýÓô«µÝ¸øÄãǶÈëµÄswf¹â±ê¡£
setCursor·½·¨·µ»ØÒ»¸öIDÓÃÓÚ¹â±êµÄÉèÖã¬ÄãÐèÒª´æ´¢Õâ¸öID£¬ÒÔ±ãÎÒÃÇÒÔºóÓÃÔÚremoveCursor£¨£©·½·¨Àï¡ ......
public sealed class XmlHelper
{
public static void Serialize<T>(T obj,string fileName)
{
TextWriter writer = new StreamWriter(fileName);
try
{
XmlSerializer ser = new XmlSerializer(typeof(T));
ser.Serialize(writer, obj);
}
catch (Exception)
{
throw;
}
finally
{
if (writer != null)
{
writer.Close();
}
}
}
public static T Deserialize<T>(string fileName) where T:class
{
TextReader reader = new StreamReader(fileName);
T newObj ;
try
{
XmlSerializer mySerializer = new XmlSerializer(typeof(T));
newObj= mySerializer.Deserialize(reader) as T;
}
catch (Exception)
......