- 最后登录
- 2024-6-3
- 注册时间
- 2009-10-16
- 阅读权限
- 100
- 积分
- 18803
- 纳金币
- 17488
- 精华
- 1
|
Selection Group (Interactive Behavior)
Summary
Provides exlusive selection for sets of objects.
Category
Latest Behaviors
Author
Gavin Kistner
Difficulty
(Reference)
Time to Complete
5 Minutes
Downloads
Click Here
to download the associated files.
(This document covers version 1.5 of the 'Selection Group' behavior, current as of 2005-Aug-04)
Description
Attach this behavior to objects (or groups) where you want to be able to ‘select’ only one of the objects at a time. Every object with this behavior that has the same
Group Name
set will be selected in a mutually-exclusive fashion. An object is selected by clicking on it, invoking the
Selected
action on the behavior, or using script to call the
select()
method of the object, or the
selectParent()
method of the behavior.
When an object is selected, the behavior will fire the
Selected
event. When an object is deselected, it fires the
Deselected
event. (Both events will bubble up to the parent object, its parent, and so on all the way up to the scene.)
You may have multiple sets of objects involved in selection groups; each set must have a unique
Group Name
.
By default, the behavior needs to be attached to each object you want in the group. For convenience, you may attach this behavior to a parent group, and check the
Apply to Children?
flag. This will copy the behavior to every child object and group (but not descendants) at runtime. The downside of this convenience is that you cannot setup Studio actions to listen for a the
Selected
and
Deselected
events on specific child objects.
If neither
Scene in Group?
or
Allow Deselect?
is checked, at least one object in the group must be selected at all time. The first object added to the group will be automatically selected.
If
Scene in Group?
is checked, clicking on the background (or any other object which bubbles the onMouseDown event up the tree without cancelling it) will deselect all objects in the selection group.
If
Allow Deselect?
is checked, clicking on the currently-selected object will deselect it.
Basic Properties
Group Name
The name of the group (must be the same for all objects in the group).
Use Selected Color?
Change the object to another color when selected?
Selected Color
Color to use for the object when selected.
Advanced Properties
Scene in Group?
Should clicking on the scene deselect all objects?
Allow Deselect?
Should clicking on the selected object deselect it?
Apply to Children?
Apply this to all child models/groups, instead of the parent?
Actions
Select Parent
Selects the parent element.
Deselect Parent
Deselects the parent element (if 'Allow Deselect?' is checked).
Events
Selected
Fires when the parent element is selected.
Deselected
Fires when the parent element is deselected.
Demonstration
View Demonstration Project
Download Project File
|
|