A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Nested hitArea problem

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Location
    New Hampshire
    Posts
    14

    Nested hitArea problem

    Could someboby give me the right syntax for setting the hitArea of a graphic as follows:
    Obj_A and Obj_B are nested inside Obj_C and Obj_D is on the main stage. I want Obj_C's hit test to be true when (only) Obj_A hits Obj_D.

    I hope this is clear, I tried to simplify this as much as possible.
    This is the line I am presently using but Obj_C's hit test is true when either Obj_A or Obj_B hit Obj_D.

    _root[Obj_C[i]].hitArea=_root[Obj_C[i]]+"."+[Obj_A[i]];

    Thanks

  2. #2
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    This example has two clips(Obj_a,Obj_b) inside Obj_c clip on the main stage.
    Obj_d is a single clip also on main stage.

    code:
    Obj_c.onEnterFrame = function() {
    if (this.Obj_a.hitTest(Obj_d)) {
    trace("hitting");
    }
    };


  3. #3
    Junior Member
    Join Date
    Oct 2006
    Location
    New Hampshire
    Posts
    14
    Thanks, this worked perfectly.

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