flex 状态

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 

					   xmlns:s="library://ns.adobe.com/flex/spark" 

					   xmlns:mx="library://ns.adobe.com/flex/mx">

	<s:states>

		<s:State name="click"/>

		<s:State name="double_click"/>

		<s:State name="mid_click"/>

	</s:states>

	<fx:Script>

		<![CDATA[

			private function click():void{

				trace(currentState);

			}

		]]>

	</fx:Script>

	<fx:Declarations>

		<!-- Place non-visual elements (e.g., services, value objects) here -->

	</fx:Declarations>

	<s:Image id="img" x="10" y="10" width="231" height="223" source="assets/dd.jpg" click="click()"/>

	<s:Button x="10" y="241" label="click" click="currentState='click'"/>

	<s:Button x="88" y="241" label="double_click" click="currentState='double_click'"/>

	<s:Button x="186" y="241" label="mid_click" click="currentState='mid_click'"/>

</s:WindowedApplication>

 中间的属性可以附带状态,比如img的click可以分成click.click     click.double_click      click.mid_click 

 

你可能感兴趣的:(Flex)