初学者看后必有感悟
列子说明:点击按钮 打印一句话
mxml文件:
<?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:Script>
<![CDATA[
import org.jliu.Demo;
protected function button1_clickHandler(event:MouseEvent):void
{
var d:Demo = new Demo();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:Button x="298" y="160" label="点击我" click="button1_clickHandler(event)"/>
</s:Application>
actionscript: as3代码
package org.jliu
{
import flash.display.Sprite;
public class Demo extends Sprite
{
public function Demo()
{
trace("hello!!");
}
}
}
列子说明:点击按钮 打印一句话
mxml文件:
<?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:Script>
<![CDATA[
import org.jliu.Demo;
protected function button1_clickHandler(event:MouseEvent):void
{
var d:Demo = new Demo();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:Button x="298" y="160" label="点击我" click="button1_clickHandler(event)"/>
</s:Application>
actionscript: as3代码
package org.jliu
{
import flash.display.Sprite;
public class Demo extends Sprite
{
public function Demo()
{
trace("hello!!");
}
}
}