dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Noobish question about targeting movieclips in AS3

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    1

    Noobish question about targeting movieclips in AS3

    I'm experienced AS2 veteran who needs quick migration to AS3 so I need to know if there is some better solution to call movie clip inside of other clip than "getChildByName". When I manually create movie clip ("clip_1" for example) on the stage using flash IDE and place another movie clip ("clip_2") inside of first one I can call clip_2 via dot between objects: clip_1.clip_2.x=100. But if I wanna do this dynamically I will have to create new library item and give it "clip_2" linkage (class name) so it will be this way:

    clip_1 = new MovieClip();
    clip_1.addChild(new clip_2);
    clip_1.getChildAt(0).name='clip_2';
    clip_1.getChildByName('clip_2').x=100

    so is there another way of calling dynamically created (nested) movie clip then 'getChildByName'? Also I need to know if it is possible to name new clip instance created via addChild() during its creation. Something like clip_1.addChild(new clip_2,"clip_2")?

  2. #2
    Member
    Join Date
    Aug 2003
    Posts
    70
    As a first step to start the migration I think you should read:
    http://www.senocular.com/flash/tutor...3withflashcs3/

    It's a lot of reading but will get you a solid understanding of how things are done in AS3.

    Regards,
    Eddie

  3. #3
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    As long as you are within the same function you don't need to use getChildByName:

    clip_1 = new MovieClip();
    addChild(clip_1);
    clip_2=new MovieClip();
    clip_1.addChild(clip_2);
    clip_2.x=100;
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

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