惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - 以天

用DTS从Excel中往SQL SERVER导入数据的问题 - 以天 - 博客园 FLASH的安全策略,PNG/XML HttpHandle中间的Session的使用 与 web.config中HttpModel 用Eclipse+CDT+MinGW+SVN搭建跨平台的开发环境 - 以天 - 博客园 C++和.net的对象创建 让你的WCF服务支持WebGet属性 - 以天 - 博客园 QC9的安装心得 AS3中的Timer和Event.EnterFrame的区别 XFile中的UV坐标(Panda Xfile导出)的坐标系和3dMax的坐标系不对 [WCF]今天做了一个WCF的测试,测试的结果让我很出乎意料,但百思不得其解啊。 [AS]Sprite的buttonMode带来的问题 [Flash]FMS发布live视频时会出现第一次发布不成功 [Flash]Flash在网页中不能适应用户显示/影藏IE的状态栏时改变舞台大小 [C#]10进制到Excel的26进制的转换函数 [其他]水晶报表中的人民币大写函数 [JS]关于Js文件的导入, [AS3]使用LoadInfo的addEventListener时一定要注意结束时调用removeEventListener 各行业的龙头股 (整理) [AS3]单个图片进行角色动作化处理【转】
[AS3]DispatchEvent的古怪问题
以天 · 2008-12-10 · via 博客园 - 以天

如下面代码:

package {

    import flash.display.Sprite;

    import flash.events.Event;

    import flash.events.EventDispatcher;

    public class TestAction extends Sprite

    {

        private var _dispatcher:EventDispatcher;

        public function TestAction()

        {

            _dispatcher = new EventDispatcher();

            addEventListener(Event.ENTER_FRAME,__enterFrame);

            _dispatcher.addEventListener(TestEvent.TEST,__test);

        }

        private var e:TestEvent = new TestEvent(TestEvent.TEST);

        private function __enterFrame(event:Event):void

        {

            _dispatcher.dispatchEvent(e);

        }

        private function __test(event:TestEvent):void

        {

            trace(event);

        }

    }

}

此代码会报如下错误:

TypeError: Error #1034: 强制转换类型失败:无法将 flash.events::Event@1967b21 转换为 TestEvent

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at TestAction/__enterFrame()[E:\Flash\TestAction\TestAction.as:23]

原因 变量 e在dispatch后再调用第二此dispatch就会报如下错误,由此可见,如果Event如果已经dispatch,调用_dispatcher.dispatchEvent(e)_dispatchernew 一个Event对象进行发布。