A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Placing MC's Dynamically onstage

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    7

    Placing MC's Dynamically onstage

    Hey Guys,
    In need of some help.

    I’m Trying to place MC’s dynamically from the library using buttons that are onstage into a container MC placed on stage at run time using addChild.
    My problem is on the placement of the MovieClips within the container MC after the user has clicked the appropriate button(s).

    What I’m looking for is a way that I can register when a mc has been placed within the container mc onstage, so when a new mc is placed in the container it offsets the placement on the y axis.
    I’ve have tried using conditional ‘if’ statements etc but nothing seems to work as it should, especially when there might be 20+ buttons placing 20+ mc’s

    So my question is….does anyone know of any tutorials that might help me with a solution.

    Cheers

    Russ

  2. #2
    aidanmack.co.uk
    Join Date
    Dec 2001
    Location
    York, UK
    Posts
    400
    Hi Russ,


    Something like this might help... Listens for when a clip has been added to the stage...


    var test:MovieClip = new MovieClip();

    function checkForItem(evt:Event):void{
    trace("this had been added");
    };
    test.addEventListener(Event.ADDED_TO_STAGE, checkForItem);

    addChild(test);

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