Class Group
Extends
SceneContent.
Groups some content together. Any action taken on a group is applied to all
of it's children.
Defined in: Group.js.
// New Group where the content starts at (10,10). Group({ x: 10, y: 10, content: [ Graphic({ url: "./images/ball.png" }), Graphic({ url: "./images/beetleship.png", y: 20, x: 30 }) ] }) // In this example, the ball will display at (10,10), and the beetleship // will display at (50,10).
// Moving the group. myGroup.moveBy({ y: 10 }); // In this example, the ball will now display at (10, 20), and the beetleship // will display at (50, 20).
Constructor Attributes | Constructor Name and Description |
---|---|
Group(_details)
|
- Fields borrowed from class SceneContent:
- details
Method Attributes | Method Name and Description |
---|---|
addContent(_content)
Adds content to this group.
|
|
Gets the content of this group.
|
|
updateGroup(_run_time)
Updates each of this groups content, and then calculates the groups
cumulative bounds.
|
- Methods borrowed from class SceneContent:
- draw, extend, getBounds, getName, getParent, getScene, getStage, isActive, isVisible, load, loadBase, moveBy, moveTo, setActive, setSize, setVisible, update, updateBase
Class Detail
Group(_details)
- Parameters:
- {Object} _details
- A JSON object with extra content.
Property Required Default content no new Array()
Method Detail
addContent(_content)
Adds content to this group. Content added is first loaded then added to
the the other content of this group at which point it will join the
draw cycle.
- Parameters:
- {SceneContent} _content
- The SceneContent to add to this group.
getContent()
Gets the content of this group. This implementation returns the actual
content array, but should not be used to add content to this group.
To add content to this group use the addContent function, which loads
the content before adding it to the content array. Using this function
to add content to this group will result in that content not being
loaded, but being added to the draw cycle.
- Returns:
- The Content array.
updateGroup(_run_time)
Updates each of this groups content, and then calculates the groups
cumulative bounds. This is mainly used by sub classes like Rotate and
Translate groups.
- Parameters:
- _run_time