Actionscript 3.0 :: Access Multiple Movie Clips With Loop And GetChildByName?
Nov 3, 2010
All i really want to do is be able to affect multiple movieclips at once with event listeners and greensock tweens.
The first snag I hit was that I couldn't create references to movie clips using the old [] Associative array referencing method. Maybe I still can with AS3, but I couldn't get it to work...
So I found another technique using getChildByName that returns a reference to a movie clips and allows me to store that reference in a variable.
However, the movie clip I'm trying to affect with an event listener resides inside of another movie clips, so to build the address (aka, root.mc1.m2.mc3) to the mc I want to get to is proving to be difficult. (I'm very new to AS3...)
I thought the trace(target1_mc.target2_mc.name); at the bottom of the following code would output the name of target2_mc but it doesn't.[code]...
All i really want to do is be able to affect multiple movieclips at once with event listeners and greensock tweens.The first snag I hit was that I couldn't create references to movie clips using the old [] Associative array referencing method. Maybe I still can with AS3, but I couldn't get it to work..So I found another technique using getChildByName that returns a reference to a movie clips and allows me to store that reference in a variable.However, the movie clip I'm trying to affect with an event listener resides inside of another movie clips, so to build the address (aka, root.mc1.m2.mc3) to the mc I want to get to is proving to be difficult. (I'm very new to AS3...)I thought the trace(target1_mc.target2_mc.name); at the bottom of the following code would output the name of target2_mc but it doesn't...[code]
I have multiple movie clips on stage (all in separate layers, of course) as well as buttons on stage to play each movie clip. There are buttons inside each movie clip. The problem is that the buttons inside the top layered movie clip work, but the others in the movie clips below don't.
I'm trying to use XML to load in 4 images to a movieclip within a movieclip that is already created on the stage. I'm trying to do this in a loop since there are 4 movie clips I'm trying to access. I can get it working without the loop, but it's figuring out the syntax that's causing the problem. Currently I have the following code:
function ParsePics(picsInput:XML):void { var picsList:XMLList = picsInput.pic.image; for (var i:int = 0; i < picsList.length(); i++) {[code]..............
I have this code to use to pause animations in different areas of a .fla, for each pause I have been copying this and changing the "var timelinePause" and other items as shown after the original code, is repeating this code for each pause just junk code? is there something else from this that I can use to pause?
I have made 30 movieclips for my level selection screen. Then I create a movieclip with the same name using a for loop. With that code I make roll_over function showing a Tooltip. I then want to trace what button is being clicked. My whole code is here: [URL] I want to trace what button is clicked, so I can show it on my tooltip textbox.
I have 29 buttons, named img1, img2 ....till img29...I need to access them all in a loop. I had asked this question earlier, but at that time the buttons had to be accessed via their holding movieclip, but this time the code is within the clip, so I need to directly access the button.
So originally the code I was using to access them was
_root.folioholdermc["img"+i]._alpha //thanks to Ned Murphy
now I need to access them as
this.img2._alpha //due to a path change
I tried using
this.img[i]._alpha but this is not working.
I want to put this in a loop where I moves from 1 to 29.
i got a school flash project where i need to access the _y properties of many movie clips buttons that set with name like sel 1 sel2 sel 3 and so on the problem is i have 2 sets of those, one on the main timeline which i can access with "for" looped _root["sel"+i]._y and one which is inside another movieclip problem is i don't know how to access the later using for loop? this is the script that i used to access the _y on the _root.selx
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.
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");
how to imitate a reflection of a movie clip in a "mirror." I don't know if I should have the initial movie clip on custom cursor or have it set to drag... but either way I don't know how to make the second clip the "reflection follow along. Obviously it would need to follow at a slightly offset pattern so that you would be able to see both clips (or majority of them) at the same time. It's for a school project that is due at 9am tomorrow so time is of the essence!!
I was wondering about the flexability of loading movies into a movie clip. Currently, I am well able to load one movie into a movie "loader" clip, but thought maybe there is a way to load additional movie clips into that same "loader" clip, as i am starting to accumulate several different graphics that i need to have be inside movie clips so that i can make them change colors on the same frame when needed.
i shot from the hip and tried this code, but didnt have any luck:
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 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....
So 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);
I'm trying to make a portfolio page where each of my thumbnails loads with the 'fading grid' effect. I've made all the thumbnails movie clips with the appropriate script, and they all work fine. I've also set them to be exported for actionscript, each with a number as their name, i.e. "1" "2" and so on.
I was then planning on using the following bit of code to load these movies into my portfolio clip, to save me having to do it at author-time.
[Code]....
But for some reason, instead of loading two movies, each one 10 to the right of the previous movie, it just loads them on top of each other. Is it something to do with the stage not updating?
I have a main swf called, main.swf; Inside it I load another movie, skin.swf (this has 10 movieclips in the library with linkage name). What I want is to attach the movieclips from skin.swf inside the main.swf.
But problem is I am not able to attach the movie clip in the main.swf from skin.swf.
I am trying to loop through an array of 5 movie clips using a timer. Below is the script that plays the first movie clip, then plays the next clip over and over.
var timer:Timer = new Timer(2000); timer.addEventListener(TimerEvent.TIMER, onTimer); timer.start();
Im trying to simply access a movieclip (movieclipB) which is nested inside another movieclip (moveclipHome). This parent movieclip (movieclipHome) has two key frames inside, one that contains movieclipA on the first frame and movieclipB on the second frame. I can easily access movieclipA on the first frame of the movieclipHome by using the following syntax[code]...
How would I go about using a timer to initiate multiple movie clips at once, and then loop them if they are all different lengths so that they restart in sync once more?
For example, say at t=0, 3 movie clips are started. Movie clip 1 is 3 seconds long. Movie clip 2 is 6 seconds long. Movie clip 3 is 10 seconds long. Movie clip 1 would end before movie clip 2 and 3, but I don't want it to restart until the others are both finished.
Furthermore, is it possible to set a countdown so that the the movie clips are initiated not after a duration, but after a specific time? For example, instead of having a timer countdown from 10 seconds and then playing, it instead countdowns until say 12:00 PM and then plays the movie clip.
I've been staring at the screen too long and I'm sure the answer is simple but this has been bugging me for a bit now. I've created a grid with over 200 movie clips dynamically using a for loop. I was wondering if there was a way to assign rollovers and such to each new clip using the same loop.
I've been poking around with it a bit but can't seem to get it working and sure don't want to write over 200 rollover functions so any help would be great.
ActionScript Code: public function layoutLoad(e:Event):void { FlashConnect.trace("Display.loadLayout()");
[Code].....
It will compile but I get a "Cannot access a property or method of a null object reference." So I am not targeting right. I did double check my instance name is correct and in the root of the loaded SWF