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.

Tags: Adobe Animate

Similar Questions

  • How to access the child of the view object that is defined via the display link?

    JDeveloper 11.1.1.2 using:

    I defined the purpose of view 2 (ParentVO and ChildVO) and 1 notice link to specify the relationship between them.
    In the definition of link to view, I exposed the view of child object in the parent object from view with the name of the accessor "childlist is."

    In my module of the application, the data model contains the instances of the objects two view. The child view object instance has been added to the parent object instance see through display link

    I install the ParentVO to create both ViewImpl and ViewRowImpl classes and expose all accessor methods.
    But I can't find a get of the ViewRowImpl class method to access the ChildVO of the ParentVO.

    What is the right way to access the instance of ChildVO of ParentVO line line instance IE. ParentVORowImpl class?

    You should have a getEmployeesView method in the departmentsViewRowImpl class.

    You can try it with the HR schema and dept/emp tables to see if it works for you?

  • How to access the child of the Loader object

    It's a very simple thing I have a swf file try.swf and he have a little animation, I stop it's animation on frame of scenario 1

    and I use this code to load try.swf into another flash file...

    import flash.display.Loader
    import flash.net.URLRequest

    var ld:Loader = new Loader()
    var rq:URLRequest = new URLRequest ("try.swf")

    LD. Load (RQ)
    addChild (ld)

    now I try.swf load hv in ld Loader now I want when it loaded then try.swf well gotoAndPlay frame 2 and start showing animation... that's all...

    You'll need assign an event listener for the property contentLoaderInfo the loader to determine when the file is completely loaded.

    var ld:Loader = new Loader();
    var rq:URLRequest = new URLRequest ("try.swf");

    ld.contentLoaderInfo.addEventListener (Event.INIT, animateTry);

    LD. Load (RQ);
    addChild (ld);

    function animateTry(evt:Event):void {}

    MovieClip (evt.target.content) .gotoAndPlay (2);

    }

  • How to access the child object of a movieclip

    Hi, I made the pictures dynamically and I access Bastien is child movieclip

    var totalThumbs:Array = new Array()

    var ThumbMC:MovieClip()

    var childThumb:MovieClip()

    var xpos:Number = 10

    for (var i: Number = 0; i < 10; i ++) {}

    ThumbMC = new thumbOb() //thumbOb is the movieclip in the library class

    addChild (ThumbMC)

    ThumbMC.x = xpos

    childThumb = new animationclip() //animationclip is the movieclip in the library class

    ThumbMC.addChild (childThumb)

    ThumbMC.addEventListener (MouseEvent.Click, thumbClick)

    XPos += 100

    }

    function thumbClick(event:MouseEvent):void {}

    event.target.childThumb.gotoAndPlay ("clicked") < < THIS ERROR SHOWING

    }

    There are a number of errors in what you show so I have to imagine that you are not in strict mode minimum of coding.  You should avoid using event.target and event.currentTarget are using, otherwise you are likely to find the target, it's not what you expect it to be.  currentTarget is always linked to the object that has the assigned listening port, not children of that object (using target may end up doing).

    When you add dynamically content, targeting usual syntax parent.child does not work.  You start to use other means of access to the child.  One way is to store the child in another reference (like a table) and directly target.  Another way would be to use the getChildByName() method... Here is an example of using this approach...

    var xpos:Number = 10;

    for (var i: Number = 0; i<10;>
       
    var ThumbMC = new thumbOb();  thumbOb is the class movieclip in the library
    ThumbMC.num = i;
    addChild (ThumbMC)
    ThumbMC.x = xpos
       
    var childThumb = new animationclip() //animationclip is the movieclip in the library class
    childThumb.name = "childThumb" + String (i)";
    ThumbMC.addChild (childThumb)
       
    ThumbMC.addEventListener (MouseEvent.CLICK, thumbClick)
    XPos += 100
    }

    function thumbClick(event:MouseEvent):void {}
    var childThumb is MovieClip (event.currentTarget) .getChildByName ("childThumb" + String (event.currentTarget.num));.
    childThumb.gotoAndPlay ("clicked");
    }

  • 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 '.

  • How to access the class of an Actionscript object

    Hello

    I'm trying to access the class of an Actionscript object as the Java method getClass().

    example:

    I have this class with a method "myMethod(clazz:Class)".

    public class Class2
    {
         ... 
         public function myMethod(clazz:Class):void
         {
           ...
         }
    }
    

    This other class:

    public class Class1
    {
        var class2:Class2 = new Class2()
    
        public function otherMethod(obj:Object):void
        {
              class2.myMethod(obj.????);
        }
     }
    

    Perhaps is it not possible?

    Thank you

    vdelbart

    There is no native to retrieve method class of an object, but this utility function should work for you:

    import flash.utils. *.
    import flash.system.ApplicationDomain;

    function getClass(o:*, appDomain:ApplicationDomain=null): Class
    {
    If (o == null | is a class o) {return o ;}

    result: var class = null;

    Try
    {
    var cName:String = flash.utils.getQualifiedClassName (o);
     
    If (appDomain! = null)
    {
    try {}
    result = appDomain.getDefinition (cName) class;
    }
    catch (err2) {result = null ;}
    }
    If (result is nothing)
    {
    Result = flash.utils.getDefinitionByName (cName) class;
    }
     
    }
    catch (Err) {result = null ;}
    Finally {}
    return the result;
    }

  • How to find info for Missing Linked Smart Object

    I received a file from another vendor, and they have a layer of dynamic object bound within the photoshop file that is missing.

    Is it possible to determine the layer file name/path/owner? In Illustrator and InDesign, it's possible, but I see no way to determine any info on the link. I need to communicate to the seller, what lack us.

    Hello

    You do not get the missing link dialog box?

    Another place to look is in the properties panel with the targeted layer.

    Steve

  • How to remove a child in an XML object?

    Hey guys, I'm a new user for AS3. I did an xml object and add a few children. I use appendChild() to add a child to the XML. But if I want to delete one, what should I do? I tried to search in the reference, but I can not find a remove function.

    var questions: XML =

        
        
        
        
        
        

    ;

    function deleteNode(value:XML)
    {

    if(value==null) {return ;}
    If (value. Parent () == null) {return ;}
    delete value.parent () .children () [value.childIndex ()]
    }

    Example: To remove the third node (Id = 3)

    deleteNode (questions. Issue. (@Id is "3") [0])

    OR

    deleteNode (questions. Question [2])

  • How to access the info in my iCloud account

    How to access the info in my iCloud account?

    You can access much of the iCloud.com on a computer or through specific applications on your mobile device such as contacts, calendars, iCloud Drive, Photos. What exactly you were looking for and what type of device.

  • How to access the variable in the child video clip

    I have a flash file that uses php to manipulate a database and returns a variable (data_xml) to document data in XML from the database. In this case, as well as others within the parent company. Now, I have a child movieclip that shows analyzed data, but I'm unable to access the variable from the child movieclip. The code associated with this is:

    var myXML:XML = new XML();
    var myXML = XML (event.currentTarget.root.data_xml);

    and I get the following two errors that point to the second line as the problem:

    1151: there is a conflict with definition myXML in the internal namespace.

    WARNING: 3596: duplicate variable definition.

    I unchecked automatically "declare instances of the scene" because I have seen the one proposed for the 1151: error, but I still have not the same two errors.

    Can anyone help? Thank you!

    You've declared the variable twice. Variable can be declared only once in any scope. So, your code should be:

    var myXML:XML = new XML();
    myXML = XML (event.currentTarget.root.data_xml); Note there is no before var

  • How to access the parent mc data

    I load an xml file in the parent movieclip.

    How can I access this variable in its child movieclip?

    Is there a way to define a public property in flash as in flex?

    One way is to target the parent, with something to the effect of: MovieClip (parent) .that_variable

  • How to find the current MovieClip

    Hello

    I create a flash file to display the products.

    Images and Product Details are stored in the XML file.

    Is what I'm trying to create something similar to the banner on http://www.gainfeeds.com/home

    Add to this is that products are going to be right scroll to the left automatically if there is no user interaction, and produced at the Center will remain highlighted.

    I created a long strip of coverage of products with a mask, the long strip continues to move give a scroll effect.

    Now my question is how to find the product that is currently at the center of the mask?


    Thank you.

    Alok Jain

    No there is no default name assigned to them.

    If you take the parent video clip and with for you apply a getChildNum() method, do not exactly know the syntax, you can take the children of the parent in sales responsibilities. 0,1,2,3,4,... etc.

    But this isn't something that will help a lot because you don't know what this number is.

    For example, when you create the child movieclips, xml-based, I assume you are using a statement. So in this statement when creating each movieClip, fi do you something like "var m:MovieClip = new MovieClip();"also do the following"$m.name ="mc"+ i". ""

    You want to do this because the name "m" is valid only as long as the scope of the valid function is. Once the training starts again you loose any reference to the old "m" and a new one is created. So for future reference the movieClips outside the function that creates, you name them.

    After that you can call from anywhere (given that you set the path to access the parent corectly) like this: "parentMovieClip.getChildByName("m3")" If you want to target a third, or using any name you give in the creation of statement.

  • I don't have any encryption under the options tab. This can be corrected? If this is not the case, how could access it?

    When I go to Options on the Advanced tab, there is no encryption between update tab and certificates. How would access the encryption info?

    There is no encryption tab in current versions of Firefox.

    The current releases of Firefox no longer have a setting in the user interface to disable TLS or SSL3 and you must make the change on the subject: config page and edit two prefs.

    SSL3 is enabled by default in the current version of Firefox (security.tls.version.min = 0) and TLS to TLS 1.2 versions (security.tls.version.max = 3).

    You can change the preferences of security.tls.version.min and security.tls.version.max to define what TLS versions are enabled.

    You will need to close and restart Firefox after you change these prefs.

    security.tls.version.min = 0 (1 will disable SSL3 and only enable TLS)
    security.tls.version.max = 2 (0 will disable TLS 1.0 and higher, leaving only SSL3 enabled)
    
    0 means SSL 3.0, 1 means TLS 1.0, 2 means TLS 1.1, 3 means TLS 1.2 etc.
    
  • How to access objects collection

    How to access the collections of objects for example ReportSections report? I can access ReportSection, but not his collection...

    Reference: http://www.ni.com/pdf/manuals/372844e.pdf

    Maybe you don't understand exactly what section of the report is. According to the help:

    Use this class objects to store, update and transfer reports. You typically use the ReportSection objects to avoid creating copies of a report that the report is transferred between the generator of reports, process, Report and ReportView control object models. You can create a new ReportSection object by calling the Report.NewReportSection method. ReportSection objects can contain other ReportSection objects.

    As a general rule, a process template creates and updates the ReportSection object and assigns to the report object by setting the Report.ReportSection property.

    It has a sub-property called ReportSubsections , which specifies a reference to the ReportSections object, which is a collection that contains a list of child ReportSection objects to the current object. Looking at this object, it's a list of items that you can index through to get each.

  • How to access the data in the row (text of children) in a pragmatic control tree?

    In LabVIEW 2010, I entered the data in row a tree with pragmatism control using the Add item and providing the child text table and the child tag for the line. When a row in the tree control is selected, I can get the line label in the Value property of the tree. But how do I access the data in the child text table when the line is selected? I can't seem to find a tree control property or method which will return data back.

    What I'm trying to do is: once a line in a tree is selected and a button is pressed, if the line tag is valid, I want to transfer all the data in row in another tree the same formatting. For this I need the data for the tree line and the line that was selected. I don't find a way to get access to these data of the line when it was composed in the tree.

    Can someone tell me how to access pragmatically the child text or row data in a tree control from a selected line in the tree? I have the label of the line, but how do I access data?

    Thank you for your help.

    Looking through numerous examples, I found how to do this using the properties ActiveItemRow and ActiveColNum, but I can't find these documented properties anywhere using LabVIEW. Even research through aid could not do anything about them.

    Where these important parameters are documented?

    Why they do not appear in the help?

    Are there other ways to access the data in the row (child text) form a selected line in a tree control?

Maybe you are looking for