Flash - Detecting Movement Outside of Stage in SWF Embedded in HTML

I'm trying to make a map using Flash MX that will be embedded in a web page.  The problem I'm having is with the maps movement.

Here's a sample of what I'm trying to achieve:
http://maps.mapnetwork.com/floridakeys/cvb/index.asp

Notice that you can move the map around.  You can still move the map when the cursor is in the white part of the screen.  The map will stop moving when you release the mouse outside the stage too.

My map, it doesn't do that.  

If I use startDrag() to start dragging on mouseDown and release outside of the stage, stopDrag doesn't work.  

Only thing I can think of is that Flash isn't detecting these mouse movements, and maybe they are passed in using FSCommand.

Can anyone give me some guidance?
LVL 5
ocgstylesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dushan De SilvaTechnology ArchitectCommented:
You can simply implement more advance thing with Goole maps.
Checkout
www.google.com/api/maps

If you need more info about that, don't hesitate to reply to me.

BR Dushan

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dushan De SilvaTechnology ArchitectCommented:
sorry link is..
www.google.com/apis/maps
Aneesh ChopraCommented:
see where you have written "stopDrag()"

it must be inside, onRelease....


just add "onReleaseOutside" also

for example:

if you have written it on button, add releaseOutside as shown below
--------
on (release, releaseOutside) {
      stopDrag();

}
-------------

if code is written on frame,then add onReleaseOutside as shown below
----------
button.onRelease = button.onReleaseOutside = function(){
      stopDrag();

}
----------


Rgds
Aneesh
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ocgstylesAuthor Commented:
forgot about that...
that may work for one half of it.  i'll elaborate.

i am coding two ways to move the map.
  1) using startDrag() and stopDrag()
  2) using a "controller" movieclip to detect mouse movement.  the controller will move the map using fancy acceleration etc.

so the releaseOutside should work for the first method.  

only problem is the controller uses onClipEvents (mouseMove, mouseDown, mouseUp) to detect the mouse state.  When I leave the stage, the code for onClipEvent(mouseUp) is never called.  

here's a sample of the map:
http://www.modunique.com/ee/map.html

Aneesh ChopraCommented:
then, you should use the "release, releaseOutside" event instead of "mouseup"

there will not be much change....

just change the event declaration with following

replace this:
----------
onClipEvent(mouseUp){
--------

with:
-------
on (release, releaseOutside) {
------

Rgds
Aneesh
ocgstylesAuthor Commented:
i thought using on(release, releaseOutside) will turn the movieclip into a button.  i thought that because the cursor turns into a hand.  will the other events (enterFrame) still work after attaching the on(...) event handler?  i'll have to give that a try...

Aneesh ChopraCommented:
if you dont want the cursor turns into a hand..

do this..


if your btn instance name is "btn"

write the following code on frame..(not on button)
-------------
btn.useHandCursor=false;

btn.onRelease=btn.onReleaseOutside = function(){
 stopDrag();
}
---------------

now cursor will not change to "hand"

Rgds
Aneesh
ocgstylesAuthor Commented:
i think the google maps suggestion may be a good idea.  looking into that...
Aneesh ChopraCommented:
google maps are not done in flash.

Have you tried my suggesion, it work pefectly..

Rgds
Aneesh
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.