<?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; Adobe Flash</title>
	<atom:link href="http://blog.ityao.com/archives/category/adobe-ria/adobeflash/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>Flex 4.1以及Flash Builder 4.0.1更新</title>
		<link>http://blog.ityao.com/archives/749</link>
		<comments>http://blog.ityao.com/archives/749#comments</comments>
		<pubDate>Fri, 02 Jul 2010 01:37:52 +0000</pubDate>
		<dc:creator>Silver</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=749</guid>
		<description><![CDATA[针对Flash Player 10.1的开发工具更新，快更新吧！ Adobe has publicly pushed the Flex 4.1/Flash Builder 4.0.1 update, which includes: The new Layout Mirroring feature for repurposing Flex UIs for deployment in right-to-left locales Native support for Flash Player 10.1 and AIR 2 in the Flex SDK Native support in Flash Builder 4.0.1 for building apps targeting SDK 4.1, AIR [...]]]></description>
			<content:encoded><![CDATA[<p>针对Flash Player 10.1的开发工具更新，快更新吧！</p>
<p>Adobe has publicly pushed the Flex 4.1/Flash Builder 4.0.1 update, which includes:</p>
<p>The new Layout Mirroring feature for repurposing Flex UIs for deployment in right-to-left locales<br />
Native support for Flash Player 10.1 and AIR 2 in the Flex SDK<br />
Native support in Flash Builder 4.0.1 for building apps targeting SDK 4.1, AIR 2 or FP 10.1<br />
Many critical bugfixes and enhancement requests for both Flex SDK and Flash Builder </p>
<p>Adobe has also officially debuted the next release of the Flex SDK, code-named Hero. We share with the world our amazing story of a single unified Flex framework that can be used to build applications for the web, desktop and mobile devices. With today’s debut, we released many new documents and feature specifications, including:</p>
<p>Inaugural launch of the new Hero opensource Flex page<br />
Posting of several new Hero desktop and Hero mobile feature specifications<br />
Updated the labs.adobe.com Flex Mobile content to announce our intent to add mobile development capabilities directly into the core Flex framework, including<br />
o Updating the Flex and Mobile Whitepaper<br />
o Updating the Flex and Mobile FAQ</p>
<p>Please help us spread the word regarding these announcements. You can find more details in the following two blog postings:<br />
Flex SDK 4 and Flash Builder 4 Updates Now Available http://blogs.adobe.com/flex/archives/2010/06/flex_sdk_4_and_flash_builder_4.html<br />
Introducing….Hero! </p>
<p>http://blogs.adobe.com/flex/archives/2010/06/introducinghero.html</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/749/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe Flash Player 10.1 and Adobe AIR 2 正式发布</title>
		<link>http://blog.ityao.com/archives/737</link>
		<comments>http://blog.ityao.com/archives/737#comments</comments>
		<pubDate>Fri, 11 Jun 2010 01:55:41 +0000</pubDate>
		<dc:creator>Silver</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=737</guid>
		<description><![CDATA[Rachel Luxemburg wrote: Hi All! Adobe Flash Player 10.1 and Adobe AIR 2 are now available for Windows, Mac and Linux operating systems. To download the runtimes, go to http://get.adobe.com/flashplayer/ for Flash Player and http://get.adobe.com/air/ for AIR 2. More info is posted on the AIR team blog, http://blogs.adobe.com/air/ and the Flash Player Team blog http://blogs.adobe.com/flashplayer/. [...]]]></description>
			<content:encoded><![CDATA[<p>Rachel Luxemburg wrote:</p>
<p>Hi All!</p>
<p>Adobe Flash Player 10.1 and Adobe AIR 2 are now available for Windows, Mac and Linux operating systems. To download the runtimes, go to http://get.adobe.com/flashplayer/ for Flash Player and<br />
http://get.adobe.com/air/ for AIR 2.</p>
<p>More info is posted on the AIR team blog, http://blogs.adobe.com/air/ and the Flash Player Team blog http://blogs.adobe.com/flashplayer/.</p>
<p>We’re really excited that we’re finally &#8220;over the finish line&#8221; with these releases, there’s a lot of new features &#038; some real performance improvements. </p>
<p>Please help spread the word, and enjoy!</p>
<p>Rachel </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/737/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>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>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>httpservice request传参数的几种方式</title>
		<link>http://blog.ityao.com/archives/629</link>
		<comments>http://blog.ityao.com/archives/629#comments</comments>
		<pubDate>Wed, 05 May 2010 04:18:40 +0000</pubDate>
		<dc:creator>syw00syw</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=629</guid>
		<description><![CDATA[mxml代码中 httpservice 组件,连接一php计算器 httpService组件，在as块中传入参数 as代码中，使用httpservice类 as代码中使用urlloader]]></description>
			<content:encoded><![CDATA[<p>mxml代码中 httpservice 组件,连接一php计算器</p>
<pre class="brush: plain; title: ; notranslate">
&lt;s:Button click=&quot;this.hs.send();&quot;/&gt;
&lt;fx:Declarations&gt;
	&lt;s:HTTPService id=&quot;hs&quot; url=&quot;http://127.0.0.1/cal.php&quot; method=&quot;GET&quot;&gt;
		&lt;s:request xmlns=&quot;&quot;&gt;
			&lt;calculator&gt;plus&lt;/calculator&gt;
			&lt;param1&gt;10&lt;/param1&gt;
			&lt;param2&gt;23&lt;/param2&gt;
		&lt;/s:request&gt;
		&lt;s:fault&gt;
			&lt;![CDATA[
				trace(&quot;&quot;)
			]]&gt;
		&lt;/s:fault&gt;
		&lt;s:result&gt;
			&lt;![CDATA[
				trace(event.result.result.equals)
			]]&gt;
		&lt;/s:result&gt;
	&lt;/s:HTTPService&gt;
&lt;/fx:Declarations&gt;
</pre>
<p>httpService组件，在as块中传入参数</p>
<pre class="brush: plain; title: ; notranslate">
var param:Object = {calculator:&quot;minus&quot;,param1:&quot;23&quot;,param2:&quot;13&quot;}
httpServ.send(param)

&lt;mx:HTTPService id=&quot;httpServ&quot;&gt;
	&lt;mx:resultFormat&gt;text&lt;/mx:resultFormat&gt;
	&lt;mx:url&gt;http://127.0.0.1/cal.php&lt;/mx:url&gt;
	&lt;mx:fault&gt;Alert.show(event.toString(), event.type);&lt;/mx:fault&gt;
&lt;/mx:HTTPService&gt;
</pre>
<p>as代码中，使用httpservice类</p>
<pre class="brush: plain; title: ; notranslate">
public var httpservice:mx.rpc.http.HTTPService = new mx.rpc.http.HTTPService();
public var param:Object={calculator:&quot;minus&quot;,param1:&quot;23&quot;,param2:&quot;13&quot;};
public function send_data():void{
	httpservice.url =&quot;http://127.0.0.1/cal.php&quot;;
	httpservice.method = &quot;POST&quot;;
	httpservice.addEventListener(ResultEvent.RESULT, resultHandler);
	httpservice.addEventListener(FaultEvent.FAULT, this.HttpErrorHandle);
	httpservice.send(param);
		}
</pre>
<p>as代码中使用urlloader</p>
<pre class="brush: plain; title: ; notranslate">
public function Temp()
		{
			var url:String = &quot;http://127.0.0.1/cal.php&quot;
			var urlVariables:URLVariables = new URLVariables();
			urlVariables.decode(&quot;calculator=plus&amp;param1=10&amp;param2=22&quot;);
			var request:URLRequest = new URLRequest(url);
			request.data = urlVariables;
			request.method = URLRequestMethod.POST

			var loader:URLLoader = new URLLoader()
			loader.dataFormat = URLLoaderDataFormat.TEXT
			loader.addEventListener(Event.COMPLETE, onComplete)
			loader.load(request);

		}
		public function onlistener(event:Event):void{
			var xml:XML = new XML(event.target.data)

			trace(xml..equals)
		}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/629/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3中使用Twitter API</title>
		<link>http://blog.ityao.com/archives/601</link>
		<comments>http://blog.ityao.com/archives/601#comments</comments>
		<pubDate>Tue, 04 May 2010 07:59:49 +0000</pubDate>
		<dc:creator>syw00syw</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=601</guid>
		<description><![CDATA[自制app使用Twitter API 1.1   准备工作 A．注册Twitter用户 B． 下载库文件http://dev.twitter.com/pages/libraries 本实例使用ActionScript 库文件 TwitterScript http://code.google.com/p/twitterscript/ C． Twitter官方文档 http://dev.twitter.com/doc TwitterScript并无说明文档，Twitter官方的文档和TwitterScript的代码不一致，但不矛盾。 1.2 需求说明 制作AIR程序（图1），实现如下功能 a．  显示当前用户头像，用户名 b．  显示当前用户following   followers c．  显示当前用户friends Tweet  public Tweet d．  提交新Tweet，并体现到friends Tweet中 图1 程序界面 1.3编写代码 Twitter数据调用多数需要身份验证，有的是不需要的。 Twitter的身份验证简单，只需将用户名和密码编码后嵌入到实际调用数据的request的requestHeaders中即可（暂不考虑OAuth），不同于facebook须登录后得到session-key才能调用数据。 TwitterScript 中的方法： 类Twitter.as中function setAuthenticationCredentials(“username”,”password”) 此方法只是将用户的名和密码编码,function twitterRequest（）负责将编码嵌入到requestHeaders，该嵌入过程被整合到各个具体调用数据的方法中因此编写程序代码时不用考虑此过程 A．制作登录页面，通过TextInput将用户名密码传给程序。（图2） 图2 提示：两个state ，登录界面和程序界面两个界面大小可以不同：代码如 Sign in按钮click=“sign_in( )” B． 定义sign_in方法，调用数据 var twitter：Twitter = new [...]]]></description>
			<content:encoded><![CDATA[<h1>自制app使用Twitter API</h1>
<h2>1.1   准备工作</h2>
<p>A．注册Twitter用户</p>
<p>B． 下载库文件<a href="http://dev.twitter.com/pages/libraries">http://dev.twitter.com/pages/libraries</a></p>
<p>本实例使用ActionScript 库文件 TwitterScript <a href="http://code.google.com/p/twitterscript/">http://code.google.com/p/twitterscript/</a></p>
<p>C． Twitter官方文档 <a href="http://dev.twitter.com/doc">http://dev.twitter.com/doc</a> TwitterScript并无说明文档，Twitter官方的文档和TwitterScript的代码不一致，但不矛盾。</p>
<h2>1.2 需求说明</h2>
<p>制作AIR程序（图1），实现如下功能</p>
<p>a．  显示当前用户头像，用户名</p>
<p>b．  显示当前用户following   followers</p>
<p>c．  显示当前用户friends Tweet  public Tweet</p>
<p>d．  提交新Tweet，并体现到friends Tweet中</p>
<p><em>图1 程序界面</em></p>
<h2>1.3编写代码</h2>
<p>Twitter数据调用多数需要身份验证，有的是不需要的。</p>
<p>Twitter的身份验证简单，只需将用户名和密码编码后嵌入到实际调用数据的request的requestHeaders中即可（暂不考虑OAuth），不同于facebook须登录后得到session-key才能调用数据。</p>
<p>TwitterScript 中的方法：</p>
<p>类Twitter.as中function setAuthenticationCredentials(“username”,”password”)</p>
<p>此方法只是将用户的名和密码编码,function twitterRequest（）负责将编码嵌入到requestHeaders，该嵌入过程被整合到各个具体调用数据的方法中因此编写程序代码时不用考虑此过程</p>
<p>A．<strong>制作登录页面，通过TextInput将用户名密码传给程序</strong>。（图2）</p>
<p>图2</p>
<p>提示：两个state ，登录界面和程序界面两个界面大小可以不同：代码如</p>
<pre class="brush: plain; title: ; notranslate">&lt;s:WindowedApplication 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;800&quot; height=&quot;500&quot;
					   currentState=&quot;sign_out&quot; width.sign_out=&quot;320&quot; height.sign_out=&quot;230&quot;
					   width.sign_in=&quot;628&quot; height.sign_in=&quot;500&quot;&gt;</pre>
<p>Sign in按钮click=“sign_in( )”</p>
<p><strong>B． </strong><strong>定义sign_in方法，调用数据</strong></p>
<p>var twitter：Twitter = new Twitter（）</p>
<p>twitte.setAuthenticationCredentials(usrId.text, passwd.text)</p>
<p>对用户名 密码编码， userId 和 passwd是登录页面两个输入框的ID</p>
<p>twitter.loadInfo(userId.text)</p>
<p>twitter.addEventListener(TwitterEvent.ON_SHOW_INFO, onloadInfo)</p>
<p>调用user信息</p>
<p>twitter.loadFriends(usrId.text)</p>
<p>twitter.addEventListener(TwitterEvent.ON_FRIENDS_RESULT, onloadfriends)</p>
<p>调用user following</p>
<p>twitter.loadFriendsTimeline(userID.text)</p>
<p>twitter.addEventListener(TwitterEvent.ON_FRIENDS_TIMELINE_RESULT, onloadUserTimeLine)</p>
<p>调用friends Tweet</p>
<p>twitter.addEventListener(TwitterEvent.ON_ERROR, onerror)</p>
<p>监听error</p>
<p>C． <strong>处理返回结果。制作程序界面</strong>（如图3）</p>
<p>图3</p>
<p>a．显示用户名 头像</p>
<p>loadInfo方法返回的data类型为TwitterUser，包含name ，square url等，处理方法略</p>
<p>b．显示following用户名</p>
<p>loadFriends方法返回TwitterUser的Array</p>
<p>var tmp：Array = event.data as Array</p>
<p>for (var i:int; i&lt;tmp.length; i++){</p>
<p>var user:TwitterUser = tmp[i];</p>
<p>followname.addItem({flwname:user.name})</p>
<p>followname:ArrayCollection 绑定为显示following 的List的数据源，List标签中建itemrenderer 代码如</p>
<pre class="brush: plain; title: ; notranslate">&lt;fx:Script&gt;
		&lt;![CDATA[

			[Bindable]
			public var displayname:String;
			override public function set data(value:Object):void{

				displayname = new String(value.flwname)

			}
		]]&gt;
	&lt;/fx:Script&gt;
	&lt;s:VGroup&gt;
			&lt;s:Label text=&quot;{displayname}&quot;/&gt;
	&lt;/s:VGroup&gt;</pre>
<p>提示：也可显示头像、创建时间、时区等等</p>
<p>c．显示user ‘s friends Tweet   public Tweet</p>
<p>loadFriendsTimeline方法返回Tweet的Array包含text 和发布者信息等</p>
<p>var tmp:Array = event.data as Array;</p>
<p>for(var i:int;i&lt;event.data.length;i++){ tweetArray.addItem(tmp[i])}</p>
<p>tweetArray：ArrayCollection绑定为显示tweet的DataGrid的数据源，DataGrid代码</p>
<pre class="brush: plain; title: ; notranslate">&lt;mx:DataGrid x=&quot;10&quot; y=&quot;87&quot; width=&quot;607&quot; height=&quot;327&quot; dataProvider=&quot;{tweetArray}&quot;&gt;
			&lt;mx:columns&gt;
				&lt;mx:DataGridColumn headerText=&quot;Tweet&quot; dataField=&quot;text&quot;/&gt;
				&lt;mx:DataGridColumn headerText=&quot;Tweeter&quot; dataField=&quot;user.name&quot; width=&quot;100&quot;/&gt;
			&lt;/mx:columns&gt;
		&lt;/mx:DataGrid&gt;</pre>
<p>d．  提交新Tweet。添加输入框和提交按钮，按钮事件sendTweet（）</p>
<p>public function sendTweet():void{</p>
<p>var Tweet:String = tweet.text</p>
<p>将输入内容赋值给变量Tweet</p>
<p>twitter.setStatus(Tweet);</p>
<p>提交Tweet</p>
<p>twitter.addEventListener(TwitterEvent.ON_SET_STATUS, onsetstatus)</p>
<p>监听是否成功</p>
<p>tweet.text = &#8220;&#8221;} 将输入框中文本清除</p>
<p>提交成功后onsetstatus方法刷新一下DataGrid的数据 定义刷新方法</p>
<p>function freshTweet（）本例将loadFriendsTimeline方法提出另定义为LoadFriendsTimeLine方法，function freshTweet（）执行LoadFriendsTimeLine方法。</p>
<p>e．  添加刷新按钮  添加button 定义skinClass=“com.skin.freshButton”按钮图存同一路径 freshButton 代码</p>
<pre class="brush: plain; title: ; notranslate">&lt;s:states&gt;
		&lt;s:State name=&quot;disabled&quot; /&gt;
		&lt;s:State name=&quot;down&quot; /&gt;
		&lt;s:State name=&quot;over&quot; /&gt;
		&lt;s:State name=&quot;up&quot; /&gt;
	&lt;/s:states&gt;
	&lt;s:BitmapImage source=&quot;@Embed('arrow_refresh.png')&quot;/&gt;</pre>
<p>按钮 buttonmode=“true”click=“freshTweet（）”</p>
<p>f．   添加Alert.Show 。之前监听Error的响应方法 编写代码</p>
<p>var alert:Alert = Alert.show(&#8220;something was wrong,click button for try again&#8221;)</p>
<p>登录页面 检验是否输入用户名密码</p>
<p>if(userId.text==&#8221;"||passwd.text==&#8221;"){ Alert.show(&#8220;please enter your username and password!&#8221;)}</p>
<h1>2 Twitter官网工具</h1>
<p>API Status    查看各API状态</p>
<p><a href="http://dev.twitter.com/status">http://dev.twitter.com/status</a></p>
<p>API Console     Web Console</p>
<p><a href="http://dev.twitter.com/start">http://dev.twitter.com/start</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ityao.com/archives/601/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

