内联方式—flexdemo演示提示框和图片缩放效果例子_内联方式组合mxml和ActionScript代码

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

	<fx:Declarations>
		<s:Resize id="myEffect" target="{myImage}" widthBy="15" heightBy="15">
        </s:Resize>
		<s:Resize id="myEffect2" target="{myImage}" widthBy="-15" heightBy="-15">
		</s:Resize>
	</fx:Declarations>
	<!--效果-->
	<fx:Script>
		<![CDATA[
			import mx.controls.Alert;
		]]>
	</fx:Script>
	<s:Button id="btn1" x="300" y="40" label="单击查看效果" fontSize="20" 
			  width="180" height="25" color="red" 
			  click="mx.controls.Alert.show('欢迎来到Flex的世界!','提示')"
			  >
	</s:Button>
	<!--效果2-->
	<mx:Image id="myImage"  x="300" y="100" source="@Embed(source='assets/images/cn.png')">
	</mx:Image>
	<s:Button id="btn2"  x="300" y="380" width="100" height="25" color="red" click="myEffect.end();myEffect.play();" label="点击放大图片" toolTip="点击啊">
	</s:Button>
	<s:Button id="btn3"  x="300" y="420" width="100" height="25" color="red" click="myEffect2.end();myEffect2.play();" label="点击缩小图片" toolTip="点击啊">
	</s:Button>

</s:Application>

你可能感兴趣的:(actionscript)