Note that there are some explanatory texts on larger screens.

plurals
  1. PORe-stacking MovieClips in an Array
    primarykey
    data
    text
    <p>I was trying to make a similar thing with the game SameGame (ie. the block above the removed blocks fall downward). Before trying this with an Array that contains MovieClips, this code worked (tried it with int values). With MovieClips on the array, it seems not working the same way.</p> <p>With int values, example:</p> <pre><code>popUp(0, 4): Before: 1,2,3,4,5,6,7,8,9,10; After: 1,2,3,4,6,7,8,9,10 </code></pre> <p>But with MovieClips:</p> <pre><code>popUp(0, 4): Before: 1,2,3,4,5,6,7,8,9,10; After; 1,2,3,4 // Assume the numbers are movieclips XD </code></pre> <p>Basically, it strips everything else, rather than just the said block >_&lt; </p> <p>Here's the whole method. Basically, two extra arrays juggle the values above the soon-to-be removed value, remove the value, then re-stack it to the original array.</p> <p>What could be wrong with this? And am I doing the right thing for what I really wanted to emulate? </p> <pre><code>function popUp(col:uint, row:uint) { var tempStack:Array = new Array(); var extraStack:Array = new Array(); tempStack = IndexArray[col]; removeChild(tempStack[0]); for(var ctr:uint = tempStack.length-(row+1); ctr &gt; 0; ctr--) { removeChild(tempStack[ctr]); extraStack.push(tempStack.pop()); trace(extraStack); } tempStack.pop(); for(ctr = extraStack.length; ctr &gt; 0; ctr--) { tempStack.push(extraStack.pop()); //addChild(tempStack[ctr]); } IndexArray[col] = tempStack; } </code></pre> <p>PS: If it's not too much to ask, are there free step-by-step guides on making a SameGame in AS3 (I fear I might not be doing things right)? Thanks in advance =)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload