Flash事件阶段? [英] Flash Event Phases?

查看:147
本文介绍了Flash事件阶段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以简单地解释Flash Event框架中的3个阶段吗?



按事件阶段,我的意思是:




  • CAPTURING_PHASE

  • AT_TARGET

  • BUBBLING_PHASE



要清楚的是,我在谈论 flash.events。事件和子类。



一个深入的例子将是太棒了。当您点击嵌套的 MovieClip

解决方案


对于事件传播,您正在处理事件的三个​​阶段(参见图2)。每个阶段表示一个事件的路径或位置,因为它通过Flash中的显示对象与该事件相关联。事件的三个​​阶段是捕获,目标和冒泡:





  • 捕获阶段:这表示事件起源的目标对象

    父对象。任何
    传播的事件从
    最上面的父级(舞台)开始,并且在显示对象层次结构
    下方执行
    ,直到达到原始目标。


  • 目标阶段:目标阶段是
    事件在
    目标对象或
    的对象的阶段事件起源于。不同于
    的捕获和冒泡阶段,
    这个阶段总是只涉及
    一个对象,即目标对象。


  • 冒泡阶段:当事件
    气泡时,遵循捕获阶段的
    路径,
    用于备份父
    层次结构的目标对象,直到
    达到最高级父或
    阶段。




Blatantly被盗从: ActionScript 3.0中事件处理简介


Could someone simply explain the 3 phases in the Flash Event framework, please?

By event phases, I mean:

  • CAPTURING_PHASE
  • AT_TARGET
  • BUBBLING_PHASE

To be clear, I'm talking about flash.events.Event and subclasses.

An in-depth example would be fantastic. What happens when you click on a nested MovieClip?

解决方案

With event propagation you're dealing with three "phases" of an event (see Figure 2). Each phase represents a path or the location of an event as it works itself through the display objects in Flash that relate to that event. The three phases of an event are capturing, at target, and bubbling:

  • Capturing phase: This represents the parent objects of the target object from which the event originated. Any propagated event starts with the topmost parent (stage) and works down the display object hierarchy until reaching the original target.

  • At target phase: The target phase is the phase where the event is at the target object or the object from which the event originated. Unlike the capturing and bubbling phases, this phase always relates to only one object, the target object.

  • Bubbling phase: When an event "bubbles" it follows the reverse path of the capturing phase and works its way back up the parent hierarchy of the target object until reaching the top-most parent or stage.

Blatantly stolen from: Introduction to event handling in ActionScript 3.0

这篇关于Flash事件阶段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆