Jump to content
Search Community

antelopeb

Members
  • Posts

    3
  • Joined

  • Last visited

antelopeb's Achievements

0

Reputation

  1. You're the man! It actually works when zoomed in as well, and I'm working on getting it to zoom into where the map is located now. You helped me realize a problem, though, in that my map was positioned incorrectly in the movie clip. In other words, it was physically centered rather than having the upper left corner at the little cross. I'm used to being in things like Illustrator and InDesign so I wasn't thinking about coordinates being generated, and since a bunch of the movieclip coordinates were coming back negative it was screwing everything up!! I think I can figure out the rest, though, thanks!
  2. That is the full code for the pan... Really, that's everything (except the line that imports the needed libraries, I guess). No variables, nothing else. MainMap is the movie clip I'm trying to pan, it's an imported .ai file of a map, so I already have a zoom in place using TweenLite and relative values as well as a legend and a detail that you can open and close (only close is functional right now). I'll paste my full code below: import fl.video.VideoEvent; import fl.controls.Button; import flash.display.*; import flash.events.*; import com.greensock.*; stop(); DowntownInstance.visible=false; DowntownClose.visible=false; LegendClose.addEventListener(MouseEvent.CLICK,LegendCloser); function LegendCloser(event_object:MouseEvent) { LegendInstance.visible=false; LegendClose.visible=false; } DowntownClose.addEventListener(MouseEvent.CLICK,DowntownCloser); function DowntownCloser(event_object:MouseEvent) { DowntownInstance.visible=false; DowntownClose.visible=false; } ZoomIn.addEventListener(MouseEvent.CLICK,ZoomInFunction); function ZoomInFunction(event_object:MouseEvent) { TweenLite.to(MainMap,1,{scaleX:".35",scaleY:".35"}); } ZoomOut.addEventListener(MouseEvent.CLICK,ZoomOutFunction); function ZoomOutFunction(event_object:MouseEvent) { TweenLite.to(MainMap,1,{scaleX:"-.35",scaleY:"-.35"}); } //dragging map around functions MainMap.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag); function beginDrag(e:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_MOVE,moveMC); stage.addEventListener(MouseEvent.MOUSE_UP,endDrag); } function endDrag(e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_MOVE,moveMC); stage.removeEventListener(MouseEvent.MOUSE_UP,endDrag); } function moveMC(e:MouseEvent):void { TweenLite.to(MainMap,.5,{x:mouseX,y:mouseY}); e.updateAfterEvent(); }
  3. Total newbie, so I apologize if I'm a dumb-a and I just missed this subject somewhere else... I'm trying to build something that can zoom in and pan on a large image. When I zoom in and then try to pan around it re-centers the movie-clip on the mouse location. How can I get it to pan based on the mouse coordinates without re-centering?? Any help is appreciated. Here's my code for the pan: MainMap.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag); function beginDrag(e:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_MOVE,moveMC); stage.addEventListener(MouseEvent.MOUSE_UP,endDrag); } function endDrag(e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_MOVE,moveMC); stage.removeEventListener(MouseEvent.MOUSE_UP,endDrag); } function moveMC(e:MouseEvent):void { TweenLite.to(MainMap,.5,{x:mouseX,y:mouseY}); e.updateAfterEvent(); }
×
×
  • Create New...