Warning: Constant ABSPATH already defined in /home/raypasto/www/www/wordpress/wp-config.php on line 26

Warning: Cannot modify header information - headers already sent by (output started at /home/raypasto/www/www/wordpress/wp-config.php:26) in /home/raypasto/www/www/wordpress/wp-includes/feed-rss2.php on line 8
AS3 – Dr. Ray Pastore's Instructional Technology Blog https://raypastore.com/wordpress Fri, 08 Jun 2012 13:23:32 +0000 en-US hourly 1 https://wordpress.org/?v=5.7.15 166124113 Actionscript 3: Get rid of movie clip in Array https://raypastore.com/wordpress/2012/06/actionscript-3-get-rid-of-movie-clip-in-array/ https://raypastore.com/wordpress/2012/06/actionscript-3-get-rid-of-movie-clip-in-array/#respond Fri, 08 Jun 2012 02:48:19 +0000 https://raypastore.com/wordpress/?p=1345 In order to get rid of a movie clip in an Array after it is played, use the following code. This can go in the timeline as an enterframe or within a button function. Mine initiates when a button is clipped. In my flash file, movie clips are played at random and then once it is played, it is removed from the array so it can no longer be played:

//storeArray1 is my array created above this in the code. MovieClip(root) is used because
//I call this from inside a movie clip
var myNumber = Math.floor(Math.random()*MovieClip(root).storeArray1.length);
trace(“myNumber “+myNumber);
var activeCarton = MovieClip(root).storeArray1[myNumber];

//removes this element from array
MovieClip(root).storeArray1.splice(activeCarton,1);

//shows me which options are still in the array
trace (MovieClip(root).storeArray1);

]]>
https://raypastore.com/wordpress/2012/06/actionscript-3-get-rid-of-movie-clip-in-array/feed/ 0 1345