swapChildren and getChildAt function added to DisplayObjectContainer

docs updated
This commit is contained in:
Mat Groves 2013-04-20 16:55:40 +01:00
parent 760e0a5c56
commit 4dda5d1c18
22 changed files with 1940 additions and 43 deletions

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

File diff suppressed because one or more lines are too long

View file

@ -249,6 +249,13 @@
</li>
<li class="index-item method">
<a href="#method_getChildAt">getChildAt</a>
</li>
<li class="index-item method inherited">
@ -298,6 +305,13 @@
</li>
<li class="index-item method">
<a href="#method_swapChildren">swapChildren</a>
</li>
<li class="index-item method inherited">
@ -691,6 +705,93 @@
</div>
<div id="method_getChildAt" class="method item">
<h3 class="name"><code>getChildAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l137"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:137</code></a>
</p>
</div>
<div class="description">
<p>Returns the Child at the specified index</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Number</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
@ -1158,7 +1259,7 @@ for this callback to be fired, The touch must have started over the displayObjec
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l155"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:155</code></a>
</p>
@ -1284,6 +1385,114 @@ for this callback to be fired, The touch must have started over the displayObjec
</div>
<div id="method_swapChildren" class="method item">
<h3 class="name"><code>swapChildren</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>DisplayObject</code>
</li>
<li class="arg">
<code>DisplayObject2</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
</p>
</div>
<div class="description">
<p>Swaps the depth of 2 displayObjects</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">DisplayObject</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">DisplayObject2</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>

View file

@ -282,6 +282,13 @@
</li>
<li class="index-item method inherited">
<a href="#method_getChildAt">getChildAt</a>
</li>
<li class="index-item method">
@ -366,6 +373,13 @@
</li>
<li class="index-item method inherited">
<a href="#method_swapChildren">swapChildren</a>
</li>
<li class="index-item method inherited">
@ -460,6 +474,20 @@
</li>
<li class="index-item property">
<a href="#property_loop">loop</a>
</li>
<li class="index-item property">
<a href="#property_onComplete">onComplete</a>
</li>
<li class="index-item property inherited">
@ -816,6 +844,90 @@
</div>
<div id="method_getChildAt" class="method item inherited">
<h3 class="name"><code>getChildAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_getChildAt">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l137"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:137</code></a>
</p>
</div>
<div class="description">
<p>Returns the Child at the specified index</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Number</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
@ -861,7 +973,7 @@
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l80"><code>src&#x2F;pixi&#x2F;MovieClip.js:80</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l94"><code>src&#x2F;pixi&#x2F;MovieClip.js:94</code></a>
</p>
@ -948,7 +1060,7 @@
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l67"><code>src&#x2F;pixi&#x2F;MovieClip.js:67</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l81"><code>src&#x2F;pixi&#x2F;MovieClip.js:81</code></a>
</p>
@ -1447,7 +1559,7 @@ for this callback to be fired, The touch must have started over the displayObjec
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l58"><code>src&#x2F;pixi&#x2F;MovieClip.js:58</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l72"><code>src&#x2F;pixi&#x2F;MovieClip.js:72</code></a>
</p>
@ -1508,7 +1620,7 @@ for this callback to be fired, The touch must have started over the displayObjec
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l155"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:155</code></a>
</p>
@ -1753,7 +1865,7 @@ for this callback to be fired, The touch must have started over the displayObjec
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l49"><code>src&#x2F;pixi&#x2F;MovieClip.js:49</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l63"><code>src&#x2F;pixi&#x2F;MovieClip.js:63</code></a>
</p>
@ -1772,6 +1884,111 @@ for this callback to be fired, The touch must have started over the displayObjec
</div>
<div id="method_swapChildren" class="method item inherited">
<h3 class="name"><code>swapChildren</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>DisplayObject</code>
</li>
<li class="arg">
<code>DisplayObject2</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_swapChildren">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
</p>
</div>
<div class="description">
<p>Swaps the depth of 2 displayObjects</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">DisplayObject</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">DisplayObject2</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
@ -2457,6 +2674,94 @@ Setting it is a neat way of optimising the hitTest function that the interaction
</div>
<div id="property_loop" class="property item">
<h3 class="name"><code>loop</code></h3>
<span class="type">Boolean</span>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l37"><code>src&#x2F;pixi&#x2F;MovieClip.js:37</code></a>
</p>
</div>
<div class="description">
<p>Whether or not the movie clip repeats after playing.</p>
</div>
</div>
<div id="property_onComplete" class="property item">
<h3 class="name"><code>onComplete</code></h3>
<span class="type">Function</span>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l44"><code>src&#x2F;pixi&#x2F;MovieClip.js:44</code></a>
</p>
</div>
<div class="description">
<p>Function to call when a MovieClip finishes playing</p>
</div>
</div>
@ -2524,7 +2829,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l37"><code>src&#x2F;pixi&#x2F;MovieClip.js:37</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_MovieClip.js.html#l51"><code>src&#x2F;pixi&#x2F;MovieClip.js:51</code></a>
</p>

View file

@ -300,6 +300,13 @@
<span class="flag static">static</span>
</li>
<li class="index-item method inherited">
<a href="#method_getChildAt">getChildAt</a>
</li>
<li class="index-item method inherited">
@ -356,6 +363,13 @@
</li>
<li class="index-item method inherited">
<a href="#method_swapChildren">swapChildren</a>
</li>
<li class="index-item method inherited">
@ -992,6 +1006,90 @@
</div>
<div id="method_getChildAt" class="method item inherited">
<h3 class="name"><code>getChildAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_getChildAt">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l137"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:137</code></a>
</p>
</div>
<div class="description">
<p>Returns the Child at the specified index</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Number</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
@ -1456,7 +1554,7 @@ for this callback to be fired, The touch must have started over the displayObjec
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l155"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:155</code></a>
</p>
@ -1669,6 +1767,111 @@ for this callback to be fired, The touch must have started over the displayObjec
</div>
<div id="method_swapChildren" class="method item inherited">
<h3 class="name"><code>swapChildren</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>DisplayObject</code>
</li>
<li class="arg">
<code>DisplayObject2</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_swapChildren">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
</p>
</div>
<div class="description">
<p>Swaps the depth of 2 displayObjects</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">DisplayObject</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">DisplayObject2</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>

View file

@ -303,6 +303,13 @@
</li>
<li class="index-item method inherited">
<a href="#method_getChildAt">getChildAt</a>
</li>
<li class="index-item method inherited">
@ -359,6 +366,13 @@
</li>
<li class="index-item method inherited">
<a href="#method_swapChildren">swapChildren</a>
</li>
<li class="index-item method inherited">
@ -753,6 +767,90 @@
</div>
<div id="method_getChildAt" class="method item inherited">
<h3 class="name"><code>getChildAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_getChildAt">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l137"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:137</code></a>
</p>
</div>
<div class="description">
<p>Returns the Child at the specified index</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Number</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
@ -1217,7 +1315,7 @@ for this callback to be fired, The touch must have started over the displayObjec
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l155"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:155</code></a>
</p>
@ -1430,6 +1528,111 @@ for this callback to be fired, The touch must have started over the displayObjec
</div>
<div id="method_swapChildren" class="method item inherited">
<h3 class="name"><code>swapChildren</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>DisplayObject</code>
</li>
<li class="arg">
<code>DisplayObject2</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_swapChildren">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
</p>
</div>
<div class="description">
<p>Swaps the depth of 2 displayObjects</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">DisplayObject</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">DisplayObject2</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>

View file

@ -324,6 +324,13 @@
</li>
<li class="index-item method inherited">
<a href="#method_getChildAt">getChildAt</a>
</li>
<li class="index-item method inherited">
@ -373,6 +380,13 @@
</li>
<li class="index-item method inherited">
<a href="#method_swapChildren">swapChildren</a>
</li>
<li class="index-item method inherited">
@ -774,6 +788,90 @@
</div>
<div id="method_getChildAt" class="method item inherited">
<h3 class="name"><code>getChildAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_getChildAt">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l137"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:137</code></a>
</p>
</div>
<div class="description">
<p>Returns the Child at the specified index</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Number</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
@ -1238,7 +1336,7 @@ for this callback to be fired, The touch must have started over the displayObjec
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l155"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:155</code></a>
</p>
@ -1364,6 +1462,111 @@ for this callback to be fired, The touch must have started over the displayObjec
</div>
<div id="method_swapChildren" class="method item inherited">
<h3 class="name"><code>swapChildren</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>DisplayObject</code>
</li>
<li class="arg">
<code>DisplayObject2</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..&#x2F;classes&#x2F;DisplayObjectContainer.html#method_swapChildren">DisplayObjectContainer</a>:
<a href="..&#x2F;files&#x2F;src_pixi_DisplayObjectContainer.js.html#l97"><code>src&#x2F;pixi&#x2F;DisplayObjectContainer.js:97</code></a>
</p>
</div>
<div class="description">
<p>Swaps the depth of 2 displayObjects</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">DisplayObject</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">DisplayObject2</code>
<span class="type"><a href="../classes/DisplayObject.html" class="crosslink">DisplayObject</a></span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>

View file

@ -1666,6 +1666,41 @@
{
"file": "src/pixi/DisplayObjectContainer.js",
"line": 97,
"description": "Swaps the depth of 2 displayObjects",
"itemtype": "method",
"name": "swapChildren",
"params": [
{
"name": "DisplayObject",
"description": "",
"type": "DisplayObject"
},
{
"name": "DisplayObject2",
"description": "",
"type": "DisplayObject"
}
],
"class": "DisplayObjectContainer"
},
{
"file": "src/pixi/DisplayObjectContainer.js",
"line": 137,
"description": "Returns the Child at the specified index",
"itemtype": "method",
"name": "getChildAt",
"params": [
{
"name": "index",
"description": "",
"type": "Number"
}
],
"class": "DisplayObjectContainer"
},
{
"file": "src/pixi/DisplayObjectContainer.js",
"line": 155,
"description": "Removes a child from the container.",
"itemtype": "method",
"name": "removeChild",
@ -1680,7 +1715,7 @@
},
{
"file": "src/pixi/DisplayObjectContainer.js",
"line": 126,
"line": 184,
"access": "private",
"tagname": "",
"class": "DisplayObjectContainer"
@ -1791,6 +1826,24 @@
{
"file": "src/pixi/MovieClip.js",
"line": 37,
"description": "Whether or not the movie clip repeats after playing.",
"itemtype": "property",
"name": "loop",
"type": "Boolean",
"class": "MovieClip"
},
{
"file": "src/pixi/MovieClip.js",
"line": 44,
"description": "Function to call when a MovieClip finishes playing",
"itemtype": "property",
"name": "onComplete",
"type": "Function",
"class": "MovieClip"
},
{
"file": "src/pixi/MovieClip.js",
"line": 51,
"description": "[read only] indicates if the MovieClip is currently playing",
"itemtype": "property",
"name": "playing",
@ -1799,7 +1852,7 @@
},
{
"file": "src/pixi/MovieClip.js",
"line": 49,
"line": 63,
"description": "Stops the MovieClip",
"itemtype": "method",
"name": "stop",
@ -1807,7 +1860,7 @@
},
{
"file": "src/pixi/MovieClip.js",
"line": 58,
"line": 72,
"description": "Plays the MovieClip",
"itemtype": "method",
"name": "play",
@ -1815,7 +1868,7 @@
},
{
"file": "src/pixi/MovieClip.js",
"line": 67,
"line": 81,
"description": "Stops the MovieClip and goes to a specific frame",
"itemtype": "method",
"name": "gotoAndStop",
@ -1830,7 +1883,7 @@
},
{
"file": "src/pixi/MovieClip.js",
"line": 80,
"line": 94,
"description": "Goes to a specific frame and begins playing the MovieClip",
"itemtype": "method",
"name": "gotoAndPlay",
@ -2273,7 +2326,7 @@
},
{
"message": "Missing item type",
"line": " src/pixi/DisplayObjectContainer.js:126"
"line": " src/pixi/DisplayObjectContainer.js:184"
},
{
"message": "Missing item type",

View file

@ -216,6 +216,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
&#x2F;**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*&#x2F;
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
&#x2F;&#x2F; TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 &amp;&amp; index2 !== -1 )
{
&#x2F;&#x2F; cool
if(this.stage)
{
&#x2F;&#x2F; this is to satisfy the webGL batching..
&#x2F;&#x2F; TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
&#x2F;&#x2F; swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
&#x2F;&#x2F; swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + &quot; Both the supplied DisplayObjects must be a child of the caller &quot; + this);
}
}
&#x2F;**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*&#x2F;
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index &gt;= 0 &amp;&amp; index &lt; this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + &quot; Both the supplied DisplayObjects must be a child of the caller &quot; + this);
}
}
&#x2F;**
* Removes a child from the container.
* @method removeChild

View file

@ -155,6 +155,20 @@ PIXI.MovieClip = function(textures)
* @type Number
*&#x2F;
this.animationSpeed = 1;
&#x2F;**
* Whether or not the movie clip repeats after playing.
* @property loop
* @type Boolean
*&#x2F;
this.loop = true;
&#x2F;**
* Function to call when a MovieClip finishes playing
* @property onComplete
* @type Function
*&#x2F;
this.onComplete = null;
&#x2F;**
* [read only] indicates if the MovieClip is currently playing
@ -218,7 +232,18 @@ PIXI.MovieClip.prototype.updateTransform = function()
this.currentFrame += this.animationSpeed;
var round = (this.currentFrame + 0.5) | 0;
this.setTexture(this.textures[round % this.textures.length]);
if(this.loop || round &lt; this.textures.length)
{
this.setTexture(this.textures[round % this.textures.length]);
}
else if(round &gt;= this.textures.length)
{
this.gotoAndStop(this.textures.length - 1);
if(this.onComplete)
{
this.onComplete();
}
}
}
</pre>
</div>

View file

@ -288,8 +288,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
&#x2F;&#x2F; if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -305,6 +304,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
&#x2F;&#x2F; update any textures
for (var i=0; i &lt; PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -435,6 +435,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild
@ -2033,8 +2091,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -2050,6 +2107,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);

View file

@ -94,6 +94,64 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
/**
* Swaps the depth of 2 displayObjects
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 && index2 !== -1 )
{
// cool
if(this.stage)
{
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
this.stage.__addChild(child);
this.stage.__addChild(child2);
}
// swap the indexes..
child.childIndex = index2;
child2.childIndex = index;
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Returns the Child at the specified index
* @method getChildAt
* @param index {Number}
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index >= 0 && index < this.children.length)
{
return this.children[index];
}
else
{
throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this);
}
}
/**
* Removes a child from the container.
* @method removeChild

View file

@ -166,8 +166,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
{
if(this.contextLost)return;
// if rendering a new stage clear the batchs..
if(this.__stage !== stage)
{
@ -183,6 +182,7 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
}
// update any textures
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);