Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-13-2011, 01:22 PM   #1
geuz
Registered User
 
Join Date: May 2011
Posts: 12
Default [AS3] hitTestPoint() not working in Browser

Hi,

I'm suing hitTestPoint() in a game to determine if the character is standing on the floor. If it's not, hitTestPoint() with the floor returns false and I apply some gravity, making the char fall down.

This works when I run in Flash Professional.

But in the browser it doesn't. The character falls endlessly, because hitTestPoint() keeps returning false.

I outputted all the coords I'm using in hitTestPoint() and they are the same in Flash and in the browser.

I tried making the floor higher and made more space between the char and the floor. In Flash the char falls until it reaches the floor, like it should be, in the browser it goes all the way down through the floor and still falling...

Any ideas?

Last edited by geuz; 11-13-2011 at 01:31 PM.
geuz is offline   Reply With Quote
Old 11-13-2011, 01:28 PM   #2
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

hmmm, can the movie clip be visible? And instead just lower the alpha? 0.0 for the alpha, and yet it should still 'be there'
__________________
www.actiontad.com - ActionScript and JavaScript sitting in a tree...
tadster is offline   Reply With Quote
Old 11-13-2011, 03:44 PM   #3
geuz
Registered User
 
Join Date: May 2011
Posts: 12
Default

Tested visible and invisible - same.

I made a test using hitTestObject() instead of hitTestPoint(). That works in the browser.

Maybe the coordinate system used in the browser is somehow different? As I said in my other post the values of the coordinates used in hitTestPoint() are equal in both cases, but maybe they refer to different positions on screen, or something??

Last edited by geuz; 11-13-2011 at 04:04 PM.
geuz is offline   Reply With Quote
Old 11-14-2011, 01:07 PM   #4
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

Is the swf in the browser loaded into another swf first?
__________________
www.actiontad.com - ActionScript and JavaScript sitting in a tree...
tadster is offline   Reply With Quote
Old 11-14-2011, 02:52 PM   #5
Poony
Senior Member
 
Poony's Avatar
 
Join Date: Aug 2011
Location: Sweden
Posts: 390
Default

What method are you using to embed? Are you allowing the swf to scale according to the browser window? If you are, that's probably whats causing you this problem.

Check out globalToLocal..
Poony is offline   Reply With Quote
Old 11-14-2011, 04:30 PM   #6
Darksydaz
Senior Member
 
Join Date: Dec 2008
Location: The land that never was
Posts: 113
Send a message via AIM to Darksydaz Send a message via MSN to Darksydaz Send a message via Yahoo to Darksydaz
Default

Please post portion of code, i'm doing a platformer, i might be of some assistance...
Darksydaz is offline   Reply With Quote
Old 12-06-2011, 05:11 PM   #7
geuz
Registered User
 
Join Date: May 2011
Posts: 12
Default

Hi.
Thank you all for the anwers.
I did a workaround for this using hitTestObject() instead of hitTestPoint(). I didn't have time to investigate more the problem with hitTestPoint()... maybe I give an update of this later...
geuz is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:32 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.