Jun 13

发现了个调试WEB-flash的小宝贝“FlashFireBug”,可以抛弃“xray”了

ActionScript3.0
重装系统后,要下载firebug,无意发现个插件叫“FlashFireBug”,看名字是FLASH调试插件,于是安装看看
效果相当好,下面说说安装步骤和使用说明

一、先安装插件地址
二、然后下载as3的FlashFireBug类库,怎么引用包不用讲了吧

压缩包里有com.adobe的类库,有用到json。 还有包 ominds 和 utility。
我在想为什么不把他们放在一起,估计utility里的CharacterEntity类不是作者原创,所以..........

May 24

五一假期做了个小游戏,颠球,处女作

ActionScript3.0


做了个颠球游戏,难点就是球要做抛物线运动并经过指定的箭头位置
找高中物理公式摆弄了一番

水平是匀速运动,这就算出了运动到目标的时间
垂直方向,已知目标的高度,和运动时间,加速度,求出初始速度即可
可是并不是那么好算哦
有兴趣的朋友算算,也好复习一下高中物理 嘿嘿ie

来玩玩吧 地址
May 21

做项目要做倒计时,就写了一个倒计时类,分享....

ActionScript3.0


TimeBack.as 代码如下:

package
{
  import flash.events.Event;
  import flash.events.EventDispatcher;
  import flash.events.TimerEvent;
  import flash.utils.Timer;
  /**
   * ...倒计时工具
   * @author Emment
   */
  public class TimeBack extends EventDispatcher
  {
    private var timer:Timer;
    
    public var ss:int;
    public var mm:int;
    
    public function TimeBack() 
    {
      timer = new Timer(1000);
      timer.addEventListener(TimerEvent.TIMER, timerHandler);
    }
    /**
     * 秒
     * @param  mm
     */
    public function startRedTime(m:int):void
    {
      mm = Math.floor(m / 60);
      ss = m % 60;
      timer.reset();
      timer.repeatCount = m;
      timer.start();
    }
    private function timerHandler(e:TimerEvent):void
    {
      if (ss == 0) {
        ss = 59; 
        if (mm == 0) {
          timer.stop();
          ss = 0;
        }else {
          mm --; 
        }
      }else {
        ss--;
      }
      var evt:Event = new Event("seconds");
      dispatchEvent(evt);
    }
  }

}

Apr 8

关于as3的安全策略 crossdomain.xml

ActionScript3.0
当你的flash程序去访问其他域的数据
必须得到被访问域的允许,默认会下载被加载域根目录下的安全策略文件 crossdomain.xml
当然你也可以自己去显示的加载制定目录下的 策略文件 但是获得的权限也在该目录以及子目录

flashPlayer10 之后,安全策略做了一些调整,主策略文件必须被加载,通过主策略文件的设置,才可能被允许存在其他策略文件

cross-domain-policy 为根节点
子节点有:
site-control
(如果该XML并非主策略文件,此节点被忽略,通过检查该节点的属性值,确认是否可以允许存在其他策略文件)
属性:permitted-cross-domain-policies
值:
none: 什么都不允许,包括主策略文件
master-only: 只允许主策略文件.
by-content-type: 只允许[HTTP/HTTPS]
by-ftp-filename: 只允许[FTP]
all: 允许任何目标域策略文件授予的权限,允许访问任何文件,并允许任何头被发送到服务器(强烈不推荐)

allow-access-from
属性:domain
值:可以带通配符的域 如:*.test.com
属性:to-ports
值:允许的端口范围,(*)是全部允许
属性:secure
值:默认是true. 也建议true. 否则会影响https的安全性 多的就不说啦

allow-access-from-identity
略............
allow-http-request-headers-from
(对header的访问允许设置)
属性:domain
值:可以带通配符的域 如:*.test.com
属性:headers
值:逗号隔开的列表
属性:secure
值:默认是true. 也建议true. 否则会影响https的安全性 多的就不说啦

例子:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*.example.com" to-ports="507,516-523"/>
<allow-access-from domain="www.example.com" />
<allow-http-request-headers-from domain="*.adobe.com" headers="SOAPAction"/>
</cross-domain-policy>


Generic DTD
http://www.adobe.com/xml/dtds/cross-domain-policy.dtd
Generic XSD
http://www.adobe.com/xml/schemas/PolicyFile.xsd
HTTP XSD
http://www.adobe.com/xml/schemas/PolicyFileHttp.xsd
HTTPS XSD
http://www.adobe.com/xml/schemas/PolicyFileHttps.xsd
FTP XSD
http://www.adobe.com/xml/schemas/PolicyFileFtp.xsd
Socket XSD
http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd
Jan 22

SWF tag support chart

ActionScript3.0
Tag ID Read Write Tag Name
0 x x End
1 x x ShowFrame
2 x DefineShape
4 x PlaceObject
5 x x RemoveObject
6 x x DefineBits
7 x DefineButton
8 x x JPEGTables
9 x x SetBackgroundColor
10 x DefineFont
11 x DefineText
12 x x DoAction
13 x DefineFontInfo
14 x x DefineSound
15 x StartSound
17 x DefineButtonSound
18 x SoundStreamHead
19 x x SoundStreamBlock
20 x x DefineBitsLossless
21 x x DefineBitsJPEG2
22 x DefineShape2
23 x DefineButtonCxform
24 x x Protect
26 x x PlaceObject2
28 x x RemoveObject2
32 x DefineShape3
33 x DefineText2
34 x DefineButton2
35 x x DefineBitsJPEG3
36 x x DefineBitsLossless2
37 x DefineEditText
39 x x DefineSprite
41 x ProductInfo
43 x x FrameLabel
45 x SoundStreamHead2
46 x DefineMorphShape
48 x DefineFont2
56 x x ExportAssets
57 x x ImportAssets
58 x x EnableDebugger
59 x x DoInitAction
60 x DefineVideoStream
61 x x VideoFrame
62 x DefineFontInfo2
63 x DebugID
64 x x EnableDebugger2
65 x x ScriptLimits
66 x x SetTabIndex
69 x x FileAttributes
70 x PlaceObject3
71 x x ImportAssets2
73 x DefineFontAlignZones
74 x x CSMTextSettings
75 x DefineFont3
76 x x SymbolClass
77 x x Metadata
78 x DefineScalingGrid
82 x x DoABC
83 x DefineShape4
84 x DefineMorphShape2
86 x x DefineSceneAndFrameLabelData
87 x x DefineBinaryData
88 x DefineFontName
89 x StartSound2
90 x x DefineBitsJPEG4
91 x DefineFont4
Jan 7

as3类包打包成SWC相关

ActionScript3.0
flex中打包的方法:
1. 新建一个 flex library project
2. 弹出的对话框 点 next ,在Classes下,找到Main source folder 点浏览
3. 选择你新建的文件夹 点 new 然后点击 OK
4. 这个时候 Classes 下多了个src 文件夹,打开源文件夹,把你的类包复制进去
5. 回到flex library project ,右键 - 属性 - 点击Flex library build path,在Classes下面看到src文件夹,勾选,点确定
6. bin 目录下面就有了SWC文件啦
Dec 10

跨域不光要crossdomain.xml 还要这个

ActionScript3.0

<param name="allowScriptAccess" value="always" />

Nov 17

as3和as2的相互通信

ActionScript3.0
AS3文件跟AS2文件互相都不可以进行操作(跟两个swf独立运行无区别)..
我们常用的解决方法是使用LocalConnection作为他们之前的桥梁..

在AS3端:
var server:LocalConnection = new LocalConnection();
server.connect("as3_server");
server.client = this;
....

Oct 27

as3的cookies访问

ActionScript3.0
FLASH 有2种 cookies
一种是传统浏览器中的cookies
一种是AS3 自带的
下面就把基于以上两种的Cookies类发布一下 很有用
...
Sep 30

怒了,解决了个as3.0比较呕心的问题,有关于网站的,希望对大家有帮助

ActionScript3.0
从事FLASH网站开发的人员,可能目前还是2.0居多吧
2.0开发网站,一个主文件,然后很多栏目子栏目都可以做成SWF文件
通过这个主文件加载进来编织在一起,那样做虽然整体性很难保持流畅感
但是层次还算清楚。
我没有学过2.0,但是基本的原理我都清楚
用3.0做网站的话都是写文档类,动画只是一个演员。
动画和程序逻辑分开
但是有时候做网站 确实也需要用到加载一些SWF的地方 而且包含代码
那样就.....................