ActionScript 3.0 :: Looping Through MovieClip's Children?
May 3, 2008
I've drawn a few shapes, converted each of them to a MovieClip, and then put them all in one parent MovieClip. How can I loop through them all so I don't need to do this:
Code:
parent.child1.height = parent.child2.height = parent.child3.height = 0
View 11 Replies
Similar Posts:
Dec 3, 2008
This post is related to another post I have in the forums: "Dynamically adding containers".[code]...
View 3 Replies
Jan 11, 2010
I want to have a rollover effect of a movieclip (mo1) inside a movieclip (mo) of another movieclip (popup1).Is it possible to do that? I try calling it using this code in the frame 1 of my flash, am i doing wrongly?
Code:
popup1.mo.mo1.onRollOver = function() {
popup1.mo.mo1.gotoAndStop(2);
[code]......
View 9 Replies
Nov 18, 2009
I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)
Code:
<root>
<dir name="images">
[code]....
View 2 Replies
Nov 16, 2010
Is it possible to resize a movieclip without stretching the contents of the movieclip??? I'm having the most frustrating time trying to do this.
View 5 Replies
Jul 29, 2009
when I have one movieclip mc1, mc2 is child movieclip in mc1. How can i copy mc1 to mc1_1 with all children movieclip ? if i use attachMovie or duplicateMovieClip, i only copy mc1 without mc2.
View 3 Replies
Jul 11, 2011
I have an movieClip Container and I want to move all its children into an Array.i think about the method I used to delete all children of a container by using while and removechild at 0, but I think it wont work in this situation.
View 2 Replies
Mar 24, 2010
Is there a way that I can obtain the name of a clip's children just like I can obtain the name of it's parent by using _parent?
Basically, I have a whole bunch of MovieClips that I have created through a function that parses an XML file. Basically, it's a custom-made Tree.
I have them all set up in their proper horizontal and vertical positions, but the one thing I'm having trouble doing is closing a branch on it. I've tried storing values in arrays to help me sort all the MovieClips on the Stage, but I must confess that I'm not good with arrays at all, so is there some sort of obscure function somewhere that can return the child clips, so I can do something like:
Code:
myMC.onRelease = function():Void {
if (myMC.hasChildMovies() == true)
for (var i:Number = 0; i < myMC.childMoviesArray.length; i++){
[Code]....
View 1 Replies
Jul 10, 2010
Pausing, stopping and playing movieClip (MC) children. I am making SWFs that an interface will load and control (pause, re-start, stop, etc.). Then the interface is paused, the main MC will pause but not it's child MCs. I didn't write the interface, I am just supplying SWFs that are loading into the interface. The developer of the interface willn't allow me to use animated MCs in my SWFs since he can't control them with the interface. So all my animation need to be on the main time line, which is no optimal to say the lease.Can I provide him with some code to allow him to stop the child MCs or is there an Event Listener I could include in the child MCs that would pause, stop, restart, etc when the main MC changes?I currently do not have a fix at this time and since all my animations are on the main timeline, is there a way to select multiple objects (on difference layers) and move and resize them across multiple keyframes?
View 1 Replies
Feb 2, 2009
I have a MovieClip that I dynamically add other MCs as children to. Now I'd like to have a function that removes ALL children at once. I tried a loop with (i < mc.numChildren) but somehow it will only remove even-numbered children, the odd ones stay on stage?
View 12 Replies
Dec 24, 2011
I use swapChildren(mc_1,mc_2) to switch depth between 2 movieclips from the root level. Everything work just fine....
but when I create a container_mc and place the two movieclips into it then the 1120: nullobject reference error occurs?? container_mc.swapChildren(mc_1,mc_2);
View 9 Replies
Apr 11, 2012
I've few movieclip from library that will add to stage, inside of the movieclip have some mc that I want to control it, here is my script.
if (selectDiffText.text == "Collection 1 Easy")
{
var c1_easy:cartoonEasy = new cartoonEasy();
[Code]......
let say if c1_medium is added to stage, c1_medium will also randomly added 1 of the movieclip from library on it.
inside of the playGame mc, I've mouseTarget.alpha = 0;...how can I control it from root level? c1_easy also have the mouseTarget.alpha=0 too.
View 1 Replies
Nov 9, 2010
How can I reliably iterate through a MovieClip for every child?
I'm working on a game and a great way to lay out my levels is inside a MovieClip, with each frame being a new level. The problem is that when I move on to frame 2 or 3 and try to iterate through the MovieClip's children, I'm getting a different number (less) than is actually on that frame.
I think it's because the instances from the previous frame are being carried over to the new frame.
A simple solution is to create a new MovieClip for every level instead of a new frame inside each MovieClip, but this isn't the most scalable solution (say I want to remove a level or add a level between other levels, etc).
View 3 Replies
Oct 14, 2011
I am having a container mc with 5 children mcs. children names mc0,mc1....mc4.
cont.getChildByName("mc"+Number(cont.numChildren-1)).x =
cont.getChildByName("mc0").x - 20 *1.2;
after this re-position process.. I want to set the last item position as 0 and so on. How can I do this?My target is to attain a circular movement.like
[mc0][mc1][mc2]
[mc2][mc0][mc1]
[mc1][mc2][mc0]
[mc0][mc1][mc2]
View 2 Replies
Aug 4, 2009
I have 2 movieclips on stage; one called 'myMarker_mc', the other called 'myMarker_mcOne') - they both contain 4 children (bt_up, bt_dn, bt_remove ) and myText (a textfield) and they only work properly when it is the 'myMarker_mc' that is being called (called from the xml at the top of the file).
Code:
stop();
import flash.display.MovieClip;
import flash.text.TextField;
[code]...
When myMarker_mcOne is called the dynamic textfield, called 'myText' produces a blank and the output box pops up with...
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MapMovieClipJune09TrialMarkersB_fla::MainTimeline/showData()[MapMovieClipJune09TrialMarkersB_fla.MainTimeline::frame61:126]
View 2 Replies
Feb 14, 2011
I've got a MovieClip contaning a few children.When I mouse_over on it I see that the current target is the children where I got on and not the parent movieclip.How do I get the parent movieclip as currentTarget while mouse_overing?
View 3 Replies
Mar 25, 2010
I'm using Flash CS3, programming in AS2 and I'd like to know if there is a method that allows me to retrieve the names of all the children of a particular MovieClip.I have been creating a custom Tree for an application as I can't find any Tree component out there that can deliver the specs that I need (it's to create a simulation of a particularly complex Tree created as an ActiveX component for a custom application) and I'm using an XML to feed values to this Tree, thus I don't really know beforehand how many MovieClips will be on the stage or their exact names (as they all just increment as necessary).
I'm at the point that I need to be able to hide the nodes in this Tree, and I'm having a devilish time trying to manage it through arrays,so I figure that if there's a way that can I can retrieve the name of MovieClip's parent with the _parent property, there has to be a way to retrieve its children as well right? Right? I just can't find that method or property anywhere though. Much like the XML parser lets you find out if a node has any children.Or maybe someone is familiar with where there's a custom class that I can DL for this purpose? Or am I doomed to try to unscramble a mess of arrays?
View 2 Replies
Mar 9, 2009
I have a movieclip that will have between 3 and 6 children in it. I need a way to delete all the children.
View 1 Replies
Jun 14, 2009
I'm working on my second flash game and have been stopped in my tracks trying to cache MovieClip Animations into arrays of BitmapData frames. To capture the frames I have set up a loop which runs through the frames in the MovieClip and use copyPixels to get a snapshot of the graphic.This works fine if the MovieClip to cache does not contain any child MovieClips, but if it does, these MovieClips are frozen on their first frames. I've been looking at MovieClip.getChildAt(index) in attempt to navigate their time lines but because that returns a DisplayObject it seems impossible.
So, my question is: Is it possible it to use copyPixes on a MovieClip and also step through child time lines, or should I be using sprite sheets?
View 2 Replies
Aug 4, 2009
I have 2 movieclips on stage; one called 'myMarker_mc', the other called 'myMarker_mcOne') - they both contain 4 children (bt_up, bt_dn, bt_remove ) and myText (a textfield) and they only work properly when it is the 'myMarker_mc' that is being called (called from the xml at the top of the file).
Code:
stop();
import flash.display.MovieClip;
import flash.text.TextField;
[code]....
View 4 Replies
Dec 29, 2009
I have some components in the library being exported to actionscript, and I add them to MovieClip,like this:
[Code]...
View 4 Replies
Sep 20, 2011
I have multiple MCs which im creating and storing them into arrays for access. Whilst I create these MCs, I am also putting bitmaps inside them. When I access my MCs later, I wish to access these bitmaps too - but I cant seem to write the syntax to reference them.
Code:
//within my loop
mcs[i] = this['mc'+i];
[code].....
View 5 Replies
Sep 8, 2004
Is there anyway to disable a parent MovieClip (mcName.enabled = false) but still allow it's child(ren) movieclip(s) to retain event handling?
View 2 Replies
Apr 30, 2010
trying to make this file work, in Flash CS4, using AS2. First some info on my file. I have 2 movieclips, mc1 and mc2. mc1 is in the first frame in scene1, it plays out for 138 frames, after which the scene darkens for 15 frames and then mc2 starts playing.
The problem is that I cannot get the timeline to stop looping after it moves onto to mc2. I have tried everything, I have a stop function in the last frame, stop functions within mc2. I even tried a gotoandStop(mc2_Frameno). Nothing works. It still keeps looping. When I extended the mc1 layer to the complete extent of mc2 layer, then it did not loop. But I don't want that as it is causing undesirable effects on the screen.
All I want is to play mc1 and mc2 one after the other, with no breaks. After entering mc2, the timeline needs to stop once buttons are loaded in mc2. But after loading the buttons, it moves out of mc2 and starts playing the timeline again.
View 4 Replies
Jun 1, 2010
This is probably an easy fix, but I obviously can't get it. Below is the actionscript to loop my movie clip, but once it's activated, I can't get it to stop. I thought it would stop at 3. Flash 8 (CS2).
on (rollOver){
for (i=0; i<=3; ++i){
audio_mov.duplicateMovieClip("audio_mov" +ii);
}}
View 11 Replies
Aug 26, 2010
I have a movieclip that as the function as a container with another movieclip inside and a motion tween.
I only want the inside movieclip to "play" it's animation once and not play it again and again and..... How do I control this?
View 5 Replies
Nov 16, 2009
I'm very new to Flash and after searching for a solution to looping a layer I understand this is best done by creating a new Movie Clip and creating the animation to be looped here. I've done this, and then placed the Movie Clip into a layer on the Scene... but it just won't play at all. It acts like I've placed just the symbol that shows in frame 1 of the Movie Clip and it remains static.
View 3 Replies
Mar 3, 2009
On my main timeline I define a variable and it works:
var totalpages:Number = 1;
trace(totalpages);
In a child movie clip I try to recall the variable and it
traces "undefined":
trace(MovieClip(parent).totalpages); or trace(totalpages);
they don't work.
View 5 Replies
Oct 5, 2009
There is a lot of code that I have but here is snippet to get to the point. I have created a Movicelip called via actionscript called "McButton". Then I created 10 MovieClips within that MovieClip ("McDot0", "mcDot1", etc). I need to know how to access mcButton.mcDot3 to change its color when button3 (mc already on stage) is clicked but can not figure it out.[code]...
View 2 Replies
Jan 21, 2010
I've created a class which displays a carousel menu , I've then instantiated this carousel class in another class, created a method to hide the carousel and a button to open / close the menu by setting the alpha to 0. Within the carousel object is the controls for rotation. The problem is when I compile and run and then click the button the carousel is made invisible along with the controls but when I press it again, the controls appear again but the carousel doesn't. Really stumped on this one,
View 6 Replies