ActionScript 3.0 :: Access Children Of Movieclip?
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
Similar Posts:
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 12, 2011
I have a Sprite called pageContent. Inside pageContent are 12 more Sprites with unique names, a couple of Buttons, and some TextFields. Inside each of the 12 Sprites I have either one or two TextFields and one TextInput. My question is, since they are children inside a child of pageContent, how can I access them? Here is how I am trying to do it:
[Code]...
In my mind, this should totally work. But surprise, surprise, it doesn't. I have debugged it and it works fine for the first two lines, but when it tries to get numChildren of a Child of pageContent (line 3), I get this error: PHP Code: 1119: Access of possibly undefined property numChildren through a reference with static type flash.display:DisplayObject.
View 4 Replies
Mar 10, 2010
I have a Canvas which has many components inside it and those again, have many components inside them.
getChildren() returns only the top level children. What is the best way to retrieve all the children (children of children of children and so on).
Well, I sorta know how to do this by iterating through the children, but the code is really messy. I'd prefer to use a nice recursive function. Has anyone written this before? Or is there a Util class to do this?
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
Feb 1, 2010
I have a simple class to create some buttons:
Code:
package {
import flash.display.*;[code]....
brings up "access of possibly undefined property" I do have other mcs etc within that container which don't have a ref but also trace (this.container.getChildAt(5).ref) doesn't work and I know number 5 is one of the ones that does have a ref.How do I use the ref to target the buttons.
View 2 Replies
Jul 25, 2011
I'm trying to access the childrens from an external swf previous loaded. This swf is a movieclip exported as swf which has two movieclips inside also.It loads the movieclip, but when I try to access to his childs, there is no one. What I'm doing wrong? I'm missing something when I export or load in AS3? I'm loading the swf as:
itemLoader = new Loader();
itemLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, itemLoaded);
itemLoader.load(new URLRequest("path"));[code].....
View 13 Replies
Feb 17, 2010
Does anyone know if its possible to access children elements in a SWC? I have created some MC's and inside of some of these MC's I have some dynamic textFields. I export the content to a SWC and load it into my Flex project. No problem loading it or accessing the parent elements, they display fine. But I want to access the textfields nestes in the MC's and modify the text. When I debug the app, I can see the textfields as child elements. It's typed as a TextField and the Instance Name is the same as input in the Flash IDE but I cannot access it. When Flex compiles it throws an error saying it doesn't recognize the method. I've tried to insert actionscript on the timeline, linked external classes and nothing can be accessed.
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
Nov 16, 2010
How do access all of the children of a DisplayObject using code? (I'm looking for something like movieclip.children)
I'm using this in two cases:
1) To loop through and reposition all of the children of an enclosing MovieClip.
Or
2) To loop through and delete all of the children of a MovieClip
View 3 Replies
Sep 8, 2011
I am trying to create an image gallery :
<card>
<product catalog="Thread Works">
<name>AK E001</name>
[Code]....
I can access the attribute, but if i am selecting "Thread Works" i want only access <product catalog="Thread Works"> with children node , for additem to array collection
View 3 Replies
May 22, 2009
I've got a Flex 3 application with an HTTPService returning an Atom feed. I catch the result from it and store it in an arrayCollection which is then the provider of my Datagrid. I have no problem accessing the data from the "first-level" of my Array, but cannot go under it. Not very clear, so here is some code:
My XML [part of it]:
<entry>
<title>Test 2</title>
<id>http://collaboration.*****.com/collaboration/messaging/feeds/****/todo//7D6637D3E86B3ED3C12575B***8479</id>
<link rel="alternate" href="notes:///C12575B4004***8
[Code]....
The "title" column shows the data correctly, but the status column is empty ! When I launch my app in debug mode, I can see that my notesArray has the correct format and I can access todo -> status with the value..
View 3 Replies
Feb 20, 2009
Trying to parse the following XML:
Code:
private var pbStr:String = ( <![CDATA[
<phoneBook>
[code]....
View 2 Replies
Dec 28, 2009
I'm trying to load a SWF I created with Flash CS4 into Flash Builder with the SWFLoader class, but I can't seem to access the loaded SWF's children. Everytime I try to change the property of a child it'll ignore it.
I tried loading the SWF with the Loader class, but it doesn't allow me to add it to the stage. How can I load the SWF and access it's children?My code atm (m is a child of the loaded SWF (SWFToLoad)):
ActionScript Code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
[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
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