ActionScript 2.0 :: For Loop - Duplicates Movieclips - Call / Create The New Clips
Feb 25, 2006I have a for loop which duplicates movieclips. To call/create the new clips, I use this:
[Code]....
I have a for loop which duplicates movieclips. To call/create the new clips, I use this:
[Code]....
I have created a movie clip ("container_mc") and then created 5 clips within "container_mc." I want to duplicate "container_mc" twice, along with its contents.One will positioned to the left of the original and one will be to the right.When I attempt this, I am able to duplicate "container_mc." However, the duplicates do not have the 5 clips in them.
View 1 RepliesSo basically, this is how I'm adding one movie clip to the stage. var balloon_mc1 = new balloon(); this.addChild(balloon_mc1); How do I do this for 100 of these movie clips, without typing var balloon_mc1 = new balloon(); this.addChild(balloon_mc1);
var balloon_mc2 = new balloon(); this.addChild(balloon_mc2);
var balloon_mc3 = new balloon(); this.addChild(balloon_mc3);
So basically, this is how I'm adding one movie clip to the stage.
[Code]....
Is there a way I can create these clips and add them to an array in a loop ? It doesn't seem to want to work for me.. ?
var p1 = new P1; var p2 = new P2; var p3 = new P3; var p4 = new P4; var p5 = new P5; var p6 = new P6; var p7 = new P7; var p8 = new P8; var p9 = new P9; var p10 = new P10; var p11 = new P11; var p12 = new P12; var p13 = new P13; var p14 = new P14; var p15 = new P15; var p16 = new P16; var p17 = new P17; var p18 = new P18; var p19 = new P19; var p20 = new P20;
i'm having a problem with a for loop. The problem is that it doesn't create multiple movieclips with an unique instance, i think it copies over itself.
for( var i = 1, x = -20; i < 4; i++){
if(this['plaatje' +i] != undefined){
_root.again.createEmptyMovieClip("image", i);
[Code]....
i'm having a problem with a for loop. The problem is that it doesn't create multiple movieclips with an unique instance, i think it copies over itself.
for( var i = 1, x = -20; i < 4; i++){
if(this['plaatje' +i] != undefined){
_root.again.createEmptyMovieClip("image", i);
this._root.again.image += _root.again["image" +i];
[Code].....
I want to create some instances of a movieclip thats in my library. [code]This code works. Then I want to startDrag all of them, in the same loop. How to?I'vre tried "k"+i.startDrag(this) but that won't work. Any other good guesses?
View 1 RepliesI will do my best in explaining what is happening. I have a feeling it has something to do with how I declare things, but I am kinda new with AS3 so please have patience.
On my stage I have an movie clip (mContainer). In the library I have another movieclip (mElement), that has been exported for actionScript as mElement.
[Code]...
I am making a drag and drop game using AS2 in Flash CS5 where mc items are duplicated and enlarged from a menu and can be placed anywhere on the stage to create a custom robot. Each part (arms, head, feet, etc.) is it's own mc with unique instance names. I have the drag and drop part all figured out, and I even have the duplicateMovieClip part working...
HOWEVER... Whenever I move from the current frame that an object was duplicated in, to another frame and then back, the clips dissapear one by one if you try to create a new one. Each list of menu items are in their own frames (heads, torsos, arms, etc.). As the duplicates are made, they remain on stage no matter what frame you go to and can still be dagged around, which is good, but as I said previously, they dissappear when you create a new duplicate. Not all disappear at once, only older created duplicates disappear as you bring in new duplicates.
[Code]....
[Code]....
I changed the code a bit because I would like it to work like this...If I put my mc (photo) in the center of the stage, it would creat dups every 125 pixels. But this script only makes one duplicate, I must have done something to mess it up. Idealy I would like to have the mc create dups in both directions; x and -x.
I currently have a class that has a method that creates new duplicates of a clip on the screen, changes some of their properties (such as color, and text display), and then arranges them in a straight column. Inside that method, I have some clipEvent Statements for each button.
[Code]...
I have created a loop to add my clips by class and give them a name
[Code]...
Then I want to loop through these clips and change the alpha, I have tried casting as I thought that was how you do it but I get the 'cannot convert string' error
[Code]...
what script i need to add to the code below to create a number of duplicates of the "Player"?
[Code]....
I would like to create a loop so the icons in the menu continually loop indefinitly.[code]
View 2 RepliesI am attempting to use a loop to create text field with the loop's current value. The code looks like this:
ActionScript Code:
for (var i = 1; i<=10; i++) {
var 'nameHolder'+[i]+'_txt':TLFTextField = new TLFTextField();
'nameHolder'+[i]+'_txt'.x = 40
'nameHolder'+[i]+'_txt'.y = 40
'nameHolder'+[i]+'_txt'.text = "Hello World"
}
So essentially what it should do is create 10 text fields at 40, 40 with the text: "Hello World".
If you place a for loop in a recursive function with the function call within the loop... will the loop finnish or does it stop working untill the last recursion?
View 2 RepliesI'm having a problem with something which i thought i knew and apparently i dont.I have 2 Movieclips in my scene. i have "whole" and inside it "but1gallery" inside "but1gallery" i have a button named "but1". What i need is to get to a frame inside mc "whole" when clicking "but1". this is my code(im using AS2):
View 1 Replies[code]...
And I have a mc on the stage that have a code inside to attach a scroll from the library. This scroll load a mc called "Rotuladores1", and inside this mc I have my button "r1".[code]...
I have five movie clips in my library. I want to load each to the stage with a fade in and fade out. I thought I could just call them into an array, but I can't find how to reference them. I have other clips in the library too so I can't just grab them all.
View 2 RepliesIs it possible to put the following into a loop?
ActionScript Code:
var box1:Box = new Box();
var box2:Box = new Box();
[code].....
I've go some movieclips I dynamically placed on the stage in a loop using addChild(). The clips have there own class called DragAndDrop. Once the clips are are drop to the hitarea I want to deactivate them. The problem I'm having is when I run the function in the DrapAndDrop class it deactives not only the movieclip that was just dragged but the last one that was attached in the loop as well (ie I drop mc1 into the proper area mc1 and mc7 deactive).
Here is the loop that add all the clips to the stage:
[Code].....
I don't understand why its disabling both the dropped clip and the last clip in the loop when supposedly event.currentTarget should only carry the value of the object being dropped and not the instance of the object.
I've got a MovieClip with a linkage name of trackInfo. I'm trying to get XML information in a for loop to create and populate instances of the MovieClip for the length of the XML file.Here's what I have so far:
Code:
var myXML:XML;
var myURL:URLRequest = new URLRequest("tracks.xml");
[code].....
I've go some movieclips I dynamically placed on the stage in a loop using addChild(). The clips have there own class called DragAndDrop. Once the clips are are drop to the hitarea I want to deactivate them. The problem I'm having is when I run the function in the DrapAndDrop class it deactives not only the movieclip that was just dragged but the last one that was attached in the loop as well (ie I drop mc1 into the proper area mc1 and mc7 deactive, 7 being the final clip in the loop). Its frustrating me because I dont know why its happening and I dont know how to fix it?Here is the loop that add all the clips to the stage:
Code:
private function createTerms():void
{
[code].....
I'm trying to make a bit stream across my page when you mouseover a button. The bit stream can be quite long, so I wouldn't think to do it by hand. I'm wondering how I would go about making the stream start out, and how I can get each bit to follow the other right behind it. (They're about 10 pixels wide) I can get the for loop to duplicate the clips, but I can't seem to get them in order.
View 5 Replies2 movie clips MC1 and MC2 . MC2 is placed inside MC1. both the movie clips are having rollover effect. the issue is roll over effect is experienced only for the outer movie clip MC1 but no effect when hover through MC2.
View 1 RepliesCall the load function on a loader two movie clips down?
View 1 RepliesAll I am trying to do is display a movieclip (just a small rectangle) and have it repeat along the x-axis, adding one to it's instance name each time. It seems to work according to the trace statements but it only displays the last movieclip.
Here is the code:
var transition:mcTransition = new mcTransition();
for(var i:int = 1; i < 10; i++){ trace(i); addChild(transition); transition.x = i * 10; transition.name = "transition_mc" + i; trace(transition.name); trace(transition.x);}
I know this is probably really simple but it is frustrating me. All I am trying to do is display a movieclip (just a small rectangle) and have it repeat along the x-axis, adding one to it's instance name each time. It seems to work according to the trace statements but it only displays the last movieclip.
Here is the code:
var transition:mcTransition = new mcTransition();
for(var i:int = 1; i < 10; i++){ trace(i); addChild(transition); transition.x = i * 10; transition.name = "transition_mc" + i; trace(transition.name); trace(transition.x);}
I'm trying to use a loop to add some movie clips to the stage, but I want to give each one a different name so I can refer to them in another function, but I don't know how that is done. I'm trying to learn how to do this so I can create an Isometric game. Here's my code....
[Code]...