How to access the inside movieclip with AS3

Hello

I have a problem to access inside the movieclip I mean child MovieClip

the code is here

var myMovie:MovieClip = new MovieClip();

addChild (myMovie);

var myChild:Sprite = new Sprite();

myMovie.addChild (myChild);

var nextChild:Sprite = new Sprite();

myChild.addChild (nextChild);

now I want to acess the next child and I use following

(myMovie.myChild.nextChild) .addEventListener (MouseEvent.Click, onChildClick);

function onChildClick(evt:MouseEvent):void

{

trace ("last child is clicked");

}

Thank you

When you create dynamic content, using the notation by point does not work and you must use... getChild methods if you want to access it through the parents.  However, you should not need to do since you already have a direct reference to the object...

nextChild.addEventListener (MouseEvent.CLICK, onChildClick);

function onChildClick(evt:MouseEvent):void

{

trace ("last child is clicked");

}

You probably might have realized this when you implement this line (assuming it worked)...

myChild.addChild (nextChild);

With the approach of targeting parent, wouldn't you have tried to use... myMovie.myChild.addChild (nextChild);?

and 'Click' should be 'CLICK '.

Tags: Adobe Animate

Similar Questions

  • How to access the PDB (s) with multiple shared users?

    is it possible to access the PDB files with multiple shared users?

    Consider the scenario:

    I have two common user:-c# a PDB and c ##b:-PDBTEST

    I am facing problem:

    When I connect with the common user - c ##b, I am not able to see the table of PDBTEST created by connecting you with c# a.

    However, I have assigned rights in PDBTEST for both users c# a and c ##b.

    For the common c ##b user, is there another way, I can access PDBTEST?

    I'm following measures:

    Connect as sysdba

    1 > created two user c# a and c ##b (container = ALL)

    2 > common role granted with all privileges: c ##role (container = ALL)

    3 > assigned c ##role both user: c# a and c ##b (container = ALL)

    4 > created PDB: PDBTEST

    Changed session and containing value = PDBTEST

    5 > granted c ##role to two users: c# a and c ##b inside the PDBTEST

    6 > connect with c# a (and not as sysdba)

    Changed session and containing value = PDBTEST

    7 > table created and inserted record: TestTable

    8 > connection with c ##b (and not as sysdba)

    Changed session and containing value = PDBTEST

    I'm not able to access the record of "TestTable" after you connect with c ##b...

    Even more, if I connect with c# a, I can access inserted records.

    Help, please.

    Hi Big Boss,

    It has nothing to do with the PDB, it is just the works of oracle way - to query a table that belongs to another yo uhave to precede their schema name unless you do one of 2 things

    (1) create a synonym (public or private) for their purpose

    (2) use alter session set current_schema

    So in your case you'd be (both logged in as ##b c)

    (1) create synonym c# table_name #a.table_name;

    (2) alter session set current_schema = c# a;

    Now, if you say

    Select * from table_name as c ##b it will work.

    (1) is permanent

    (2) must be adjusted each time you connected

    I think you're confusing a pdb with a schema file.

    See you soon,.

    Rich

  • How to create the new MovieClip with front and rear images?

    I'm still a real newb... I'm unable to learn how to create a two-sided movieclip and load a different image on each side.

    Thank you!

    Mark

    You can't do that, but you can simulate it.  If you use a rotationX or rotationY you'd a displayobject that is not visible and the other is visible when you almost 90 degrees.

  • How can I nominate a MovieClip with as3?

    I'm trying to draw a set number of places in a presentation of type grid and pretty much getting it to do what I want. The problem is I want to be able to manipulate each square individually more later on, and I'm sure I need to assign each a unique instance... name something like "square_0_0" at the bottom "square_10_10" (this is a table of the 10 x 10 squares).

    In any case... How to assign a unique for each square instance name, as it is added to the stage? I have attached the code that I currently have running. Thanks in advance for any help you can offer.

    MovieClip have a name property that allows you to assign:

    Shape.Name = "shape_" c + "_" + r;

  • How to access the pci 9054 with labview

    Using pci9054 for communication, how can IAM I configure pci 9054 with labview.

    Thanks for your reply,

    I have 6 months experience in programming.

  • How to access the BIOS on a Pavilion Elite e9237c with mouse and keyboard wireless?

    I have a desktop computer Pavilion Elite e9237 with a wireless keyboard and mouse. I tried to access the BIOS by pressing F10 at startup with no luck, and I can't access any of the other menus for the start-up eiither. I don't have a PS/2 port on my computer, so I can't get a wired keyboard and mouse. Does anyone know how to access the BIOS with this configuration?

    I bought a USB keyboard and he answered in the same way... No bios access. I then studied why it did not work and discovered that it was the way in which he has been connected to the computer. I had initially plugged into a USB hub when he was not working and I moved it directly into a USB port and it works! I plugged my keyboard wireless directly into the USB port and it works too! Thanks for your help... I wouldn't have thought of it if it wasn't for to recommend you the USB keyboard.

  • How to access the tab 'Save all' when I close several jpeg files that have been adjusted with the "color adjust tool? He is currently making me close and save one at a time. Thanks for any help :)

    How to access the tab 'Save all' when I close several jpeg files that have been adjusted with the "color adjust tool? He is currently making me close and save one at a time.  I've just upgraded to El Capitan.  Thanks for any help :)

    I assume that you use the application overview.

    I can't find an answer to back up everything, but a workaround could be while the file menu options are visible, press the option key

    and the point of the window will become close, if you click on that dialogue will ask you if you want to restore the changes or save

    pressing Save will close the image with the changes and then move to the next image and so on.

  • Hi how to access the tutorial - with the Eagle?

    HI - how to access the tutorial - with the Eagle?

    It's here: create a video | Adobe first Pro CC tutorials

    There is also a newer version here: How to edit videos with Premiere Pro | Adobe first Pro CC tutorials

  • How do I access the folder allowed with standard user?

    I have 2 accounts, one is standard, the other is the admin account.

    My PC has a permitted record that only allow admin to access.

    I always connect with the standard user and sometimes need to access these files from parmitted, but no authorization for the standard.

    So, every time I change the user access. It's too boring.

    I tried the command runas, but does not...

    Please give me some advice that can access the folder allowed with the standard user, if possible.

    Thank you

    I have 2 accounts, one is standard, the other is the admin account.

    My PC has a permitted file that allow only to admin for access to.

    Please give me some advice that can access the folder allowed with the standard user, if possible.

    You must change the permissions of this folder so that everyone has full access.

  • How to access info child movieclip to an object in a table?

    Hello

    I created a whole bunch of clips dynamically.

    I gave a name based on a variable number to each item:

    MC. Name = "mc" + i;

    I also use addChild to add some dynamic text fields to each movieClip and named myText1 myText2.

    Then I push each movieClip object in a table:

    myArray.push (mc);

    When I have the movieClips addChild, they display fine, complete with each textField.  And if I use the following loop to find the name of each element of the array, I get:

    for (var i = 0; i < myArray.length; i ++)

    {

    trace (myArray [i]. (Name)

    }

    output:

    MC1

    MC2

    MC3

    MC4

    etc.

    What I want now is to be able to access text fields in each movieclip in the table.  However, I get errors when I try in different ways.  For example:

    for (var i = 0; i < myArray.length; i ++)

    {

    trace (myArray [i].myText1.Text);

    }

    gives error: a term is undefined and has no properties.

    How to access the values and the content of the children of the movieClip objects that are stored in the tables?

    Thank you

    Shaun

    For some reason, dynamically added children cannot be targeted like that.  If you have added the textfields dynamically, you may need to use the getChildByName() target.  It depends in part on how you created and whether or not you have direct access to them.  Aside from that, you can also assign the textfields to the variables that you create for the mc and target those who by their names of variables.

    These two approaches demos the following:

    var mc:MovieClip = new MovieClip();
    addChild (mc);

    var tf:TextField = new TextField();
    TF. Text = "this is the text";
    mc.addChild (tf);

    first way

    TF. Name = "tfield."
    trace (TextField (MC.getChildByName ("TField")). (Text);

    second way

    MC.tfid = tf;
    trace (MC.tfid.Text);

    You can also store the textfields in the tables are created and they have direct access to them with the need to target the mc... the index must be the same as the one you use for the mc anyway.

  • How to access the features of the APP from SessionBroker/UnitOfWork application?

    How to access the features of the APP from SessionBroker/UnitOfWork application (legacy TopLink APIs)?

    For example, how can I get similar APIs like em.createNativeQuery (managed object query return native) when you use the UnitOfWork API?

    Not JPA-coded on top of UnitOfWork or UnitOfWork on top of JPA?

    SessionBroker can an EntityManager is running?

    How can I execute JPQL via UnitOfWork?

    The answer would be no. We put only support flush multiples for the use of the APP.

    A more detailed inside the code look will show that we have actually created a RepeatabaleWriteUnitOfWork that offers extended support to match the requirements of the Joint Parliamentary Assembly. I have not tried using this subclass directly with our API native and the SessionBroker. I will review the developers to see what we believe, this is the best way forward for SessionBroker users looking to use JPA and our extended features associated with JPA.

    Doug

  • Re: Satellite Pro L450D - 12 X - how to access the recovery partition?

    Hello

    I've formatted Windows 7 with a Windows XP CD but did not setup. I wanted to know how to access the recovery partition to set it by default, everything exists on the laptop right now is Ubuntu, but I don't know, I saw an additional partition that must contain recovery files as laptop did not come with a recovery disk and unfortunately did not create a filter.

    How can I access the recovery partition on the laptop having in mind, I formatted the drive Windows 7 was installed on or should I activate or something like that?

    Any help much appreciated

    Hey,.

    On the second partition of your laptop (data partition), you will find a folder named HDDrecovery and it contains recovery files. The problem is that you can use the HARD drive only with the pre-installed operating system recovery feature. It would mean in your case it s too late now and it s not in use anymore.

    You have created the Toshiba recovery disc as mentioned in the user manual? If Yes, you can use this disk to restore to factory settings. Just boot from this CD and follow the instructions on the screen.

    If you don t have the recovery disc, you can order it here:
    https://backupmedia.Toshiba.EU/landing.aspx

  • HP pavilion h8-1230: how to access the bios pls help

    How to access the bios and I got windows 7 but to give birth to windos 10 with the thing free upgrade I got Pls Help

    Immediately after pressing the power button to turn on to start by pressing the F10 key.

  • HP Jet 8 5801 how to access the webcam

    I just bought HP 8 5801 stream, product number K5L4OUA. The card that I printed shows it has a front and a rear facing camera, but I can't find how to access the rear side.  The camera screen does not show how.

    Also, how can I return the default tablet.

    Hello mlmarsh2,

    To access the front camera, will be the camera is on and showing the live mode view, wide upward from the bottom and you will see a taskbar with the option 'change Camera.

    I see another post, that you have created that you had difficulty with some applications uninstall.

    To restore Windows to factory, off the shelf.

    Hold down the power button and the Volume button simultaneously for a few seconds.

    A screen lights up showing some options.

    Choose F11 for the system recovery option and follow the prompts.

    Hope that helps.

    PS: If this is the first time you used a Tablet, you may prefer the traditional workstations such as Windows 7 has. You can install Classic Shell Setup on the tablet of flows for the old office and it will work as well as it does on a tower or laptop.

  • Multiple column trees: how to access the data in columns? There is a bug?

    Hello

    I have a strange problem. I use tree column multi like this:

    In this case, I have the tree column and two other custom columns.

    Now, how to access the data in the SECOND column?

    We can write all the data in a row thanks the EditElementTree:AddElement:ChildText, because it is an array of strings.

    However, when I want to read the data, I use ActiveCelltring, meaning that a SINGLE string and not a string table oO (so I only have the value of the first column and never others.

    So, I can do what I want? Is this a bug?

    Thank you very much

    R0b1n

    OK, I have the solution.

    We play with the ActiveColumnNumber attribute, to read the values of different...

    I left the message, it may be useful for later someboby

    R0b1n

Maybe you are looking for

  • Phishing and e-mail header

    Afternoon, With the recent phishing epidemic taking over the business world and 40% of all email communications being open all first through phones. I want to know how to show an e-mail address instead of just the name of the person. In this way user

  • background image to swap?

    Hello I'm looking for a possibility to dynamicaly change the background image of a vi. See attached example: the switch should change the image of the circle in an area of the image. the two images are superimposed and I thought I could make a visibl

  • Streaming with SMU-6544

    I'm at the stage of planning for a system using cards SMU-6544.  I have not yet material.  I want to constantly stream my generation and acquisition and compare real-time software.  I want to be able to run the minutes, hours, or days, and be able to

  • Type of interface VI

    In file attached to control 'Spec Type' all fields are null. How can I change to type what I want (for example some of the field I want to be a 'cluster of error', some "Instrument handle"). In other words, how to change 'Spec Type' in 'Type Spec 2 "

  • Vista 64-bit: Windows Live update fails repeatedly, no other update fails

    I get error Windows Update 80246007 every time try to update Windows Live Essentials 2011 KB2434419 and BITS has already been fixed correctly. No other Windows Update has failed. Someone at - it suggestions? Thank you.