Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 7 of 7

Thread: getChildIndex()

  1. #1


    I'm trying to do something based on the index of the object that gets clicked on...


    this doesn't seem to work, the compiler gives an error that I'm trying to implicitly coerce values.

    I know this is possible, I've heard people talking about doing this...

  2. #2
    OK, well If you have ever read a post by me you know this is normal but I just found the answer.

    getChildIndex(DisplayObject(event.CurrentTarget)) works.

    I guess it's good that it's in the forum now because when I searched before posting this there was nothing...

  3. #3
    Have u tried this

  4. #4
    I suppose whats happening is, as the event.target object of the event dispatcher is a general object (?), i.e. defined lossely, so in order to use display object methods you first need to cast it back to displayobject or one of its subclasses if you know which the target would be.

  5. #5

    maybe this could work?

    if you named the child could you not put : getChildIndex(event.currentTarget.name);

  6. #6
    TheCanadian's Avatar
    Noo doot aboot it, eh?
    I'm sure mattrock appreciates your wrong answer to his 4 year old question which he himself answered correctly 10 minutes after posting it . . . 4 years ago
    Proud Montanadian
    We tolerate living and breathing. And niches.

    Name Brand Watches

    Maybe getTimer() or TweenMax is the answer to your problem . . .

  7. #7
    I know I do.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012