A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Stringing names on the hitTest actionscript

  1. #1

    Stringing names on the hitTest actionscript

    I was wondering how to string the MC names in the actionscripting for hitTest... for example i have this:

    onClipEvent (enterFrame) {
    if (this.hitTest( _root.object ) {
    _root.play()
    }
    if (this.hitTest( _root.object2 ) {
    _root.play()
    }
    if (this.hitTest( _root.object3 ) {
    _root.play()
    }
    }


    can i make the MC name object a part of a string in the actionscript above? any help is great!!


  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    onClipEvent (enterFrame) {
    for (i=0; i<3; i++) {
    if (this.hitTest( _root["object"+i])) {
    _root.play();
    }
    }
    }

    like this you mean?
    only flaw is your first object will be called "object0" not just plain "object"

    gparis

  3. #3
    thanks! it works!

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