ActionScript 2.0 :: Putting All The Mc Names Into An Array (called "allName0Clips")?

Oct 20, 2002

Im trying to optimise my code a bit so i dont have ten lines of identical code on each button. Actionscript is not my strong point. Currently on each of the menu buttons there is this code:

// sets the vertical position of all scrollbars (name0) inside their content movieclips //(name) to _y = 0
on (release) {
setProperty("work1.carni.carni0", _y, "0");
setProperty("work1.dead.dead0", _y, "0");

[code]....

what i'd like to do is some kind of function like this, which does all the work in a frame on the main timeline. For example:

on each button:

// tells every "name0" mc to set _y to 0 within their respective content movieclips
on (release) {
vertical = (_y = 0);
verticalHold(vertical);
}

on the main timeline something like this:

// Get the command from the buttons and run the function and set all "name0" _y to 0
function verticalHold(vertical) {
setProperty(allName0Clips(vertical));
}

i've played around with this function for loading external swfs, but i have no idea how to make it set multiple _y positions. what about putting all the mc names into an array (called "allName0Clips") and doing it that way?

View 2 Replies


Similar Posts:


Putting Objects (Instance Names) Into Array In Flash CS4

Sep 15, 2009

I worked again on a new Project and stumbled while trying Arrays. I have two cubes(cube_mc, cube2_mc) in my scene.

My code:
var gy:Number = 0;
var gravity:Number = .2
var moving:Array = new Array(cube_mc, cube2_mc);
this.addEventListener(Event.ENTER_FRAME, gravityFUNC);
function gravityFUNC(event:Event):void{
gy+=gravity;
moving.y+=gy;
};

I was trying to put both cubes into the array, and then affecting the whole Array with gravity. When I test it nothing happens, and it shows no errors.

View 2 Replies

Flash CS4 :: Putting Objects(Instance Names) Into An Array?

Sep 15, 2009

I worked again on a new Project and stumbled while trying Arrays.

I have two cubes(cube_mc, cube2_mc) in my scene.

My code:
 
Code:var gy:Number = 0;
var gravity:Number = .2
var moving:Array = new Array(cube_mc, cube2_mc);

[Code]....

I was trying to put both cubes into the array,
 
and then affecting the whole Array with gravity.
 
When I test it nothing happens, and it shows no errors.

View 1 Replies

ActionScript 2.0 :: Putting Variables Instead Of Names

Jul 26, 2004

if i have mc duplicated or an object instance name thats stored inside a variable how can i call it? for ex: _root.mov1._x = 53; What if i want instead of mov1 a variable name. lets say randomname is a var and it holds the name of a duplicated object with a name i dont know since its random. now how can i call it just like the example above cause i tried
_root.varname._x=33; but it thought varname was an instance name instead of var.

View 5 Replies

ActionScript 2.0 :: Putting Variables Instead Of Names?

Jul 26, 2004

if i have mc duplicated or an object instance name thats stored inside a variable how can i call it?for ex:

_root.mov1._x = 53;

What if i want instead of mov1 a variable name. lets say randomname is a var and it holds the name of a duplicated object with a name i dont know since its random.

now how can i call it just like the example above cause i tried

_root.varname._x=33;

but it thought varname was an instance name instead of var.

View 5 Replies

ActionScript 3.0 :: Creating A List Of Names And Putting Them Into A Computer File?

Jul 25, 2010

I am trying to create a list of names which is generated by a swf file that contains buttons representing letters of the alphabet. The user generates a name by clicking on the letter buttons until the letters of the name have been spelled out and then clicking on abutton to add each name to the list. The names are generated inside the swf file but I want the list of names to be deposited in a file within a folder of the computer and remain there as a permanent record after the swf file has been closed. I can do the Actionscript 3 programming associated with the letter buttons but I would like to know how to send the names to the computer file.

View 15 Replies

IDE :: Putting An Object Into An Array?

Apr 1, 2009

Wrong section, moved to actionscript 3 I'm having trouble with my code. I keep getting this error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Test_fla::MainTimeline/frame1()

I believe it has something to do with the array, considering it works when I remove the array stuff. What i'm trying to do is to be able to move objects through an array with my gravitate() function in the Grav Class.

stage.addEventListener(Event.ENTER_FRAME,onLoop, false, 0, true);
for(var i:uint=0; i < numParticles; i++){
var p:Grav = new Grav(5, 0xff0000, Math.random()*250, Math.random()*250);
addChild(p);

[code]...

View 1 Replies

ActionScript 3.0 :: Create Dynamic Array Element Names Based On Another Array?

Jun 28, 2009

Is it possible to, if you have an array of class names like ActionScript Code: var city01names:Array = ["pic_01", "pic_02", "pic_03" ...] make a new array which would read these names, instantiate them, and push them into a new array containing the instances of all these pictures, which I could then use for a slideshow?

[Code]...

View 7 Replies

ActionScript 3.0 :: Get Nodes In A Path And Putting In An Array?

Nov 13, 2009

id like to get the coordinates x and y of each node (a point or vertex of a path) in a path (not dynamically created) in flash cs4 (and put them in an array).

it doesnt need to do it dynamically.

View 3 Replies

ActionScript 3.0 :: Putting Array Objects In A Container?

Aug 29, 2009

I came up with this code to see if it was possible to put an Array of Objects in a Sprite Object which would act as a container for the array. I found out that it is possible, but now I'm wondering if this is the best way to go about doing something like this.

ActionScript Code:
/*
Creating a container object that will
hold 3 Gear Objects.

[Code].....

View 4 Replies

ActionScript 2.0 :: Putting Contents Of An Array In Textfields?

Aug 3, 2005

I have an Array with several Items (between 10-15)Now i wanted to give out these Items in Textfields dynamically.

View 2 Replies

ActionScript 2.0 :: Breaking Appart Text And Putting In Array

Oct 11, 2007

I need to create a function with takes a text field and does two things with it.The first is to split text up into individual letters with each being a separate symbol. Basically the equivalent to breaking apart the text field, then converting each letter to symbols, then giving each letter its own unique name This is the way I'm doing it now and its very time consuming and not at all easy to update to text.The second part is to create an array containing all the instant names.For example if the text was "hello world", the function would create symbols with called n1 (containing h) , n2 (containing e) , n3 (containing l), n4 (containing l), n5 (containing o), and then the array would be [n1,n2,n3,n4,n5]

View 2 Replies

ActionScript 3.0 :: Creating Instances Of Movieclips In An Array And Putting Them On Stage?

Feb 22, 2012

Is this correct? I am gettign this errorTypeError: Error #1007: Instantiation attempted on a non-constructor.I am trying to created a new instance of a movieclip on stage based on the number from elderCount.

//elderCount is a var:Number
var elderMan:Array = new Array(new starMovie());
var Star:starMovie = new elderMan[elderCount](stage);

[code].....

View 5 Replies

ActionScript 2.0 :: Array Names From An Array?

May 1, 2003

i have an array of array names, but i'm having trouble with it being considered a string:

<BR>
onstageArray = ["_root.backstageArray", "_root.perfArray"];
<P>

[code].....

View 2 Replies

ActionScript 3.0 :: Only One MC Showing When Called In Array?

Mar 11, 2011

I am attempting to place an animated "block" wherever its defined number is called in the array. However, the movieclip, instead of placing 1 mc at each instance, moves the moviclip to the last position called any graphics drawn using action script I can spawn in multiples.

ie:

ActionScript Code:
//5 symbolises a movieclip block
var newPlacement;

[Code]....

View 2 Replies

Arrays :: Get The Key Names Of An Array?

Mar 14, 2011

I've been seaching on how to get the key names of a flex Array as there is no such function in the Array class. Here is my answer that may be usueful to any of you.

View 2 Replies

ActionScript 3.0 :: Array Items Called As Functions?

Oct 26, 2009

How would I go about evaluating an array of strings as function calls?Something like this:

ActionScript Code:
var my_mc:MovieClip;
var myArray:Array = new Array("function1()", "function2()", "function3()");[code]....

I get an error "Instantiation attempted on a non-constructor".In this case, I'm trying to dynamically add linked movie symbols from the library. Perhaps I'm going about this the wrong way... ?

View 4 Replies

ActionScript 2.0 :: AS 2 Dynamic Array Names?

Dec 14, 2010

I was wondering if it was possible to create the name of a NEW array dynamically. I have tried the following with no success. Does anyone know if this can be done?

Actionscript Code://Tried and failed_global["newArray"+newArrayNumber] = new Array();//Tried and failed_this["newArray"+newArrayNumber] = new Array();//Tried and failednewVariable = _this["newArray"+newArrayNumber];newVariable = new Array();

View 1 Replies

ActionScript 3.0 :: How To Use Array To Store Names

Oct 21, 2010

I have an array called mclipArray with the names of movie clips stored in it as follows:
mclip0, mclip1, mclip2, mclip3....and so on until mclip99.
Later in my code I want to run a loop using "i" as a counter variable from 0 to 99 and then depending on the value of "i" add various movie clips to be inside the movie clip that corresponds to "i". For example if I want to add a movie clip called "someMovieClip" as a child of my movie clip called "mclip6" and my loop has been running and "i" is now equal to 6, how can I use "i" to reference the correct index stored in the array.
mclipArray[i].addChild(someMovieClip);
The above code doesn't work.

View 7 Replies

ActionScript 3.0 :: Sorting Names In An Array?

Nov 22, 2010

I want this to be sorted by first name only: "John Smith 18", "Charlotte Smith 59", "Chris Doe 26", "Tony Jordan 100", "Charlotte Roberts 17", "Imad Hanna 26", "Charlotte Smith 13"

I can get it sort sort alphabetically just by using .sort(), but it takes into account the last name as well.

View 4 Replies

ActionScript 2.0 :: Array That Creates The Mc's Names?

Apr 19, 2005

I have an array that creates 7 mc clips with names.I'm trying to make each one of those peices clickable.When clicked each peice will slide over to the far left "barrier_mc" and stop.Actually not true, the one closest to the "barrier_mc" will stop at the barrier and from then on each piece will stop when it hits the one beside it (kinda like a 7 car fender-bender). This isnt the problem im trying to work through right now, although i will in the near future.

What im trying to figure out is the array that creates the mc's names them like the following "" infoBar"+i+"_mc"". What im trying to do is call that in a function so that i dont have to type in each of the 7 mc names manual I.E (infoBar0_mc) you'll see my function at the bottem in the "function pieceStop"of the pasted code.

Code:
var list:Array = ["piece1", "piece2", "piece3", "piece4", "piece5", "piece6", "piece7"];
var startingX:Number = list_mc._x;
var bottom:Number = 950;[code].....

View 2 Replies

ActionScript 2.0 :: Loading XML (names) From Array?

Feb 12, 2007

ok so i have this array from which i wanna fetch names of the XML files i want to load in their XML object, so i write like this but it doesn't work.[code]

View 2 Replies

ActionScript 3.0 :: Instance Names In A Array?

Apr 5, 2010

I have some movieclips on stage each with an instance name like this: 101, 102,103,104.. etc.When I click one of them, it's istance name is added in an array:[code]I've got a button on stage too and I want when this button is clicked to change the Y of all the selected movieclips:[code]

View 6 Replies

ActionScript 2.0 :: AttachMovie With Names From An Array

Jul 8, 2010

I'm trying to reduce repetition in my code by using a for loop with an attachMovie call. [code]So I have a bunch of clips in array that I want to attach, and I just want to use the name of the clip as the instance name, but it doesnt seem to work.

View 3 Replies

ActionScript 3.0 :: Instance Names In Array?

Apr 19, 2012

I have a bunch of buttons on stage, and i want to place all of those buttons names in an array so i can assign an event listener to them easier. What i have is:

Code:
var btnArray = new Array["btn1","btn2","btn3","etc...."];
for(var c=0; c<btnArray.length; c++)
{
btnArray[c].addEventListener(MouseEvent.MOUSE_OVER, doSomething);
}

But that isnt working.

View 2 Replies

ActionScript 2.0 :: Store Array In An Indexed Object Called Regions

Nov 3, 2009

I have an array name region it has a couple of properties. "code", "name", "value"

I want to store this array in an indexed object called regions.

I would then like to access the object by referring to its sub property name

regions[1].code
regions[1].name
regions[1].value

I can set an array region.code, region.name and region.value but I can not set the regions values

regions[1].code = "abc"
regions[1].name ="alphabet"
regions[1].value =26

note: region is singular and regions is plural(many)

Can someone outline the variable definition and construct so I can access this information. Happy to replace the index field with the code value.

View 1 Replies

Can Images Be Stored In Some Sort Of Array And Then Called To The Stage Randomly

Oct 17, 2011

Can images be stored in some sort of array and then called to the stage randomly?

View 3 Replies

ActionScript 2.0 :: Creating Array - Called Points Shown As Undefined

Aug 14, 2004

I'm trying to create an array, and this is the code I'm using:
Code:
function create_spiral(len, rad, turns, num, theArray) {
theArray = [];
var inx = len/num;
var iny = ((360*turns)*(Math.PI/180))/num;
var inz = iny;
[Code] ....

And I'm calling it with:
Code:
create_spiral(200, 10, 3, 100, points)
ideally, I would then have an array, called points, which would be full of numbers. But when I run a trace it shows as undefined.

View 2 Replies

ActionScript 2.0 :: Putting Data Into An Array Via XML And Then Selecting At Random An Image String To Load In A Pic At Random

Feb 11, 2009

I've been putting data into an array via XML, and then selecting at random an image string to load in a pic at random. But whilst doing this, I wanted to remove the String from the Array that I have just used, so I don't get repetition of the same image in the output. I initially thought that pop would remove the string I had just used - But of course it Removes the last value in the Array instead, which doesn't really help.

Ok - so how about randomizing the data once inside the Array, after it has been pulled in from XML!? That way I can load in the 'last' image, and then pop it out! Keeping a randomized selection of images each time 'it' is loaded

View 2 Replies

ActionScript 3.0 :: Dynamic Array Instance Names

May 28, 2009

This should be simple but I can't come up with or find the answer anywhere. All I want to do is create a series of Arrays with instance names generated on the fly. I then want to reference these later. I have a "for" loop with a variable "count" that I want to add to a base name of rowArray and use the result to create an Array. I would think that it would look something like this:

[Code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved