<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT妖怪 &#187; Jack</title>
	<atom:link href="http://blog.ityao.com/archives/author/jack/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.ityao.com</link>
	<description>热爱生活，热爱程序</description>
	<lastBuildDate>Wed, 03 Aug 2011 02:56:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>[转]FlashBuilder中使用fl组件</title>
		<link>http://blog.ityao.com/archives/765</link>
		<comments>http://blog.ityao.com/archives/765#comments</comments>
		<pubDate>Wed, 04 Aug 2010 04:04:18 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=765</guid>
		<description><![CDATA[意思就是：用Flash CS创建一个flash，将需要的fl组件拖进舞台，然后导出swc文件 在FlashBuilder中引入该swc，这时就能在代码中直接new这个fl组件了 How to Use Flash CS&#8217;s Components in Flex Builder To generate the .swc file in Flash CS3, we follow these steps: 1) Make a new Flash CS3 ActionScript 3.0 .fla file. 2) Drag the desired component(s) to the Library. In this example, we&#8217;ll drag the TextArea component to the Library. 3) Choose [...]]]></description>
			<content:encoded><![CDATA[<p>意思就是：用Flash CS创建一个flash，将需要的fl组件拖进舞台，然后导出swc文件</p>
<p>在FlashBuilder中引入该swc，这时就能在代码中直接new这个fl组件了</p>
<p>How to Use Flash CS&#8217;s  Components in Flex Builder</p>
<p>To generate the .swc file in Flash CS3, we follow these steps:</p>
<p>1) Make a new Flash CS3 ActionScript 3.0 .fla file.<br />
2) Drag the desired component(s) to the Library. In this example, we&#8217;ll drag the TextArea component to the Library.<br />
3) Choose File &gt; Export &gt; Export Movie.<br />
4) For File name, enter v3components.swf. (We don&#8217;t even want the generated .swf, but there&#8217;s no other way to get the .swc to compile.)<br />
5) Select a folder in which to save the .swf file.<br />
6) Click Save.<br />
7) In the Export Flash Player dialog, check Export SWC.<br />
 <img src='http://blog.ityao.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Click OK.</p>
<p>The preceding steps generate two files, cs3 components.swf and v3components.swc, both of which are placed in the folder selected in Step 5.</p>
<p>Now let&#8217;s use cs3 components.swc in a Flex Builder project. Follow these steps:</p>
<p>1) In Flex Builder, select File &gt; New &gt; ActionScript Project.<br />
2) For Project name, enter &#8220;V3Test.as&#8221;.<br />
3) Click Next.<br />
4) For Main source folder, enter &#8220;src&#8221;.<br />
5) For Main application file, enter &#8220;V3Test.as&#8221;.<br />
6) On the Library path tab, click Add SWC.<br />
7) Browse to the v3components.swc file from the preceding procedure.<br />
 <img src='http://blog.ityao.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Click Finish.<br />
9) Update the code in cs Test.as so it looks like this:</p>
<pre class="brush: plain; title: ; notranslate">
package {
  import flash.display.Sprite;
  import fl.controls.TextArea;
  public class V3Test extends Sprite {
    public function V3Test() {
      var t:TextArea = new TextArea();
      t.text = &quot;You're not cookin'&quot;;
      addChild(t);
    }
  }
</pre>
<p>}<br />
10) Run the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/765/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3在本地选择图片并预览(仅限FlashPlayer10+)</title>
		<link>http://blog.ityao.com/archives/761</link>
		<comments>http://blog.ityao.com/archives/761#comments</comments>
		<pubDate>Tue, 03 Aug 2010 09:50:41 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=761</guid>
		<description><![CDATA[(仅限FlashPlayer10+)]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">(仅限FlashPlayer10+)</span></p>
<pre class="brush: plain; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot;
			    creationComplete=&quot;application1_creationCompleteHandler(event)&quot;&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			import mx.events.FlexEvent;
			private var file:FileReference;
			private var loader:Loader;
			protected function button1_clickHandler(event:MouseEvent):void
			{
				file = new FileReference();
				file.addEventListener(Event.SELECT,file_selectHandler);
				file.browse ([new FileFilter(&quot;Images(*.jpg;*.jpeg;*.png;*.gif)&quot;,&quot;*.jpg;*.jpeg;*.png;*.gif&quot;)]);
			}

			protected function file_selectHandler(event:Event):void{
				file.removeEventListener(Event.SELECT,file_selectHandler);
				file.addEventListener(Event.COMPLETE,file_completeHandler);
				file.load();
			}

			protected function file_completeHandler(event:Event):void{
				file.removeEventListener(Event.COMPLETE,file_completeHandler);
				loader.loadBytes(file.data);
			}
			protected function loaderCompleteHandler(event:Event):void{
				var $bmd:BitmapData = new BitmapData(loader.width,loader.height,true,0x00FFFFFF);
				$bmd.draw(loader.content);
				this.preview.source = $bmd;
				this.preview.width = 40;
				this.preview.height = 40;
			}

			protected function application1_creationCompleteHandler(event:FlexEvent):void
			{
				loader = new Loader();
				loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderCompleteHandler);
				this.swf.addChild(loader);
			}

		]]&gt;
	&lt;/fx:Script&gt;
	&lt;s:layout&gt;
		&lt;s:VerticalLayout/&gt;
	&lt;/s:layout&gt;
	&lt;s:Button click=&quot;button1_clickHandler(event)&quot; label=&quot;Select Image&quot;/&gt;
	&lt;s:HGroup&gt;
		&lt;s:BitmapImage id=&quot;preview&quot;/&gt;
		&lt;mx:SWFLoader id=&quot;swf&quot;/&gt;
	&lt;/s:HGroup&gt;
&lt;/s:Application&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/761/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash在IE全屏时 使用Deeplinking修改网址会退出全屏的bug解决方案</title>
		<link>http://blog.ityao.com/archives/722</link>
		<comments>http://blog.ityao.com/archives/722#comments</comments>
		<pubDate>Tue, 01 Jun 2010 12:44:14 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=722</guid>
		<description><![CDATA[BUG描述： IE浏览器下，Flash全屏时 一旦使用deeplinking修改网址参数，就会导致Flash退出全屏 解决方案： 在全屏时不再修改deeplinking， 而当退出全屏时，使用最后的deeplinking 可以侦听stage类的事件FullScreenEvent. FULL_SCREEN 在任何被添加到了舞台的DisplayObject对象内部,都可以这样写： this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, stage_fullScreenHandler); //侦听全屏变化的事件 private function stage_fullScreenHandler(event:FullScreenEvent):void{ //event.fullScreen为false的时候，是退出全屏，true是进入全屏 if(!event.fullScreen){ //修改deeplinking }]]></description>
			<content:encoded><![CDATA[<p><strong>BUG描述：</strong></p>
<p>IE浏览器下，Flash全屏时  一旦使用deeplinking修改网址参数，就会导致Flash退出全屏</p>
<p><strong> 解决方案： </strong></p>
<p>在全屏时不再修改deeplinking，  而当退出全屏时，使用最后的deeplinking</p>
<p>可以侦听stage类的事件FullScreenEvent. FULL_SCREEN</p>
<p>在任何被添加到了舞台的DisplayObject对象内部,都可以这样写：</p>
<p>this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, stage_fullScreenHandler);</p>
<p>//侦听全屏变化的事件</p>
<p>private function stage_fullScreenHandler(event:FullScreenEvent):void{</p>
<p>//event.fullScreen为false的时候，是退出全屏，true是进入全屏</p>
<p>if(!event.fullScreen){</p>
<p>//修改deeplinking</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/722/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex4 SkinnableContainer,BorderContainer隐藏子内容</title>
		<link>http://blog.ityao.com/archives/708</link>
		<comments>http://blog.ityao.com/archives/708#comments</comments>
		<pubDate>Tue, 01 Jun 2010 09:52:05 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=708</guid>
		<description><![CDATA[SkinnableContainer及其子类BorderContainer等在添加了子内容后， 即使子内容宽高超过了容器本身的宽高，子内容也会被正常显示出来， SkinnableContainer是无法裁剪子内容的，而且也没有默认属性可以设置 但如果想实现容器裁剪子内容，可以用以下方法实现 &#60;s: SkinnableContainer id=&#8221;myBC&#8221; creationComplete=&#8221;myBC.contentGroup.clipAndEnableScrolling = true&#8221;&#62; 即：在容器创建完成后设置它的属性contentGroup的clipAndEnableScrolling为true 原理： BorderContainer继承自SkinnableContainer，这两个组件都不是自身添加显示对象的，而是使用contentGroup作为子内容的容器， 而contentGroup实际上是一个Group对象 Group本身有一个属性：clipAndEnableScrolling，当它为true时，就会裁剪内容，默认是false]]></description>
			<content:encoded><![CDATA[<p>SkinnableContainer及其子类BorderContainer等在添加了子内容后，</p>
<p>即使子内容宽高超过了容器本身的宽高，子内容也会被正常显示出来，</p>
<p>SkinnableContainer是无法裁剪子内容的，而且也没有默认属性可以设置</p>
<p>但如果想实现容器裁剪子内容，可以用以下方法实现</p>
<p>&lt;s: SkinnableContainer id=&#8221;myBC&#8221; creationComplete=&#8221;myBC.contentGroup.clipAndEnableScrolling = true&#8221;&gt;</p>
<p>即：在容器创建完成后设置它的属性contentGroup的clipAndEnableScrolling为true</p>
<p><strong> 原理：</strong></p>
<p>BorderContainer继承自SkinnableContainer，这两个组件都不是自身添加显示对象的，而是使用contentGroup作为子内容的容器，</p>
<p>而contentGroup实际上是一个Group对象 Group本身有一个属性：clipAndEnableScrolling，当它为true时，就会裁剪内容，默认是false</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/708/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FlashFlex发布可访问本地的SWF</title>
		<link>http://blog.ityao.com/archives/703</link>
		<comments>http://blog.ityao.com/archives/703#comments</comments>
		<pubDate>Wed, 26 May 2010 02:57:06 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=703</guid>
		<description><![CDATA[无论是Flex还是Flash编译后的SWF都只可方位网络或者只可访问本地数据，不可以同时访问二者， Flex默认是只可访问网络，要把Flex编译后的SWF设为只可访问本地数据模式，要在Flex项目的编译参数中增加：-use-network=false 在Flash IDE中，设置方式：在菜单工具栏中选择File(文件)-&#62;Publish Settings(发布设置)，在弹出窗口中选择Flash标签，在Local playback中选择需要的访问模式]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">无论是Flex还是Flash编译后的SWF都只可方位网络或者只可访问本地数据，不可以同时访问二者，</div>
<div></div>
<div>Flex默认是只可访问网络，要把Flex编译后的SWF设为只可访问本地数据模式，要在Flex项目的编译参数中增加：-use-network=false</div>
<div>在Flash IDE中，设置方式：在菜单工具栏中选择File(文件)-&gt;Publish Settings(发布设置)，在弹出窗口中选择Flash标签，在Local playback中选择需要的访问模式</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/703/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex4动态加载和切换CSS</title>
		<link>http://blog.ityao.com/archives/699</link>
		<comments>http://blog.ityao.com/archives/699#comments</comments>
		<pubDate>Wed, 26 May 2010 02:43:54 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=699</guid>
		<description><![CDATA[Flex4中动态加载CSS文件的方式已经和Flex3有了一定的区别 主要步骤如下： 1.编写不同的CSS文件 见后文 2.将CSS文件编译成SWF文件 在FlashBuilder中右键CSS文件，选择Compile CSS to SWF， 这时bin-debug目录下的对应位置就会生成一个与CSS同名的SWF文件。 选中后该选项前会有勾，之后只要修改了CSS文件，就会自动编译成SWF 2.用styleManager加载SWF 代码中这样写： this.styleManager.loadStyleDeclarations2(&#8220;MyCss1.swf&#8221;);   //代码中填写上一步由CSS生成的SWF文件路径 CSS写法： MyCss1.css /* CSS file */ /*命名空间*/ @namespace s &#8220;library://ns.adobe.com/flex/spark&#8221;; @namespace mx &#8220;library://ns.adobe.com/flex/mx&#8221;; /*使用skin类来定义皮肤，所以要用ClassReference函数*/ s&#124;List{ skin-class:ClassReference(&#8220;skins.ListSkin1&#8243;); } /*符号#代表指定的ID*/ s&#124;Label#labelExamples{ font-size:14; color:#990099; } s&#124;CheckBox{ font-size:9; color:#FF3300; } s&#124;RadioButton{ font-size:92; color:#990099; } s&#124;Button{ font-size:32; color:#FF3300; } 注：CSS中无法设置ItemRenderer，所以如果要实现不同CSS用不同的ItemRenderer，为各个CSS指定不同的skin类，并且在skin类中分别设置的ItemRenderer 例如，我的例子中要为List设置不同的ItemRenderer，就不要写成&#60;s:List itemRenderer=&#8221;itemRenderers.ListItemRenderer1&#8243;&#8230;/&#62; 而要在CSS中为List指定skinClass为skins.ListSkin1，代码：skin-class:ClassReference(&#8220;skins.ListSkin1&#8243;); 然后，在skin.ListSkin1中设置ItemRenderer，代码： [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>Flex4中动态加载CSS文件的方式已经和Flex3有了一定的区别</p>
<p>主要步骤如下：</p>
<h5>1.编写不同的CSS文件</h5>
<p>见后文</p>
<h5>2.将CSS文件编译成SWF文件</h5>
<p>在FlashBuilder中右键CSS文件，选择Compile CSS to SWF，<br />
<span id="more-699"></span><br />
这时bin-debug目录下的对应位置就会生成一个与CSS同名的SWF文件。</p>
<p>选中后该选项前会有勾，之后只要修改了CSS文件，就会自动编译成SWF</p>
<h5>2.用styleManager加载SWF</h5>
<p>代码中这样写：</p>
<p>this.styleManager.loadStyleDeclarations2(&#8220;MyCss1.swf&#8221;);   //代码中填写上一步由CSS生成的SWF文件路径</p>
<hr />
<h4>CSS写法：</h4>
<h4>MyCss1.css</h4>
<p>/* CSS file */</p>
<p>/*命名空间*/</p>
<p>@namespace s &#8220;library://ns.adobe.com/flex/spark&#8221;;</p>
<p>@namespace mx &#8220;library://ns.adobe.com/flex/mx&#8221;;</p>
<p>/*使用skin类来定义皮肤，所以要用ClassReference函数*/</p>
<p>s|List{</p>
<p>skin-class:ClassReference(&#8220;skins.ListSkin1&#8243;);</p>
<p>}</p>
<p>/*符号#代表指定的ID*/</p>
<p>s|Label#labelExamples{</p>
<p>font-size:14;</p>
<p>color:#990099;</p>
<p>}</p>
<p>s|CheckBox{</p>
<p>font-size:9;</p>
<p>color:#FF3300;</p>
<p>}</p>
<p>s|RadioButton{</p>
<p>font-size:92;</p>
<p>color:#990099;</p>
<p>}</p>
<p>s|Button{</p>
<p>font-size:32;</p>
<p>color:#FF3300;</p>
<p>}</p>
<p><strong><span style="font-family: mceinline;">注：CSS中无法设置ItemRenderer，所以如果要实现不同CSS用不同的ItemRenderer，为各个CSS指定不同的skin类，并且在skin类中分别设置的ItemRenderer</span></strong></p>
<p><strong><span style="font-family: mceinline;">例如，我的例子中要为List设置不同的ItemRenderer，就不要写成&lt;s:List itemRenderer=&#8221;itemRenderers.ListItemRenderer1&#8243;&#8230;/&gt;</span></strong></p>
<p><strong><span style="font-family: mceinline;">而要在CSS中为List指定skinClass为skins.ListSkin1，代码：skin-class:ClassReference(&#8220;skins.ListSkin1&#8243;);</span></strong></p>
<p><strong><span style="font-family: mceinline;">然后，在skin.ListSkin1中设置ItemRenderer，代码： </span></strong></p>
<p><strong><span style="font-family: mceinline;">&lt;s:DataGroup id=&#8221;dataGroup&#8221; itemRenderer=&#8221;itemRenderers.ListItemRenderer1&#8243;&gt;</span></strong></p>
<p><span style="font-family: mceinline;"> &lt;s:layout&gt;&#8230;</span></p>
<p><span style="font-family: mceinline;"><br />
</span></p>
<div>
<h4>MyCss2.css——另一个CSS文件</h4>
<p>/* CSS file */</p>
<p>@namespace s &#8220;library://ns.adobe.com/flex/spark&#8221;;</p>
<p>@namespace mx &#8220;library://ns.adobe.com/flex/mx&#8221;;</p>
<p>/* 使用了另一个Skin类*/</p>
<p>s|List{</p>
<p>skin-class:ClassReference(&#8220;skins.ListSkin2&#8243;);</p>
<p>}</p>
<p>s|Label#labelExamples{</p>
<p>font-size:42;</p>
<p>color:#009966;</p>
<p>}</p>
<p>s|CheckBox{</p>
<p>font-size:22;</p>
<p>color:#009966;</p>
<p>}</p>
<p>s|RadioButton{</p>
<p>font-size:20;</p>
<p>color:#009966;</p>
<p>}</p>
<p>s|Button{</p>
<p>font-size:12;</p>
<p>color:#00FFFF;</p>
<p>}</p>
<hr />完整源代码：<a rel="attachment wp-att-700" href="http://blog.ityao.com/archives/699/switchcssinruntime">SwitchCSSInRuntime</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/699/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>漫步PureMVC（一） 极简入门</title>
		<link>http://blog.ityao.com/archives/685</link>
		<comments>http://blog.ityao.com/archives/685#comments</comments>
		<pubDate>Mon, 10 May 2010 15:53:02 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=685</guid>
		<description><![CDATA[漫步PureMVC（一） 极简入门]]></description>
			<content:encoded><![CDATA[<p>PureMVC官方网站<a href="http://puremvc.org/">http://puremvc.org/</a>有详细的多语言帮助文档（包括中文）和demo，<br />
但即使是最简单的demo，也要建立N多类，很多朋友都抱怨PureMVC上手机要需要建立太多类，比较难入门<br />
因此我做了下面这个Demo，只用了3个类，来说明PureMVC中Facade和View/Mediator的用法，<br />
以及如何发送和响应notification<br />
并且在以后的blog中，我会在这个demo基础上，逐步添加新的类和功能，逐步深入讲解PureMVC<br />
Demo中有三个朋友列表，分别是全部朋友列表与组A/组B，添加/删除朋友时会同时添加/删除全部列表和指定组的列表<br />
仅包含三个类：<br />
FrinedList.mxml : 主程序，实例化多个MyList.mxml作为朋友列表，向Facade注册mediator，发送添加朋友的通知<br />
views/MyList.mxml : 朋友列表的可视化组件，发送删除朋友的通知<br />
views/MyListMediator.as : MyList.mxml的中介器，响应各种通知，控制MyList.mxml</p>
<p><strong>主程序：FriendList.mxml</strong></p>
<pre class="brush: plain; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot;
			   xmlns:views=&quot;views.*&quot;
			    creationComplete=&quot;application1_creationCompleteHandler(event)&quot;&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			import mx.events.FlexEvent;

			import org.puremvc.as3.multicore.interfaces.IFacade;
			import org.puremvc.as3.multicore.patterns.facade.Facade;

			import views.MyListMediator;

			protected var facade:IFacade = Facade.getInstance('');//获取Facade的单例

			protected function application1_creationCompleteHandler(event:FlexEvent):void
			{
				cbTypeId.textInput.editable = false
				//
				facade.registerMediator(new MyListMediator('all',this.list0));
				facade.registerMediator(new MyListMediator('group1',this.list1));
				facade.registerMediator(new MyListMediator('group2',this.list2));
				//添加几个个测试数据
				this.addNewFriend('Sven',1);
				this.addNewFriend('Lina',2);
				this.addNewFriend('Viper',1);
				this.addNewFriend('Chen',2);
				this.addNewFriend('Zeus ',4);//添加一个特殊typeId的组，测试例外数据的处理
			}

			protected function btnAdd_clickHandler($event:MouseEvent):void{
				this.addNewFriend(this.textName.text,this.cbTypeId.selectedItem.typeId);
				this.textName.text='';//清空名称输入栏，以免连续点击
			}

			protected function addNewFriend($name:String,$typeId:int):void{
				var $friend:Object = new Object();//创建一个新朋友的数据对象
				$friend.name = $name;//设置名称
				$friend.typeId = $typeId;//设置typeId
				facade.sendNotification('add',$friend);//发送通知
			}
		]]&gt;
	&lt;/fx:Script&gt;

	&lt;s:HGroup&gt;
		&lt;s:Label text=&quot;Name:&quot;/&gt;
		&lt;s:TextInput id=&quot;textName&quot;/&gt;
		&lt;s:ComboBox id=&quot;cbTypeId&quot; labelField=&quot;label&quot; selectedIndex=&quot;0&quot;&gt;
			&lt;s:dataProvider&gt;
				&lt;s:ArrayCollection&gt;
					&lt;fx:Array&gt;
						&lt;fx:Object label='组A' typeId='1'/&gt;
						&lt;fx:Object label='组B' typeId='2'/&gt;
						&lt;fx:Object label='不分配组' typeId='0'/&gt;
					&lt;/fx:Array&gt;
				&lt;/s:ArrayCollection&gt;
			&lt;/s:dataProvider&gt;
		&lt;/s:ComboBox&gt;
		&lt;s:Button enabled=&quot;{this.textName.text!=''}&quot; id=&quot;btnAdd&quot; label=&quot;添加新Friend&quot; click=&quot;btnAdd_clickHandler(event)&quot;/&gt;
	&lt;/s:HGroup&gt;
	&lt;views:MyList id=&quot;list0&quot; x=&quot;10&quot; title=&quot;全部好友&quot; typeId=&quot;0&quot; width=&quot;180&quot; top=&quot;39&quot; height=&quot;486&quot;&gt;
	&lt;/views:MyList&gt;
	&lt;views:MyList id=&quot;list1&quot; x=&quot;198&quot; title=&quot;组A&quot; typeId=&quot;1&quot; width=&quot;180&quot; top=&quot;39&quot; height=&quot;213&quot;&gt;
	&lt;/views:MyList&gt;
	&lt;views:MyList id=&quot;list2&quot; x=&quot;198&quot; title=&quot;组B&quot; typeId=&quot;2&quot; width=&quot;180&quot; top=&quot;305&quot; height=&quot;220&quot;&gt;
	&lt;/views:MyList&gt;
&lt;/s:Application&gt;
</pre>
<p> <strong>朋友列表组件：views/MyList.mxml</strong>
<pre class="brush: plain; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Group xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
		 xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
		 xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; width=&quot;400&quot; height=&quot;300&quot;
		  &gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			import mx.collections.ArrayCollection;

			import org.puremvc.as3.multicore.patterns.facade.Facade;

			[Bindable]
			public var title:String = '';

			public var typeId:int = 0;

			[Bindable]
			public var dataAC:ArrayCollection = new ArrayCollection();

			protected function btnDel_clickHandler(event:MouseEvent):void
			{
				if(this.list.selectedItem){
					Facade.getInstance('').sendNotification('delete',this.list.selectedItem);
				}
			}
		]]&gt;
	&lt;/fx:Script&gt;
	&lt;s:Label text=&quot;{title}&quot;/&gt;
	&lt;s:List id=&quot;list&quot; dataProvider=&quot;{dataAC}&quot; top=&quot;24&quot; bottom=&quot;24&quot; width=&quot;100%&quot; labelField=&quot;name&quot;/&gt;
	&lt;s:Button id=&quot;btnDel&quot; enabled=&quot;{this.list.selectedItem}&quot; label=&quot;删除所选&quot; click=&quot;btnDel_clickHandler(event)&quot; bottom=&quot;0&quot; /&gt;
&lt;/s:Group&gt;
</pre>
<p> <strong>中介器：MyListMediator.as</strong>
<pre class="brush: plain; title: ; notranslate">
package views
{
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;

	public class MyListMediator extends Mediator
	{
		public function MyListMediator(mediatorName:String=null, viewComponent:Object=null)
		{
			super(mediatorName, viewComponent);
		}
		private function get view():MyList{
			return this.viewComponent as MyList;
		}
		//可以接受的通知name
		override public function listNotificationInterests():Array{
			return ['delete','add'];
		}
		//响应通知
		override public function handleNotification(notification:INotification):void{
			var $friend:Object = notification.getBody();//获取通知的内容
			if(this.view.typeId==0 || this.view.typeId==$friend.typeId){
				//所持有的MyList如果是全部朋友的列表或指定typeId的列表，则执行以下操作，否则不执行
				switch(notification.getName()){//区分名称
					case 'delete':
						var $index:int = this.view.dataAC.getItemIndex($friend);
						this.view.dataAC.removeItemAt($index);//告知data删除指定friend object
						break;
					case 'add':
						this.view.dataAC.addItem($friend);//添加frined object
						break;
				}
			}
		}
	}
}
</pre>
<p> 源文件下载 <a rel="attachment wp-att-686" href="http://blog.ityao.com/archives/685/puremvcdemofriendlist20100511-zip">PureMvcDemoFriendList20100511.zip</a></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/685/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex中的Base64加解密</title>
		<link>http://blog.ityao.com/archives/677</link>
		<comments>http://blog.ityao.com/archives/677#comments</comments>
		<pubDate>Mon, 10 May 2010 10:40:54 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=677</guid>
		<description><![CDATA[Flex sdk3就内置了Base64的加/解密工具类 分别是 mx.utils.Base64Encoder mx.utils.Base64Decoder Base64Encoder用法如下： Base64Decoder用法如下： 完成代码：]]></description>
			<content:encoded><![CDATA[<p>Flex sdk3就内置了Base64的加/解密工具类<br />
分别是<br />
mx.utils.Base64Encoder<br />
mx.utils.Base64Decoder</p>
<h5>Base64Encoder用法如下：</h5>
<pre class="brush: plain; title: ; notranslate">
var $orgin:String = this.textOrigi.text;//获取原始字符串
var $base64:Base64Encoder = new Base64Encoder();
$base64.insertNewLines = false;//该值等于true时，输出的结果会自动换行，默认为true，
$base64.encodeUTFBytes($orgin);//这里注意，如果想加密中文就不要使用$base64.encode();
var $result:String = $base64.toString();//输出结果
</pre>
<h5>Base64Decoder用法如下：</h5>
<pre class="brush: plain; title: ; notranslate">
				var $origi:String = this.textEncodeResult.text;//获取原始字符串
				var $base64:Base64Decoder = new Base64Decoder();
				$base64.decode($origi);
				var $result:String = $base64.toByteArray().toString();//输出结果，decode类只能输出ByteArray类型的数据，因此要转换成string
</pre>
<h5>完成代码：</h5>
<pre class="brush: plain; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot;&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			import mx.utils.Base64Decoder;
			import mx.utils.Base64Encoder;
			protected function btnEncode_clickHandler(event:MouseEvent):void
			{
				var $orgin:String = this.textOrigi.text;//获取原始字符串
				var $base64:Base64Encoder = new Base64Encoder();
				$base64.insertNewLines = false;//该值等于true时，输出的结果会自动换行，默认为true，
				$base64.encodeUTFBytes($orgin);//这里注意，如果想加密中文就不要使用$base64.encode();
				var $result:String = $base64.toString();//输出结果
				this.textEncodeResult.text = $result
			}

			protected function btnDecode_clickHandler(event:MouseEvent):void
			{
				var $origi:String = this.textEncodeResult.text;//获取原始字符串
				var $base64:Base64Decoder = new Base64Decoder();
				$base64.decode($origi);
				var $result:String = $base64.toByteArray().toString();//输出结果，decode类只能输出ByteArray类型的数据，因此要转换成string
				this.textDecodeResult.text = $result
			}

		]]&gt;
	&lt;/fx:Script&gt;

	&lt;mx:Form width=&quot;100%&quot;&gt;
		&lt;mx:FormItem label=&quot;原始字符串：&quot; width=&quot;100%&quot;&gt;
			&lt;s:TextArea editable=&quot;true&quot; id=&quot;textOrigi&quot; width=&quot;100%&quot; text=&quot;在这里输入原始字符串&quot;/&gt;
		&lt;/mx:FormItem&gt;
		&lt;mx:FormItem&gt;
			&lt;s:Button id=&quot;btnEncode&quot; label=&quot;Encode Base64&quot; enabled=&quot;{this.textOrigi.text!=''}&quot; click=&quot;btnEncode_clickHandler(event)&quot;/&gt;
		&lt;/mx:FormItem&gt;
		&lt;mx:FormItem label=&quot;Encode 结果：&quot; width=&quot;100%&quot;&gt;
			&lt;s:TextArea editable=&quot;false&quot; id=&quot;textEncodeResult&quot; width=&quot;100%&quot;/&gt;
		&lt;/mx:FormItem&gt;
		&lt;mx:FormItem&gt;
			&lt;s:Button id=&quot;btnDecode&quot; enabled=&quot;{this.textEncodeResult.text!=''}&quot; label=&quot;Decode Base64&quot; click=&quot;btnDecode_clickHandler(event)&quot;/&gt;
		&lt;/mx:FormItem&gt;
		&lt;mx:FormItem label=&quot;Decode 结果：&quot; width=&quot;100%&quot;&gt;
			&lt;s:TextArea editable=&quot;false&quot; id=&quot;textDecodeResult&quot; width=&quot;100%&quot; text=&quot;点击Decode Base64按钮后，这里的结果应该和原始字符串相同&quot;/&gt;
		&lt;/mx:FormItem&gt;
	&lt;/mx:Form&gt;
&lt;/s:Application&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/677/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Air/Flex动态加载module及其依赖的RSL</title>
		<link>http://blog.ityao.com/archives/638</link>
		<comments>http://blog.ityao.com/archives/638#comments</comments>
		<pubDate>Wed, 05 May 2010 10:12:43 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=638</guid>
		<description><![CDATA[有关Flex和Air中如何使用RSL网上教程很多，google一下即可，这里不多做叙述了 而这次遇到的问题是这样的： 发布时只发布一个主程序（Web或者Air方式），而不发布所需要的module及其依赖的swc，只在运行时根据需要加载module及其依赖的swc 1.       建立一个实验用的module工程： 先准备一个module工程，普通的Flex Project（web）即可，主程序名无所谓，因为这个工程只是为了编译module对象用的 在Properties-&#62;Flex Build Path中引入所要依赖的swc，这个例子中使用了TweenLite.swc 注意AIR project的默认Link Type是Merge into code，改成RSL。如图： 新建一个包modules并新建一个module程序：MyModule1.mxml 到Properties-&#62;Flex Modules中修改该module的optimize属性为none，如下图 点击Edit按钮，弹出下图 选择Do not optimize(…) 在MyModule1.xml中使用TweenLite做一个简单的动画: 编译工程， 此时MyModule1.mxml被编译生成为MyModule1.swf TweenLite.swc会被编译成TweenLite.swf 复制到要被加载的目录下，我的是 http://127.0.0.1/testflex/TweenLite.swf http://127.0.0.1/testflex/modules/MyModule1.swf 2.       建立主工程（Flex Web）： 新建一个Flex Project(web),不要使用引入TweenLite.swc 新建一个用来控制加载TweenLite的类： tasks/TaskLoadRSL.as 在这个类中，使用URLLoader将TweenLite.swc从http://127.0.0.1/testflex/TweenLite.swf上加载下来，主要代码如下： 加载完TweenLite后不需要任何操作，直接开始加载module即可 使用IModuleInfo或ModuleLoader加载module都可以，详见源代码 3.       建立主工程 （AIR）： Air中比Flex要麻烦，因为发布时只发布主程序，所以运行时需要先检测本地是否有swc和 module 如果有就直接加载运行（同Web） 如果没有就从网站上下载到本地，然后再加载 主要代码如下： 从网络地址上加载： 加载完，保存到本地： 本地加载过程同Flex Web 更多内容参加源代码：DynamicTestLoadModuleAndRSL]]></description>
			<content:encoded><![CDATA[<p>有关Flex和Air中如何使用RSL网上教程很多，google一下即可，这里不多做叙述了</p>
<h5>而这次遇到的问题是这样的：</h5>
<p>发布时只发布一个主程序（Web或者Air方式），而不发布所需要的module及其依赖的swc，只在运行时根据需要加载module及其依赖的swc</p>
<h6>1.       建立一个实验用的module工程：</h6>
<p>先准备一个module工程，普通的Flex Project（web）即可，主程序名无所谓，因为这个工程只是为了编译module对象用的</p>
<p>在Properties-&gt;Flex Build Path中引入所要依赖的swc，这个例子中使用了TweenLite.swc</p>
<p><strong>注意AIR project的默认</strong><strong>Link Type</strong><strong>是</strong><strong>Merge into code</strong><strong>，改成</strong><strong>RSL</strong><strong>。如图：</strong></p>
<p><strong><a rel="attachment wp-att-645" href="http://blog.ityao.com/archives/638/3-2"><img class="alignnone size-full wp-image-645" title="设置RSL" src="http://blog.ityao.com/wp-content/uploads/2010/05/3.jpg" alt="" width="892" height="385" /></a></strong></p>
<p>新建一个包modules并新建一个module程序：MyModule1.mxml</p>
<p>到Properties-&gt;Flex Modules中修改该module的optimize属性为none，如下图</p>
<p><a rel="attachment wp-att-644" href="http://blog.ityao.com/archives/638/1-5"><img class="alignnone size-full wp-image-644" title="编辑module属性" src="http://blog.ityao.com/wp-content/uploads/2010/05/11.jpg" alt="" width="950" height="274" /></a></p>
<p>点击Edit按钮，弹出下图</p>
<p><a rel="attachment wp-att-643" href="http://blog.ityao.com/archives/638/2-5"><img class="alignnone size-full wp-image-643" title="设置module属性" src="http://blog.ityao.com/wp-content/uploads/2010/05/2.jpg" alt="" width="502" height="298" /></a></p>
<p>选择Do not optimize(…)</p>
<p>在MyModule1.xml中使用TweenLite做一个简单的动画:</p>
<pre class="brush: plain; title: ; notranslate">TweenLite.to(&lt;strong&gt;this&lt;/strong&gt;.goed,4,{x:500});</pre>
<p>编译工程，</p>
<p>此时MyModule1.mxml被编译生成为MyModule1.swf</p>
<p>TweenLite.swc会被编译成TweenLite.swf</p>
<p>复制到要被加载的目录下，我的是</p>
<p>http://127.0.0.1/testflex/TweenLite.swf</p>
<p>http://127.0.0.1/testflex/modules/MyModule1.swf</p>
<h6>2.       建立主工程（Flex Web）：</h6>
<p>新建一个Flex Project(web),不要使用引入TweenLite.swc</p>
<p>新建一个用来控制加载TweenLite的类：</p>
<p>tasks/TaskLoadRSL.as</p>
<p>在这个类中，使用URLLoader将TweenLite.swc从<a href="http://127.0.0.1/testflex/TweenLite.swf">http://127.0.0.1/testflex/TweenLite.swf</a>上加载下来，主要代码如下：</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<pre class="brush: plain; title: ; notranslate">var loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;//必须有这一句，RSL必须和主程序在同一个域中
loader.load(new URLRequest(this.web),context);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,localLoadCompleteHandler);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,localLoadIoErrorHandler);
</pre>
<p>加载完TweenLite后不需要任何操作，直接开始加载module即可</p>
<p>使用IModuleInfo或ModuleLoader加载module都可以，详见源代码</p>
<h6>3.       建立主工程 （AIR）：</h6>
<p>Air中比Flex要麻烦，因为发布时只发布主程序，所以运行时需要先检测本地是否有swc和</p>
<p>module</p>
<p>如果有就直接加载运行（同Web）</p>
<p>如果没有就从网站上下载到本地，然后再加载</p>
<p>主要代码如下：</p>
<p>从网络地址上加载：</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>
<pre class="brush: plain; title: ; notranslate">var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, loadFromWebCompleteHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, loadFromWebErrorHandler);
loader.load(new URLRequest(web))
</pre>
<p>加载完，保存到本地：</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>
<pre class="brush: plain; title: ; notranslate">var loader:URLLoader = URLLoader($e.target);
var data:ByteArray = ByteArray(loader.data);
var file:File = new File(File.applicationDirectory.resolvePath(this.local).nativePath);
trace('save file to' + file.nativePath);
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeBytes(data);
fileStream.close();
this.loadFromLocalFile();
</pre>
<p>本地加载过程同Flex Web</p>
<p>更多内容参加<a rel="attachment wp-att-648" href="http://blog.ityao.com/archives/638/dynamictestloadmoduleandrsl">源代码：DynamicTestLoadModuleAndRSL</a></p>
<p></strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/638/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bug:Flex自动帧频1000！</title>
		<link>http://blog.ityao.com/archives/594</link>
		<comments>http://blog.ityao.com/archives/594#comments</comments>
		<pubDate>Thu, 29 Apr 2010 10:39:39 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ADOBE RIA]]></category>

		<guid isPermaLink="false">http://blog.ityao.com/?p=594</guid>
		<description><![CDATA[用Flex4才发现了这个问题， 当用spark添加一个mx组件时不会有问题，但当这个mx组件中还有其他组件 例如&#60;mx:HBox&#62;&#60;mx:Canvas/&#62;&#60;/mx:HBox&#62; stage.frameRate会瞬间达到1000！ 之后会自动恢复到默认的帧频(如果不手动设定，会是24) 这时不用担心什么问题， 但如果frameRate达到1000的这段时间中，添加了一个EnterFrame事件， 并且在EnterFrame的响应函数中，调整某个组件的位置， frameRate就不会恢复回24，而是一直持续1000，知道取消了EnterFrame为止 源文件： src 源码如下： Application.mxml: components/MyComponent.mxml:]]></description>
			<content:encoded><![CDATA[<p>用Flex4才发现了这个问题，</p>
<p>当用spark添加一个mx组件时不会有问题，但当这个mx组件中还有其他组件</p>
<p>例如&lt;mx:HBox&gt;&lt;mx:Canvas/&gt;&lt;/mx:HBox&gt;</p>
<p>stage.frameRate会瞬间达到1000！</p>
<p>之后会自动恢复到默认的帧频(如果不手动设定，会是24)</p>
<p>这时不用担心什么问题，</p>
<p>但如果frameRate达到1000的这段时间中，添加了一个EnterFrame事件，</p>
<p>并且在EnterFrame的响应函数中，调整某个组件的位置，</p>
<p>frameRate就不会恢复回24，而是一直持续1000，知道取消了EnterFrame为止</p>
<p>源文件：<br />
<a href='http://blog.ityao.com/archives/594/src' rel='attachment wp-att-598'>src</a><br />
源码如下：<br />
Application.mxml:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot; frameRate=&quot;12&quot;
			 backgroundColor=&quot;0xFF00FF&quot;&gt;
	&lt;fx:Script&gt;
		&lt;![CDATA[

			import components.MyComponent;

			import mx.containers.HBox;
			import mx.core.UIComponent;
			import mx.events.FlexEvent;

			protected function button2_clickHandler(event:MouseEvent):void
			{
				trace(this.stage.frameRate);
				this.txt.text = &quot;Current FrameRate:&quot;+this.stage.frameRate.toString();
			}

			protected var _box:UIComponent;
			protected function button3_clickHandler(event:MouseEvent):void
			{
				_box = new MyComponent();
				this.container2.removeAllElements();
				this.container2.addElement(_box);
				button2_clickHandler(null);
				button4_clickHandler(null);
			}

			protected function enterFrameHandler(event:Event):void
			{
				if(_box){
					container1.x+=0.2;
				}
			}
			protected function button4_clickHandler(event:MouseEvent):void
			{
//				this.moveEffect.play([this.container2]);
				this.addEventListener(Event.ENTER_FRAME,this.enterFrameHandler);
			}
			protected function button5_clickHandler(event:MouseEvent):void
			{
				this.removeEventListener(Event.ENTER_FRAME,this.enterFrameHandler);
			}

		]]&gt;
	&lt;/fx:Script&gt;

	&lt;fx:Declarations&gt;
		&lt;s:Move id=&quot;moveEffect&quot; duration=&quot;10000&quot; xFrom=&quot;10&quot; xTo=&quot;300&quot; yFrom=&quot;10&quot; yTo=&quot;300&quot;/&gt;
	&lt;/fx:Declarations&gt;
	&lt;mx:Canvas id=&quot;container1&quot; y=&quot;60&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
	&lt;s:SkinnableContainer id=&quot;container2&quot; x=&quot;20&quot; y=&quot;80&quot; width=&quot;900&quot; height=&quot;600&quot;/&gt;

	&lt;s:Group&gt;
		&lt;s:layout&gt;
			&lt;s:HorizontalLayout&gt;
			&lt;/s:HorizontalLayout&gt;
		&lt;/s:layout&gt;
		&lt;s:Button click=&quot;button2_clickHandler(event)&quot; label=&quot;Trace frameRate&quot;/&gt;
		&lt;s:Label text=&quot;&quot; id=&quot;txt&quot; width=&quot;100&quot;/&gt;
		&lt;s:Button click=&quot;button3_clickHandler(event)&quot; label=&quot;load MyComponent&quot;/&gt;
		&lt;s:Button click=&quot;button4_clickHandler(event)&quot; label=&quot;Start Move&quot;/&gt;
		&lt;s:Button click=&quot;button5_clickHandler(event)&quot; label=&quot;Stop Move&quot;/&gt;
	&lt;/s:Group&gt;
&lt;/s:Application&gt;
</pre>
<p>components/MyComponent.mxml:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:HBox xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
		 xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
		 xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot;
		 &gt;
	&lt;mx:Canvas backgroundAlpha=&quot;1&quot; width=&quot;30&quot; height=&quot;30&quot; backgroundColor=&quot;0x0000F0&quot;/&gt;
&lt;/mx:HBox&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/594/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

