≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Anybody know how to have layer in CC
Posted by:
(you are not logged in)
Enter the missing letter in: "Internatio?al"
(you are not logged in)
Text:
[quote][b][/b] wrote: Not much of a proper layer system but something like this should let you re order nodes to front during runtime: [code] /* <action jsname="action_MoveToFront" description="MoveToFront"> <property name="Node" type="scenenode"/> <property name="IsInRoot" type="bool"/> </action> */ action_MoveToFront = function(){ this.Root = ccbGetRootSceneNode(); } action_MoveToFront.prototype.execute = function (node){ // leave 'Node' parameter empty to run the action on the current node var localNodeName = ccbGetSceneNodeProperty(node, "Name"); if(localNodeName) this.Node = node; // fetching and storing the original parent if(!this.IsInRoot) var originalParent = this.getParent(this.Node); else var originalParent = this.Root; // re ordering to the front var rootChild0 = ccbGetChildSceneNode(this.Root, 0); ccbSetSceneNodeParent(this.Node, rootChild0); ccbSetSceneNodeParent(this.Node, originalParent); } action_MoveToFront.prototype.getParent = function(node){ var name = ccbGetSceneNodeProperty(node, "Name"); var p = this.searchForNode(this.Root, node, name); return (p) ? p : this.Root; } action_MoveToFront.prototype.searchForNode = function(root, node, name){ for(var i = 0, count = ccbGetSceneNodeChildCount(root); i < count; i++){ var currentNode = ccbGetChildSceneNode(root, i); var currentNodeName = ccbGetSceneNodeProperty(currentNode, "Name"); if(currentNodeName == name && currentNodeName) return root; else var p = this.searchForNode(currentNode, node, name); if(p) return p; } } [/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact