Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / General Flash Topics / July 2008



Tip: Looking for answers? Try searching our database.

Loaded SWF & hitTest

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
scottgroovez - 08 Jul 2008 14:37 GMT
Hi,

I have a problem with loaded SWF's and hitTests that use X & Y. We're using
content that originally was loaded into a Shell SWF at 0,0. All hitTests worked
fine.

Now we're creating a new project where this content loads in a window area
that is not at 0,0. Because hitTest using X & Y uses the Global scope these
hitTests now do not work.

Is there a solution to making the hitTest use the scope of itself? I've tried
_lockroot but this didn't solve it. Or is there another solution?

Regards,
Scott:confused;
David Stiller - 08 Jul 2008 14:50 GMT
Scott,

> Now we're creating a new project where this content loads in
> a window area that is not at 0,0. Because hitTest using X & Y
> uses the Global scope these hitTests now do not work.

   The MovieClip.hitTest() method doesn't really depend on scope -- unless
I'm misunderstanding your use of the word -- but you might be facing an
issue that could be addressed with the MovieClip.localToGlobal() or
globalToLocal() methods.

> Is there a solution to making the hitTest use the scope of itself?
> I've tried _lockroot but this didn't solve it.

   The MovieClip._lockroot property, when set to true, instructs a loaded
movie clip to interpret any references to _root (in its own code, that is)
as if it *hadn't* been loaded into another SWF.  It doesn't really affect
the placement (x and y values) of visual objects on the stage.

David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."
scottgroovez - 08 Jul 2008 19:52 GMT
Hi David,

I managed to get it sorted. Had to use localToGlobal() as you suggested to
work out an offset of the loaded SWF in relation to the parent shell. Not only
that but the loaded SWF was being resized so had to take that into account when
doing the calculations.

Cheers,
Scott
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.