A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [F8] HitTest Question

  1. #1
    Member
    Join Date
    Mar 2004
    Location
    london, england
    Posts
    41

    [F8] HitTest Question

    Hi There, not sure if this is simple or complex but..

    I have a movie clip which grows upwards when a certain area of the stage receives onRollOver, and for various reasons I had to use a mask with the movie clip underneath it. I also had to use hitTest instead of onRollOver, and now the problem I have is that the hitTest activates even under the mask.

    I have tried everything and would rather not add more complex code to my script to add another hitTest to hide my original hitTest, does anyone know a simple way to kill hitTest in a certain area?

    Thanks in advance,

    Toby

  2. #2
    Member
    Join Date
    Mar 2004
    Location
    london, england
    Posts
    41
    update..

    okay, functionality is better now - I have a single hitTest that checks if the mouse is 10px or less from the edge and closes the menu if hitTest is true.

    It works perfectly unless you move the mouse really quickly, in which case the hitTest doesn't apply. I figured this would be okay so long as the menu closed after a couple of seconds, so I added setInterval if hitTest on the menu itself was false, but it still doesn't work - the actionscript seems unable to check mouse position at all if the mouse is not somewhere in the flash player.

    Is it me or is this a really basic problem? I've not noticed any usability flaws in other complex flash movies I've seen..

  3. #3
    Member
    Join Date
    Mar 2004
    Location
    london, england
    Posts
    41
    another update, if anyone is still listening..

    I created a test using only actionscript - there are no movie clips or images, just a single mc created using actionscript and a hitTest, and it STILL doesn't work.
    I've tried fiddling with updateAfterEvent() and higher FPS, but ultimately I can only assume this is a glitch in flash where code is ignored after the mouse moves a certain speed.

    If anyone has a workaround for this, I'd sure love to hear it.

  4. #4
    The Flash AS Newb
    Join Date
    May 2006
    Location
    Australia
    Posts
    179
    seems like you should use an easier method like on the action script of the frame have

    Code:
    MC.onRollOver = Function () {
    //What you want to happen on rollover
    }
    Mc.onRollOut = Function () {
    //What you want to happen on rollout
    }

    that should work for what your suggesting.
    Last edited by kriogenic; 02-11-2007 at 11:34 AM. Reason: typo

  5. #5
    Member
    Join Date
    Mar 2004
    Location
    london, england
    Posts
    41
    Hi, thanks for the reply..

    I started with onRollOver, it suffers from basically the same problem, that if you mouseOut too quickly and leave the flash stage the mc get stuck in the "on" position. Also, the menu itself uses RollOvers for it's buttons.

  6. #6
    The Flash AS Newb
    Join Date
    May 2006
    Location
    Australia
    Posts
    179
    Lagged and made 2 copies please delete.
    Last edited by kriogenic; 02-11-2007 at 12:44 PM. Reason: double post

  7. #7
    The Flash AS Newb
    Join Date
    May 2006
    Location
    Australia
    Posts
    179
    Hmm there is a hard way around it wich the way i see it could be to use a set interval to see if it is rolled over like on rollover have a variable rolledon = 1 then when you roll off have = 0 then to make sure it always works have a set interval that detects if its 0 or 1 and if after 30 seconds set it to 0 and if there mouse IS still over it the rollover command should activate again keeping the menu open or reopening it this can sometimes make the flash movie look laggy or buggy if it jumps around too much.

  8. #8
    Member
    Join Date
    Mar 2004
    Location
    london, england
    Posts
    41
    Hi, thanks again..

    I did actually try a setInterval, although not the way you describe..

    I set it so that it is part of the hitTest - if hitTest = true, activate menu and setInterval, then check every 2 seconds if hitTest is still true, if not then de-activate menu. I've found this doesn't work either - if you mouse out and the mouse out itself doesn't de-activate the menu, then Flash for some reason doesn't close the menu. I have no idea why, but I verified it with trace commands. RIght now my best solution is to increase the area of flash stage around the menu to give flash a better chance of detecting the rollOut.

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