• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

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?
0
ocgstyles
Asked:
ocgstyles
  • 4
  • 3
  • 2
2 Solutions
 
Dushan De SilvaCommented:
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 SilvaCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now