A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: for looping dynamic movieclips getChildByName() onEnterFrame HELP!! PLEASE!!

  1. #1
    Flash Developer
    Join Date
    Feb 2006

    Unhappy for looping dynamic movieclips getChildByName() onEnterFrame HELP!! PLEASE!!

    Hey All. Thanks for reading..

    I built something some time ago in AS2 and now I'm trying to convert it into AS3, but I can't get a
    hold of the dynamic movieclips; I keep on getting errors. Here is the original script in AS2:
    this.onEnterFrame = function() {
         for (var i = 0; i<10; i++) {
              var xxm:Number = this["mc"+i]._xmouse;
    And I've been trying it a number of different ways in AS3, but can't get it - either wrong or errors..
    I've tried things like:
    this.addEventListener(Event.ENTER_FRAME, test);
    function test(event:Event):void {
         for (var i:uint = 0; i<10; i++) {
              var xxm:Number = MovieClip(this.getChildByName("mc"+i)).mouseX;
    But like I said... not working out...
    Please help - how do I do this?

  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Could first explain what you are trying to do there. I'm not really good when it comes to guessing and I'm too tired at the moment to understand what you're trying to do there.

    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |

  3. #3
    Flash Developer
    Join Date
    Feb 2006
    put the mouseX value relavant to 10 different dynamically created movieclips into a variable that will then be used to calculate something..

  4. #4
    Join Date
    Jan 2008
    Assuming you do something with xxm after you calculate it, like store it in an array for use later, I don't see what's wrong with the AS3 code. Putting it in my own movie with ten "mc"+i objects on the stage worked just fine. Also, why are you putting the getChildByName inside MovieClip(...)?

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