A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Hittest Question

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    Hittest Question

    I cant figure out how to use getbounds, might be because im tryed, so any hoo, i have a huge freaking long hittest and i porably could half its length if i use getBounds (I know how it does, i just cant get the sytax right).

    Could someone please translate this for me to work useing getBounds.
    Hero._x+Hero._width/2, Hero._y+Hero._height/2,

    Cheers
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    getBounds takes a movieclip as a parameter and returns min and max values for x and y. What exactly are you trying to end up with?
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    Senior Member
    Join Date
    Jul 2005
    Posts
    113
    Not exactly sure what you are trying to achieve either, but this might help:

    hitTestBounds = function(mc, targetMc) {
    var bounds:Object = mc.getBounds(targetMc);
    mc.yMin = bounds.yMin;
    mc.yMax = bounds.yMax;
    mc.xMax = bounds.xMax;
    mc.xMin = bounds.xMin;
    }

    hitTestBounds(Hero, targetMc);
    var x = (Hero.xMin + Hero.xMax)/2;
    var y = (Hero.yMin + Hero.yMax)/2;

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