A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Controlling a movieclip added whit addChild()

Threaded View

  1. #1
    Member
    Join Date
    Oct 2000
    Posts
    43

    Controlling a movieclip added whit addChild()

    Hi:

    In my library I have a symbol.

    This symbol class is:

    xmx

    I export this symbol for actionscript.

    I export this symbol in the first frame.

    In the main time line i have a movielcip named: mc_mask

    Inside mc_mask I use this code to duplicate "xmx" movieclip inside "mc_mask" moveclip:

    * * * * * *
    BEGIN CODE
    * * * * * *
    var x_pos:int = 0;
    var y_pos:int = 0;

    var i:int;

    for(i=1; i<6; i++)

    {
    var new_img:xmx=new xmx();

    new_img.name="pic"+i;
    // set a name for the new movieclip

    new_img.x= x_pos;
    // set x position for the new movieclip

    new_img.y= y_pos;
    // set y position for the new movieclip

    x_pos += 20;
    // increment in 20 pixels the x position for the next movieclip

    addChild(new_img);
    }


    * * * * * *
    END CODE
    * * * * * *


    It works. It duplicates "xmx" movieclip inside "mc_mask"

    But..............


    I CAN NOT control the movieclips inside mc_mask...


    I have tried:

    a)
    mc_mask.pic1.alpha = .1;

    and does not work....


    b)
    mc_mask[pic1].alpha = .1;

    and does not work....


    c)
    mc_mask["pic1"].alpha = .1;

    and does not work....


    c)
    mc_mask['pic1'].alpha = .1;

    and does not work....

    d)
    pic1.alpha=.1;

    and does not work....

    Whe I publish my movie appears this error message:

    Error #1010: A term is undefined and has no properties



    How can I controll the movieclips CREATED WITH ACTION SCRIPT that are inside another movieclip?


    If I MANUALLY put an instance of "xmx" movieclip inside "mc_mask" movieclip and assign an instance name (for example pic1), I CAN CONTROL IT with:

    mc_mask.pic1.alpha = .1;

    But i want to add the "xmx" movieclip using ACTIONSCRIPT...


    Thank You in advance
    Last edited by albegago; 06-26-2009 at 11:19 PM. Reason: correction

Tags for this Thread

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