ActionScript 2.0 :: Assign An Array Of Movieclips Same Unique Function?
Feb 4, 2011I hope the title of my post isn't confusing, I wasn't sure how to phrase it. [code]...
View 1 RepliesI hope the title of my post isn't confusing, I wasn't sure how to phrase it. [code]...
View 1 RepliesI found a multiple drag to a single drop example here on the forums that works wonderful for the dragging and dropping part of my project. I am now trying to add in a sort of category detection. I have 45 movieclips located on the stage. They get set up with a loop, giving them a drag/drop functionality. The movieclips belong to one of 7 categories. The user can drag only 5 movieclips to a designated area. Once the 5 have been selected, I need to then figure out which category had the most selected. What would be the best way to set this up? Here is what I'm working with so far
PHP Code:
#include "mc_tween2.as"
stop();
[code].....
About making a pallet loaded by xml and selecting a color you change another mc but the action of button it does not make:
ActionScript Code:
x = 8;
y = 32;
ancho = 28;
alto = 28;
num_columnas = 8;
System.useCodepage = true;
XML.prototype.ignoreWhite = true;
[Code] .....
I'm creating an image gallery and the below code is what I have come up with to create a 'container' movieclip which dynamically adds a number of thumbnails, each as a separate movie clip, one after another vertically inside the container (which is contained inside a 'main' movieclip - note the existence of mc1 is to enable me to mask the container - this is worknig so you can disregard it).(Note the number of clips is currently hardcoded to 7)
Code:
image = new Array(); //array of movie clips to be contained
imgLink = new Array();
[code].......
I want to loop through an array of mc's, and assign each a onRelease function. I have the following code but the trace inside the function doesn't seem to find the array.I understand why but what is the correct way of doing this?
ActionScript Code:
var theArray:Array = new Array();
var j:Array = new Array();[code].......
I'll try to make this as clear as possible. Let's say i have 4 "classes".
[Code]...
Let's say now i use a loop to create 8 obj. I'd like to assign a class to each obj in function of an array like : array = [class1, class2, class1, class3, class2, class4... ] so obj0 class' should be array[0]
I want to loop through a movie clip and assign a function to each of the clip's child movieclips. when i do a for...in loop and then do a typeof() trace I get "string" and obviously it won't let me assign lets say 'onRollOver' functions to the children.
View 6 RepliesI'm trying to apply a function to an array of movieclips, rather than have to type out the function for each one. So, if my movieclips were mc1, mc2 and mc3, I would have:
Code:
function Invisible (movieclip){
movieclip._alpha=50;
}
[code]....
This does not work - I still have to put Invisible(mc1) for each object to make it work. Is there a way to use arrays to do this?
I have a simple function on the main timeline which applies to 50 moveiclips, named MovieclipA1 to MovieclipA50. [code]The code is the same for all 50 mc's. All that changes is the 'A1' which become A2,A3,A4,A5 etc.Is there anyway to avoid writing this code 50 times, perhaps using an array which contains A1 to A50?
View 7 RepliesI have an asset file (FLA) that will be updated a lot by other team members during the project. I would like to have an JSFL script that moves all selected movieclips in the timeline to a new layer (named using the movieclips library name).[code]...
View 1 RepliesI'm working on a piece for work. I need to figure out how to add unique dynamic text fields to duplicated movieclips. Unique as in unique instance names and variable names. I have a movieclip on the stage that contains a dynamic text field.
the text field will house text that is being pulled from an xml file.What I need is to have the dynamic text field in all the duplicated movieclips have a unique instance name and variable name.I assume that a nested for loop would be required, but I'm not sure as I am not the greatest actionscripter. Here's what I have so far:
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
[code]....
I have an xml file and I'd like to create an array of all the unique values from one of its nodes.The xml file is called pntxml and the node is pntxml.row.Category where category is from where I'd like to create an array of all unique values.I was working through this and was first going to create an array of all values in Category by iterating through the xml and pushing those values into a seperate arrayWhen I try to push each entry into an array I get an error orTypeError: Error #1009: Cannot access a property or method of a null object reference. at NAPA_fla::MainTimeline/sortXml()
var catArray:Array;
function sortXml(event:Event):void{
for (var i:int = 0; i< pntxml.row.length(); i++){
[code].....
I'm trying to find a simple way to solve this problem: I have an array of integers and need to find the highest value that is unique.Specifically, my array holds player scores. Ex: (4,7,6,5,2,7)I need a function that will give me the highest score that it is not tied with another score. So for the example above, it would return 6 (not 7 since there are two 7's)
View 9 RepliesI'm trying to create an array of random unique numbers from 0 to 39 so that I can list these numbers in a countdown and without repetition, ie: 25, 29, 11, 03, 17 etc. These are 40 different numbers, equal or greater than 0 and equal or less than 39.
View 2 RepliesI have a number of 'items' (mc's) contained in a scrolling mc that can be drag-dropped to other matching mc's. The items names are listed in an array and I wish to assign variables of suitability and feedback to each mc from the array also. I think this is called an associative array?
Having some trouble correctly referencing the items from the array. To explain, here's a working script with a simple array and an inefficient workaround:
[Code]...
is: I have array={0,1,2,3,4,5,6,7,8,9} and i want from this array unique random pairs.for example: 3,6 nad automaticly 6,3 no repeats.It must give me 10 pairs.for example:
3,6
6,3
1,2
[code]....
I am using actionscript 3 and I am creating an array of 16 buttons and need to use the function math.random to get it to pick 5 random unique numbers out of the array. As at the moment it is sometimes picking 5 unique numbers and sometimes it has duplicate buttons appearing?
View 1 Replieshow to remove duplicates from an array. But now I need to know how many times each unique item is in an array.
Example:
a,a,a,b,b,c,a
a:4
b:2
c:1
I'm working on a project where I have an array of coordinate points (4 of them) and a menu system that, when clicked, rearranges the boxes so that they all move around. The problem is that the values I pull out of the array are not always unique so some of the items end up not moving (or sometimes it ends up moving two to the same spot because the last one didn't move and one of them moved to a spot that is already occupied).
Here is the code I was using which for the most part works, except as mentioned, sometimes the check for the last one in the loop sees that the conditional is not equal so it doesn't do anything because there is no other values to loop through and it just leaves it in that spot.
Code:
private function checkCoordinates($item:MenuItem, $coords:Array):Void
{
var numItems:Number = $coords.length;
[Code]....
This seems quite easy, but I'm not that good with Flash, so it'd be really gr8 if anyone can help.I'm trying to create an array of random unique numbers from 0 to 39 so that I can list these numbers in a countdown and without repetition, ie: 25, 29, 11, 03, 17 etc.These are 40 different numbers, equal or greater than 0 and equal or less than 39.
View 7 RepliesI am recently working with an application. Where I need 4 unique values from an array in such a way that it should checking random item every time.
For eg:-
Main_Array = ["one","two","three","four","five","six","seven "];
Sub_Array = ["three"]; // initially it holds one value
for(each value of Sub_Array)
{
[Code]....
I am trying but I don't get unique values
I am making an user application where users can chat one on one for an x amount of time till they go to the next user (see it as speeddating). Only they are all women talking about women stuff like knitting or something. A friends chat.
I am stuck with making unique pairs. only the first round is going great (unique pairs), but then it gets mixed up:
[Code].....
As you can see everyone in round 1 is paired good. But in round 2 you see (for example) Donna talking to Cindy, but Brenda is also talking to Donna. that's not right. she can't talk to 2 people at once.
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.
[Code]....
Looking to generate random numbers b/w 0 and 19 with no duplicates to be put in Array.
View 6 RepliesMy hitTestObject fails even though a trace shows that I'm getting access to the correct target object.
I read a post that said that hitTestObject won't work if the hitter has the same identifier as other hitters (like in an array). So I tried using a single hitter (set the array to have only one element) and it does work, which makes me think I need to give a unique ID to each hitter in the array.
I can declare a string var in the for loop and make it unique, but since it's a string it won't accept being typed as another class.
how to create 100 unique var names that can be typed as a class?
Code:
package{
import flash.display.Sprite;
public class Liner extends Sprite{
[Code].....
i am using actionscript 3, and the problem that I have is that i am creating an array of 16 buttons and need to use the function math.random to get it to pick 5 random unique numbers out of the array. as at the moment it is sometimes picking 5 unique numbers and sometimes it has duplicate buttons appearing?
View 3 RepliesI encountered a rather irritating problem yesterday. I wrote a class. The class has got 1 variable of the type :Array. its a public variable.On the scene i have 2 movieclips which are connected to my class through its linkage in the library.My problem is that even though the instance-variable (the array) is supposed to be unique for the instance only it gets overwritten for every new instance i create.for example. if i assign the first instance's array 2 values (1, 1)and the do the same with the second but here i change the values to (2,2) then when i check my first instance it has got the same values as the second instance...that is (2,2). [code]
View 2 Repliesi wanted to create a bunch of movieclips in a for loop but wanted to name them something different each time, how would i dynamically name them? example of basically what i want to know how to do
[CODE]...
I have the following code that lists 5 buttons with dynamic texts... when pressing each button a popUp_mc window will appear with some content show in dynamic text. Only one of these 5 buttons have some images that will have symbols_mc appear... in this case I just alpha this symbol to 100 only for this button, but for the rest alpha = 0. The button the I want to show the symbol is the third one. I'm a bit confused on how to show this symbol according to the following code below.
[Code]....
I have this array:
[Code]...
I want another array which takes the values of the price from the 1st Array. Can we do something like this? private var another_price_array:Array = [all_array.price]; This second array will be used to populate a ComboBox, or can I populate the combo directly from the first array itself?