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?
 
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
0
 
Dushan De SilvaTechnology ArchitectCommented:
sorry link is..
www.google.com/apis/maps
0
 
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
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
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

0
 
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
0
 
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...

0
 
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
0
 
ocgstylesAuthor Commented:
i think the google maps suggestion may be a good idea.  looking into that...
0
 
Aneesh ChopraCommented:
google maps are not done in flash.

Have you tried my suggesion, it work pefectly..

Rgds
Aneesh
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.