ActionScript 2.0 :: F8 Using Array To Repeat A Function For Several Movieclips

Nov 5, 2009

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 Replies


Similar Posts:


ActionScript 2.0 :: Using A Function On An Array Of Movieclips?

Mar 12, 2011

I'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?

View 3 Replies

ActionScript 2.0 :: Find A Function That Will Repeat Rotational Tween Function

Aug 8, 2007

I'm trying to find a function that will repeat my Rotational tween function. I found the yoyo() function to be what i want to do but i don't want the tween to change the rotation to CCW while originally moving CW. Basically i want the animation to move CW at a steady rate continuously.

I'm using the following code at the moment, i'm not too sure if this is the most suitable code for this situation, maybe im off track.

From my thoughts, i assumed that i would need to put the stars function in a onEnterFrame to repeat the animation and change yoyo() to continueTo() function. or maybe some sort of if statement in the stars function?

ActionScript Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var stars:Tween = new Tween(ring, "_rotation", Regular.easeInOut, 0, 360, 4, true);

[Code]....

View 5 Replies

ActionScript 2.0 :: Assign An Array Of Movieclips Same Unique Function?

Feb 4, 2011

I hope the title of my post isn't confusing, I wasn't sure how to phrase it. [code]...

View 1 Replies

ActionScript 1/2 :: Repeat Function After X Seconds?

Nov 21, 2010

I just wonder if I could make the object "car" to repeat doing this:
 
function start_car(){
_root.car.onEnterFrame = function(){
_root.car._y +=15;
};
};
setTimeout(start_car, 1000);
 
I want it to begin at y=0 and x=0 after like 7 seconds and then repeat going down the y axis as you can see in the code.
 
So the car movieclip starts moving slowly from the top going down then  after like 7 seconds when it's out of the scene it begins at e.g x=0 y=0  and going down for 7 seconds then starts at x=0 y=0.... etc, so it  keeps looping.

View 1 Replies

ActionScript 2.0 :: Repeat Function After X Seconds?

Nov 21, 2010

I jst wonder if I could make the object "car" to repeat doing this:

ActionScript Code:
function start_car(){
_root.car.onEnterFrame = function(){

[code].....

View 1 Replies

ActionScript 3.0 :: Repeat The Function When MOUSE_OVER It?

Feb 26, 2009

I want to repeat the function when you MOUSE_OVER it..

Code:
p_rechts.addEventListener(MouseEvent.MOUSE_OVER, rechts);
function rechts(e:MouseEvent) {
stoel.collada.rotationY -= 5;
}

now the "stoel" rotates 1 time -5, but i want it to repeat itself, till your mouse is of the button..

View 1 Replies

ActionScript 2.0 :: Call A Function To Repeat Over A Few Different Frames?

Dec 9, 2005

I would like to be able to call a function from a movie clip so that the function repeats itself over a few different frames without having to be called again. I could have the function call itself according to an "if" statement but I believe that the movie will not go the next frame until it finishes all the cycles. So for example: The function makes the movieclip move over a few pixels but I want it to move over a bunch of pixels so as to give the illusion that it is moving slowly, I To do that the function needs to repeat until the movieclip moves the entire distance, but if that happens all within the function, at least as far as I have been able to figure out,

View 7 Replies

ActionScript 2.0 :: Repeat A Function X Number Of Times?

Jun 23, 2006

I am trying to repeat a function x number of times. How do I go about doing that?

Here is the function:

Code:
function dance(){
var animspeed = .4;
var back = 0;
var delay = (animspeed);

[Code]...

View 3 Replies

ActionScript 2.0 :: Make This Function Repeat Until _yscale=300?

Oct 25, 2004

i'm using this code to for a button to make a MC "kids1" gradually scale to 300%, in 5% increments, but it only scales it 5% then stop, does anyone know how to make this function repeat until _yscale=300?

Code:
on (release) {
if (_root.kids1._yscale<300) {
_root.kids1._yscale+= +5;
}
}

View 1 Replies

ActionScript 3.0 :: Disable RollOut Function On Movieclips On Click Function?

Sep 13, 2009

I'm doing a basic site with frame labels on the main timeline whose name corresponds to the btn names. A simple  otoAndPlay(evt.target.name); I have a basic navigation setup of 7 mcs with mouse eventlisteners for CLICK, ROLL_OVER and ROLL_OUT.
 
Example:
prepare.addEventListener(MouseEvent.CLICK, navigate);plans.addEventListener(MouseEvent.CLICK, navigate);retire.addEventListener(MouseEvent.CLICK,

[Code]....
 
Does anyone know a better way to do this so when my mcs are clicked they display the rollover content/art? In essence I'm trying to achieve that when the user clicks a btn it goes to that "page" and the corresponding btn stays highlighted. Pretty standard web navigation technique but I just don't know what the best way to do this in flash is and with  how my site is setup.

View 1 Replies

Array's And MovieClips - Use The Naming Conventions Of An Array?

Nov 18, 2009

I received help on this site on this info-graphic im doing and the solution was to use an "array" which im not familiar with at all. the person that helped me added the following code that worked:

var city_arr:Array = new Array("louisville");//filll that array with all nedded cities//make all the boxes invisible at startfor (i=0;i<city_arr.length;i++){    var [code]...

since i dont know how to use arrays im stuck. i need to add at least 30 more cities to my info-graphic but don't know how to use the naming conventions of an array.Only one of the houses works (when you click on it a pop-up appears, is draggable and has an x to close the pop-up)

Attachments:
relocation_working.fla.zip (975.1 K)

View 1 Replies

ActionScript 2.0 :: Array.onPress - Add A OnPress Event To Dynamically Duplicated MovieClips ID's Stored In Array List

Apr 15, 2011

lets say i have dynamically duplicated movieClips ID's stored in array list. i want to add a onPress event to them. how do i do it?

[Code]...

View 5 Replies

ActionScript 2.0 :: Calling A Function With An Array Variable As Arguments Is Resetting Array?

Oct 12, 2006

I'm going to post the full code of the two functions, disregard the "fluff" unrelated to the two functions as it is all working flawless, I've tested this HEAVILY and cannot understand why it keeps setting the entire array to undefined!

Code:
// processReplace Function
function processReplace(transferFiles) {
var processArray:Array = transferFiles.slice();

[Code]....

Basically it's supposed to check to see if the file exists and return as true if it does and add it to a replace array, then the replace array is processed into a single string and put into a dialog box through the flash wrapper prompting them to "replace the files or not".

It makes the replace array just fine, it actually even has the right "count" in it but it's setting all the "filenames" to undefined because of the exists = processSearch function.

I even tried to make a new array and run the search just from that one and set the values from the old one and it's still failing.

Is it because of the "break" or can anyone figure it out? Iknow it's hard because you can't use the code

View 1 Replies

ActionScript 3.0 :: Store A List Of Parameters Needed For A Function In An Array And Then Use That In A Function Call?

Jun 23, 2009

is it possible to store a list of params needed for a function in an array and then use that in a funciton call?

[Code]...

or something like that?? Prob have to iterate the array but how do i get the params into the function call? Is this even possible?

View 6 Replies

ActionScript 3.0 :: Function Returning Array And Declaring A Function With Event And Variable?

Jul 27, 2009

is it possible to declare function this way

ActionScript Code:
function startShake(e:MouseEvent, num1, num2):void

what i mean is it possible to send to the function not only en event but also a variable and a second question how can i access

ActionScript Code:
function stopShake(e:MouseEvent):Array

this array that function return.

View 1 Replies

ActionScript 2.0 :: Filling Function Arguments With Array Items, Function.call()?

Feb 28, 2008

I have this code but I cannot work out how to fill in function parameters based on an array and it's length, see line 7

[AS]
import com.robertpenner.easing.Cubic;
MovieClip.prototype.framesTimeout = function(func:Function, frames:Number, args:Array) {

[code]....

Is it possible to call a function and fill in the parameters based on an array and it's length?

View 1 Replies

ActionScript 3.0 :: MovieClips In An Array?

May 1, 2009

Is it possible to load up an array with movieclip instances from the library and use that as a reference to go to a certain index, snag that mc, and display it on the stage?

View 5 Replies

AS3 Array Change Movieclips

Jun 8, 2009

I have 2 arrays i.e.:[code]Is it possible to set the color of the moviceclips (mcclipsArray) to the relevant colors from the second array (mcclipsColorArray), so movieclip a becomes blue, b becomes red etc.

View 2 Replies

ActionScript 3.0 :: Put Movieclips Into An Array ?

Jul 15, 2008

I want to put each movie clip created with this for loop into an array so that I can load images into each movie clip in a later script.

var total1:int=2;
var spacing:Number = 100;
var box_mc:MovieClip;[code].....

View 3 Replies

IDE :: Accessing Different MovieClips In Array?

Mar 14, 2010

I'm having problems making a loop of different movieClips. I've been able to find info about duplicating the same movieClip but I can't seem to get it to apply to this. This is what I am working with: I have 13 different movieClips of an animated character. They are titled montyDog_mc, montyBear_mc, montyCat_mc, etc. I also have a next and a previous button. What I need to happen is for the movieClip animations to cycle through, one at a time, each time the user clicks the next or previous button. I think I should be creating an array of some sort but I am very confused about how I list the movie clips in an array and apply it to the button.

This is what I have:
montyArray = new Array();
montyBear[0] = "montyBear_mc";
montyBee[1] = "montyBee_mc";
montyCow[2] = "montyCow_mc";
montyDog[3] = "montyDog_mc";
[Code] .....
Am I targeting the movieClips properly?

View 4 Replies

ActionScript 3.0 :: Add Movieclips From An Array?

Nov 29, 2010

Just started to make the switch from AS2 to AS3 and am having a few problems, most of which I've managed to fix but this one has got me stumped.

I'm trying to create some buttons dynamically that are spaced out evenly.The clip is in the library and exports as NavButton. I've created an array with all the button clips inside it. This is called navButtonArray and when traced shows the NavButton clips. My problem is when I try and add them to stage. I can't tell if it's only adding 1, or just placing them in the same place, or if it's continually replacing the previous navButton.[code]...

View 2 Replies

ActionScript 3.0 :: MovieClips Array Is Not Working?

May 14, 2009

I'm creating multiple movieclips, containing a TextField and an image as a background. In order to keep track of them I'm storing them in an array. The problem is that I can't add the movieclip to the screen >.< What I'm doing is

PHP Code:
addChild(movieclips[0]);

but it's not displaying. I know it's not the movieclip as I can addChild that and it shows, but trying to call it out of the array is not working and it's REALLY frustrating the nark out of me .How do I add the selected movieclip out of my array?

View 4 Replies

ActionScript 3.0 :: Add Movieclips From Instances In Array?

Mar 31, 2011

Ive created a array to hold an instance of the Zombie movie clip, the movie is given an instance of "Zombie" + 1, 2, 3..... But now i can't work out how to add the movie clips from the Array to the stage. [code]...

View 3 Replies

ActionScript 3.0 :: Instantiate MovieClips In An Array?

Jun 29, 2010

Is it possible to instantiate MovieClips that exist in the library (that have been exported for actionscript) with a for loop using an array that holds their link name?
 
var fruit:Array = new Array("apple", "banana", "blackberries");
for (var i:int = 0; i < fruit.length; i++)
{
var aFruit[i] : fruit[i] = new fruit[i];
}

View 5 Replies

ActionScript 1/2 :: Get A Collision Between An Array Of Movieclips?

Sep 8, 2010

I am trying to get a collision between an array of movieclips but it isnt doing well =S.Here is where I am now:

[code]....

This code works, but it is only colliding with one object. I have made an Array called: _root.enemyArray.I have tried to make an for statment inside the current one without sucess.

View 6 Replies

AS3 :: Flash - Removing MovieClips In An Array?

Oct 15, 2010

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?

View 2 Replies

Actionscript 3 :: Re-stacking MovieClips In An Array?

May 13, 2011

I was trying to make a similar thing with the game SameGame (ie. the block above the removed blocks fall downward). Before trying this with an Array that contains MovieClips, this code worked (tried it with int values). With MovieClips on the array, it seems not working the same way.With int values, example:

popUp(0, 4): Before: 1,2,3,4,5,6,7,8,9,10; After: 1,2,3,4,6,7,8,9,10

But with MovieClips:

popUp(0, 4): Before: 1,2,3,4,5,6,7,8,9,10; After; 1,2,3,4
// Assume the numbers are movieclips XD

Basically, it strips everything else, rather than just the said block >_< Here's the whole method. Basically, two extra arrays juggle the values above the soon-to-be removed value, remove the value, then re-stack it to the original array.

function popUp(col:uint, row:uint)
{
var tempStack:Array = new Array();
var extraStack:Array = new Array();

[code]....

View 1 Replies

ActionScript 3.0 :: Manipulating With MovieClips In Array

Jan 22, 2009

I want to dynamicly add images from XML to movieClips and then add event listeners to these movieClips. What is the best solution? XMl loads correctly, it also add 2 movieclips on stage, but it throws errors when I try to add event listeners to movieClips. How could I do that? I want to go to different frames on release of some movieClips. How can I please recognise each movieClip and manipulate with that movieClip ? (resizing,...)

[Code]....

View 1 Replies

ActionScript 2.0 :: Attach 5 Different MovieClips In An Array?

Jan 20, 2010

i have an error in my game project. i am trying to attach 5 different movieClips in an Array.but i dont want these movie clips to be appear on the stage when i attach these. but these movie clips appears on the stage as soon as loop executes.

here's the code:

var terrorists:Array = new Array();
for(i=1;i<=5;i++) {
var terrorist:MovieClip=attachMovie("terrorist_"+i, "terrorist_" + i, i);
terrorists.push(terrorist);
}

View 6 Replies







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