A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Flex MC naming and parinting

  1. #1

    Flex MC naming and parinting

    Can someone point me in the right direction with a tutorial or a quick explanation. I would like to make a MC (MC1) give it a name so I can referencing it latter. I would like to then make a second MC and make it a child of the first MC and give it a name latter. and be able to delete a MC latter from it's name.

    Thanks.

  2. #2
    imagination through stupidity
    Join Date
    Apr 2001
    Location
    P3X-3113
    Posts
    1,238
    Here is the thing. DisplayObject.name is difference from the Instance Name as defined in the Properties panel. Instance name is the same as adding this code var INSTANCE_NAMEisplayObject = this.getChildById(0); You cannot do this.getChildByName( INSTANCE_NAME ) because it won't return the object.

    I'd say

    var d1isplayObject = new DisplayObject();
    d1.name = 'my obj name';
    var d2isplayObject = new DisplayObject()
    d2.name = 'my obj name 2';
    d1.addChild(d2);

    you can then call by name.

    this.getChildByName('my obj name').removeChild(this.getChildByName('my obj name').getChildByName('my obj name 2') );

    if that makes any sense.
    Nothing to see here, move along.

  3. #3
    Thanks Sybersnake

    I think I get what your saying you just have to make it a DisplayObject or you cant reference the name. I will have to put this into practices right away.


    I see people using the world "this" but when I use "this" in my second AS file it will not work in any of my functions. I use to use it all the time in AS 2.0 and before but getting flex and just a AS Project to recognize it on any of the Secondary AS files that isn't my Main.AS doesn't work they only way I could get it to work is using a variable that is = to "this". maybe this DisplayObject and building from one MC or Sprint will work?

    so out of my element wish I wouldn't have stooped using AS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center