ActionScript 2.0 :: Returning The Value Of A MovieClip's Children?
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
Similar Posts:
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
Jun 12, 2009
Is there a way to return the name of a movieclip which is being touched by the currently selected movieclip?I've got a variable called currentBall which is tracking a ball when placed inside a target zone (e.g. zone0_mc).How do I return the name of the target zone?
View 3 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
Jun 30, 2009
I am trying to return a movieClip to a project variable, so it can be retrieved outside of a function. However it fails.
I tried to simply set up a variable so when the function returns, it has a storage variable.
Then i tried for a function to retrieve the variable content
However when i call the trace(mc) it fails as undefined [code]...
View 1 Replies
Mar 20, 2011
I'm trying to construct a "getter" function in which a movieclip obtains it's childs current frame label, but for some reason I cannot get it to work.
Part of Block.as :
ActionScript Code:
public function getStatus(acs:String):String {
return (MovieClip(this.getChildByName(acs)).currentFrameLabel);[code]........
View 0 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 26, 2011
Ive embeded my game.as file as a movie clip into a new .fla which has 1 frame for the game, 1 frame for the win screen, 1 frame for the loose screen and 1 frame for the intro screen.
So at the end of the game I do MovieClip(root).gotoAndStop(myFrame);
where my frame is either the win screen or the loose screen frame.both screens have a playagain button that returns me to the game frame.Sometimes I get the error after the first win/loss sometimes I get it after I do play again and then when I win/loose.
the error is at:MovieClip(root).gotoAndStop(myFrame);
Im not exactly sure why or how to fix it though any tips?
View 3 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
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
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
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
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
Sep 12, 2011
How do I remove all children of a movieclip?
I tried
while(radar.numChildren > 0){
radar.removeChildAt(0);
}
but this causes the movieclip graphic itself to be removed.
View 3 Replies