Results 1 to 7 of 7

Thread: getChildIndex()

  1. #1

    getChildIndex()

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

    getChildIndex(event.currentTarget)

    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
    Code:
    event.target.parent.getChildIndex(event.target);

  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
    10,250
    posts
    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

 Credits

Copyright 1999 - 2012