I have an issue where I would like to remove a sprite randomly in AS3, I have managed to figure out how to create the sprites so that they fill as a grid, just for the life of me I can't figure out how to remove them!Here's the code i've used to create them:
function showpixels() : void
{
for (var i:int = 0; i < 40; i++)
Code: private var notesDefinition:Array = [Note1, Note2, Note3, Note4];
When faceMc moves (while dragging or as a mouse trail), points are created dinamically every 200px and one of the array�s mclips is added there in a random function. Now i need to remove that mc when it reaches its last frame (just the mc on stage, not remove from the array). I tryed the following but its not working.
Code: private function drawingAPI(event:Event):void{ var addNewNote:Boolean = false; //add first point
the code below loads only the second member of the "koan" array. why it isn't randomly loading swfs? (Could it be a problem with the "var index"?...when it is changed manually in the code from 0 to another number the swf played does change; but still not randomly.)
I am trying to write a function that is passed an array and will then reorder it randomly and return the array. My problem is that as the position is generated randomly I dont know how long the loop must run for, this function doesn't work but it should give you an idea of what I'm trying to do:
[AS] function randomise(the_ar:Array):Array { var ret_ar:Array = new Array(); for (i=0; i<200; i++) {
How can I make my Array to return a randomly value? I want AirUnit to return a value between 1 and 3. I want LandUnit to return a value between 4 and 6. I want WaterUnit to return a value between 7 and 9.
is it possible to have an array of words, and then, with another set of code, to have those words randomly animating (perhaps from the distance, to closer up, like a zooming non-blurred effect) on the stage?
I am trying, with this code, to first, shuffle the order of the images in the array so their loading sequence is never the same when the page is reloaded.Then, im trying to have the shuffled array open one at a time, image by image, at a set interval.
Code: Array.prototype.shuffle = function() { for (i=0; i<this.length; i++) {
I understand how Math.random works, and I understand how Arrays work, but I don't understand how to either rearrange the indices of an existing Array, or how to populate it from another Array in a random sequence without an index possibly repeating.
Ok what i want to do is to randomly pick 3 values from an array called Objs and add them to a new array called ListObjs. The three values should be unique. This is the code I have so far, but when i try to execute it Flash stops responding.
I'm would like to use the UILoader to randomly load an image from an array according to the day of the week. The attached FLA file is in AS2, it is exactly what I would like to do but now in AS3. I've been able to successfully trace the date using:
var today_date:Date = new Date();var dayOfWeek = today_date.getDay();trace(today_date.getDay());
In AS2 I used this the loadMovie function to randomly display SWF's in the movieClip. From what I can tell loadMovie is not an option in AS3 making me think that using the UILoader may be a good solution.This is what my code looks like in AS2 (also attached the FLA file):
loadShow = function() { var today_date:Date = new Date();var dayOfWeek = today_date.getDay();trace(today_date.getDay());[code]....
Is there some basic AS3 code to have, when the swf loads, a single video play from a collection of videos in an array? And can said code also apply to sound without video?I just found out the tutorial I was using to randomize doesn't work with audio - as it just plays everything at once - you might 'see' one video - but you hear all them. So from what I am reading, I need to us an array (that seems simple enough), but I don't want to play all the clips - I want it to randomly select and play one. Not sure exactly how I set up the video playback area (so the video plays where I want, at the size I want).Also, I have other pages that are just audio - does audio need some sort of player or something for this?
I want to create an array of loaded xml for the following:
ActionScript Code: var xmlQuestions:XML = new XML(); System.useCodepage = true;
[Code].....
What I want to achieve is so I can load 5 different xmls and place them into an array. All 5 random xmls will be placed in an array then I wish to trace them
It's a simple self-checkout grocery thing and I want to list the items the user is "buying" after typing in the appropriate code, but I can't get it to stay at nine lines only in the dynamic text field. I was told to use array.shift() to get rid of the first value in the two arrays so that I have an easy way by keeping the arrays at nine values, but it doesn't seem to work right.. It'll get rid of the first value, but only once and it'll add a blank value and then continue happily adding to the length of the array. Google has failed me so far so I suspect it's something else in my code.[code]
I have an array containing single alphabet in every index and some of them in the array are duplicates. I'm trying to pick an alphabet and if there is an alphabet in that array, I want it remove from the array.
so lets say if i have 3 "a" in the array, I want all 3 to be remove. But my function only remove one alphabet. How do i make it remove all 3?
Also another question is, if i reach the end of the array how to i remove it? if i use splice it doesnt seem that it will remove the last item in the array.
my code is very simple
for (var i:int = 0; i<alphabetArrayLength; i++) { if (singleAlphabet_arr[i] == alphabetPicked) { answer = singleAlphabet_arr.splice(i,1); } }
Im attaching cards to stage in random positions using arrays. I'm having some coding issues randomizing so when I refresh the swf the cards numbers should change randomly but are not. This is my code:
var cardList:Array = new Array(); for (i=0; i<16; i++) { cardList[i] = "card"+i; }[code].....
I found this code online. it is for a image gallery that fades in and out as it transition from one image to the next.. the images are load through an array command... it loads the first image, etc.... what I wanted to know is where should i put a Math.floor(Math.random()*this.pic_arr.length); in the string of code... to make the gallery start randomly in the array and then continue onto the next image... also, for some reason, there is not a common directory for all the images, like this script:
If I use array to reference clips, what's the best way to remove the clips using that arrayHere's the basic example code with a way that seems to work. I want to know the best/proper way to remove from memory
Code: var arrayListItems:Array = new Array(); function loadList(){
function removeFromArray(item:Object, arr:Array):Object { for(var i:uint = 0; i < arr.length; i++) { if(item == arr
[Code]....
This function searches through an array and sees if an item exists in it, if it does, it removes it and returns a reference to that item.
This works fine for most things. But I just ran into a problem where I need to remove an array from an array.
so my array looks like this [ [item1a, item1b], [item2a, item2b] ]; and i need to remove [item1a, item1b] from it. But passing in the the array to remove and the full array to remove it from does not work because i guess of the casting to an object in the parameters list. Can the functionality i want be used? if so how?
I have an array containing single alphabet in every index and some of them in the array are duplicates. I'm trying to pick an alphabet and if there is an alphabet in that array, I want it remove from the array. so lets say if i have 3 "a" in the array, I want all 3 to be remove. But my function only remove one alphabet. How do i make it remove all 3? (var i:int = 0; i<alphabetArrayLength; i++) { if (singleAlphabet_arr[i] == alphabetPicked) { answer = singleAlphabet_arr.splice(i,1); } }
Anybody any ideas on how to remove children from stage using AS3 if I store the reference to the objects in an array and they exist in different locations i.e they are not all children of the same parent?
I have 2 arrays & 2 checkbox repeaters: the second gets populated w/ items selected from the first. I can add the items no problem. How do I then delete the item if it gets deselected from the first checkbox repeater?
i added a bunch off object to the stage. The objects were added through an array. Now i want to remove all of them but i dont really know how to do this. removeChild(array[i]) doesnt work.
I've made a little movie that reads items from an XML document and when you click on a thumbnail it adds the details and the price to a list and totals the amount. The problem I'm having is when you want to remove an item; I want to make it so that the items all shift up and there isn't a gap in there but at the moment they're overlapping sometimes when you remove something from the middle of the list.I'm not really sure where the problem lies because I've been staring at this for a few days now nothing's coming to me. It's probably in the below area, I think it's going haywire when the array gets remade but the num property of the remove button doesn't get updated.[code]I've attached all of the relevant files if anyone wants to take a look at it in action. Also, I know some of the code might seem a bit strange (like reading the XML in a loop and then pushing that into a different array) but there is a reason for it, I've stripped that part of the application out though.