A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: targeting dynamically-created movie clips

  1. #1
    Registered User
    Join Date
    Apr 2001

    targeting dynamically-created movie clips

    Okay, here's the deal, maybe some of you can offer some advice. First, a bit of background:

    I'm creating a small application that dynamically creates movie clips, and those movie clips dynamically create their own. Sounds more confusing than it is, but my whole point here is that hard-coding the path in the code isn't going to "cut the mustard", if you will.

    SO, inside this movieclip I want to target a subitem and edit properties (rotation, x and y, size, etc) via a series of buttons. Right now I have a variable located in the parent called cur_item. when I click on a subitem, I tell it the following:

    _parent.cur_item = this;

    Which then gives the parent variable a nice long name, something like _level0.instance_2.item_0, where item_0 is the correct name, so that part checks out.

    Where I have the real trouble is in my buttons. The button exists on the parent layer (same as the cur_item variable). I have this script on the button:

    on (release) {
    this[cur_item]._rotation += 15;

    When I test the movie and hit that button, the ENTIRE movie rotates 15 degrees!!! I have no idea why that happens. Do any of you?

  2. #2
    iguanagirl32 mraspiller's Avatar
    Join Date
    Jul 2002
    I don't think you can use "this" in your variable as it is a reserved AS word...

  3. #3
    Registered User
    Join Date
    Apr 2001
    I was trying to use it as an AS word. Basically what i want it to say with
    this[cur_item]._rotation += 15


    "In this movieclip, find the instance represented by this variable, and change it's rotation."

    I thought this[variablename] was the method used to target an instance through a variable name. Am I wrong?

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