First look at the effect ~
This example mainly analyzes the use of shift () unshift () Pop () Push () and other methods to make a summary.
Push (): Add one or more elements to the end of the array and return the new length of the array.
Pop (): Delete the last element in the array and return the value of the element.
Shift (): Delete the first element in the array and return the element.
Unshift (): Add one or more elements to the beginning of the array and return the new length of the array.
First, let's talk about the principle:
For example, array = [mc0, mc1, MC2, MC3, mc4] represents five graphs.
1. Add array [0] Push () to the end
2. Delete array [0] shift ()
3. Set depth
4. Reset the location
Similarly, sliding to the left is also as follows:
1 var itemofnumber: Int = 5; 2 // Array Used for deep arrangement 3 var staitonarray: array = new array ({X: 496.0, Y: 256.6, scalex: 0.72, scaley: 0.72 },{ X: 615.0, Y: 240.6, scalex: 0.84, scaley: 0.84 },{ X: 767.0, Y: 221, scalex: 1, scaley: 1 }, {X: 979, Y: 240, scalex: 0.84, scaley: 0.84}, {X: 1155.0, Y: 256.6, scalex: 0.72, scaley: 0.72 }); 4 //, oncomplete: setchild5 var rodarray: array = new array ();
Function timehandle (): void {rodarray. push (rodarray [0]); // Add the first one to the last rodarray. shift (); // Delete the first setchild (); setposition ();}
1 function righthandle (): void2 {3 rodarray. unshift (rodarray [rodarray. length-1]); // Add the last one to the beginning of 4 rodarray. pop (); // Delete the last 5 setchild (); 6 setposition (); 7}
1 function setchild (): void 2 {3 4 for (var I: Int = 0; I <rodarray. length; I ++) 5 {6 VaR _ child: movieclip = rodarray [I]; 7 if (I <2) 8 {9 this. setchildindex (_ child, I); 10 tweenmax. to (_ child, 1, {colormatrixfilter: {colorize: 0 xffffff}); 11} 12 else if (I> 2) 13 {14 This. setchildindex (_ child, rodarray. length-I); 15 tweenmax. to (_ child, 1, {colormatrixfilter: {colorize: 0 xffffff}); 16} 17 else if ( I = 2) 18 {19 this. setchildindex (_ child, rodarray. length-1); 20 tweenmax. to (_ child, 1, {colormatrixfilter :{}}); 21} 22 // specify the depth. 23} 24}
1 function setposition():void2 {3 for (var i:int = 0; i < rodArray.length; i++)4 {5 TweenLite.to(rodArray[i], 0.5, staitonArray[i]);6 }7 }