Category Archives: Flex

Flash程序员常用软件及开源程序

常用软件

1.Firefox浏览器,主要用于Flash的调试.
Firefox附加插件:
firebug
flashtracer,调试时查看Flash调试信息.
webdeveloper,最常用的就是在调试时禁用缓存.
flashplayer debugger 配合flashtracer,如果不是这个版本的FlashPlayer的话,无法正常打印调试信息.

2.FlashDevelop 一个开源的Flash开发工具.

3.Adobe Flash CS3 Professional

4.Flash CS4

5.Adobe Flash Builder 4

6.Adobe Photoshop CS4

7.Sothink SWF Decompiler,用于反编译SWF文件.

8.Vizzy,调试Flash时查看调试信息,与flashtracer相同,但是不依赖具体浏览器,只要浏览器装的flashplayer是debugger版的就行.

9.IIS,Flash网站本地调试时使用.

常用开源程序

1.TweenLite,实现动画效果.

2.SwfObject,网页中嵌入SWF.

3.SwfAddress,实现Flash网页的Deeplink.

使Flex编译的swc文件在Flash下可用

一直不明白如何将很多的类编译成一个swc文件,并且在Flash里可用,就像Google Map Flash API一样,今天终于找到了。http://vincent.the.tsao.googlepages.com/ 这篇文章有很详细的说明。现转于此:

Last updated: 24-August-2008

Problem

Many API’s or code libraries written in ActionScript 3 and compiled into SWC files are meant for use with Flex tools and are unable to be imported into the Flash CS3 Authoring Environment.  This tutorial will show you how you can (theoretically) take any SWC made for Flex and use it in Flash CS3.

Resources

You will need the following programs/tools:

  • Flash CS3
  • Flex SDK 2.0.1 with Hotfix 3

(note that we are intentionally NOT using Flex SDK 3.0)

You can get Flex SDK 2.0.1 with Hotfix 3 here:
http://labs.adobe.com/technologies/flex/sdk/flex2sdk.html

Explanation

If you just want the steps, you can skip down to the next section, but this describes why the method works.  When we say “Flex SWC”, what we really mean is a code-only SWC file which contains no DisplayObject components.  Only SWC files with a DisplayObject component can be imported into the Flash CS3 Authoring Environment.  Thus in order to make a Flex SWC usable in Flash CS3, we use the Flex SDK’s compc tool to statically link it with a stub SWC file generated in Flash CS3 that is a DisplayObject.  We require the Flex SDK 2.0.1 Hotfix 3 version of compc because Flex SDK 3.0’s compc utility generates SWC files of version 1.2 and Flash CS3 can only use SWC files of version 1.0.  More over, earlier versions of the Flex SDK 2.0.1 compc utility could not read SWC files compiled by the Flash CS3 authoring environment, thus the need for Hotfix 3.  So the newly compiled SWC file is actually two SWC files put into one – a DisplayObject SWC and the original Flex SWC and can therefore be used within Flash CS3.

Steps

Part I: Creating a Stub DisplayObject SWC in Flash CS3

  1. Create a new ActionScript 3 FLA file in Flash CS3.
  2. Create a new symbol in the library (you do not need to create an instance of it), name it whatever you want.
  3. Go into your library and right click on the symbol you just created.  Select “Component Definition…”
  4. Type in whatever you want your component to be called as the class name (no spaces).
  5. Under the options part, check all the boxes and ensure the minimum Flash Player is 9 and the minimum ActionScript version is 3.
  6. Leave everything else alone, press OK.
  7. Right click the symbol again in your library and select and select “Linkage…”
  8. Check the “Export for ActionScript” box and the “Export in first frame” box should be automatically checked as well.
  9. The class name should be the same name you gave it earlier.
  10. Ensure the base class is indeed MovieClip, click OK.
  11. Right click the symbol again in your library and select “Export SWC File…”
  12. Pick a place to save it.

Part II: Putting the two SWC Files Together

  1. Use the compc program to wrap what you have just created with the Flex SWC you want to use in the Flash CS3 authoring environment.  Here is a simple example:compc -source-path+=. -output=bin\map_flash_1_6.swc -include-libraries=.\GoogleMapsFlashAPI.swc,.\map_flex_1_6.swcNote the above command is all on one line (no line breaks). The file “map_flash_1_6.swc” is the name we choose for the component we output. “GoogleMapsFlashAPI.swc” is the name of the SWC we created in Flash CS3 in Step 1 and “map_flex_1_6.swc” is the SWC you want to be able to use in Flash CS3.
  2. Place your newly generated SWC file in your Flash components folder. It should be something like “\Adobe Flash CS3\en\Configuration\Components\”. If you are unsure where this is located on your computer, Google it.
  3. Open the FLA file you want to import the SWC into and open the Components panel (Ctrl+F7 in Windows).
  4. Reload the Components panel if necessary.
  5. Drag your SWC file into your library (note: that there does NOT need to be an instance of the SWC on your stage since it would be useless).

Please let me know if this does not work.
My contact is vincent.the.tsao [–at–] gmail [–dot–] com

Firefox下Flash层叠显示的怪异现象

在Firefox下看上面两个层叠的Flash的显示,效果会很怪异,两个Flash在显示时,层次混乱。下面是相应的代码:
<div style=”z-index:30;”>
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0″ width=”550″ height=”400″>
<param name=”movie” value=”test0.swf” />
<param name=”quality” value=”high” />
<embed src=”test0.swf”
quality=”high” pluginspage=”http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash”
type=”application/x-shockwave-flash” width=”550″ height=”400″>
</embed>
</object>
</div>
<div style=”z-index:100; margin-top:-300px;”>
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0″ width=”550″ height=”400″>
<param name=”movie” value=”test1.swf” />
<param name=”quality” value=”high” />
<embed src=”test1.swf” quality=”high” pluginspage=”http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash” type=”application/x-shockwave-flash” width=”550″ height=”400″></embed>
</object>
</div>
在IE下显示没有这个问题。不知道是Firefox的问题,还是Firefox下的Flashplayer的问题。我想了一个解决这个问题的办法,就是将其中的一个或者两个都分别放到另外的页面里,然后通过iframe来加载,而不是直接使用object标签。
下面将主页面index.html的body里面的代码改成下面这样:
<div>
<iframe src=”frame.html” width=”550″ height=”400″ frameborder=”0″></iframe>
</div>
<div style=”margin-top:-300px”>
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0″ width=”550″ height=”400″>
<param name=”movie” value=”test1.swf” />
<param name=”quality” value=”high” />
<embed src=”test1.swf” quality=”high” pluginspage=”http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash” type=”application/x-shockwave-flash” width=”550″ height=”400″></embed>
</object>
</div>
页面frame.html的body里面的代码如下:
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0″ width=”550″ height=”400″>
<param name=”movie” value=”test0.swf” />
<param name=”quality” value=”high” />
<embed src=”test0.swf” quality=”high” pluginspage=”http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash” type=”application/x-shockwave-flash” width=”550″ height=”400″></embed>
</object>
显示效果如下:
试了一下这样,在Firefox2和Firefox3(包括Mac下的)都能正常,不过,Windows下的Safari还是不能正常,庆幸的是Mac上的Safari是正常的,毕竟没人会在Windows下用Safari看网页吧。
Windows Firefox 3.6中已经不存在这样的问题。

Flex 3 编译Library的问题及解决方法

这两个搞了一个flash,因为项目比较大,所以我想将一些较为基础的类的代码打到一个包里,本以为很简单的事情,搞了半天也没搞出来。我是用的flex 3做的开发。

问题是,如果将所有的类放到一个 actionscript project 中,Flex 在编译时,事实上并不会将本项目文件夹下的所有类代码都包进来,它似乎只关心它要用到的一些代码。这一点跟VS是完全不一样的。我想或许哪边有这一个选项的设置,可惜找了半天也没找到,试着用flash编译项目,也是一个样的。晕死…

actionscript project 搞不定就重搞了一个 flex library project, 不过发现也是有问题的,我是想让它生成.swf的文件,不过flex library project默认是在bin文件夹下生成一个.swc的文件。得解压了才会出现一个library.swf,这还是不能满足我的要求。后来发现可以通过设置一些编译的参数来达到目的,不过,文件名还是叫library.swf,只是不是将它跟另一个文件打包成一个.swc文件,而是放到一个目录里。唉,也算是基本达到目的了吧。至于设置编译参数的参考,可以到 http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_04.html 上看看,而事实上我倒是没有用这个方法,太烦,这就是我最讨厌的非微软阵营的一大特点,很多简单的事确复杂化了。我用了ant来编译的。具体方法参考 http://www.jakehilton.com/?q=node/27 ,只是这篇文章里的相应的编译参数要更改。下面代码是我的大致的设置:
[xml]







[/xml]