flash interactivity_superposition
Superposition
The Flash 9 Player in ActionScript 3 integrates a new feature concerning the superposition of graphic objects. In ActionScript 1 and 2 when a non-clickable object was superposed over a button the button still managed to receive mouse events.
The image above shows an ActionScript ½ animation, a rectangular clip covering a button which remains clickable and displays the hand cursor. If we click on the button, it’s onRelease event is fired. In ActionScript 3 the Flash 9 player takes the highest object in the hierarchy, if the objects capable of receiving mouse events are hidden by a non-clickable objects, then they no longer receive the mouse events and don’t display the hand cursor.
If the object placed above doesn’t cover a part of the button, then this part remains clickable:
In order to make clickable an object superposed by another object we must use the mouseEnabled property defined by the InteractiveObject class. Passing the value false to the property mouseEnabled of the superposed object we make the objects placed beneath sensitive to mouse events.
By first taking a superposed clip myClip, we make the button below clickable:
// deactivate the reaction to mouse events myClip.mouseEnabled = false;
We can deduce that an instance of a symbol covering a clickable object, makes the latter object no longer receive mouse events. Conversely, when it’s instance of a symbol which is a clickable object, the latter continues to receive mouse events. It’s a feature that we demonstrated at the start of the chapter during the building of menus. The child objects of the Sprite instance continue to receive mouse events and make our buttons partially clickable.
Instead of deactivating all the child objects, we used the mouseChildren property which manages to send the mouseEnabled property to all the child objects of the DisplayContainer.
Mediabox Training Centre © 2000 - 2008 All rights reserved.
Adobe Authorized Training Centre. State convention under number 25 14 02167 14.
Mediabox : SARL au capital de 62.000€ - Activity number: 25 14 02167 14 - SIRET : 493 716 468 00027
MEDIABOX, 102 Avenue des Champs Elysées, 75008 PARIS - Tel. +33(0)2.31.91.96.89 - Fax. +33(0)2.72.68.56.42





