2 Replies Latest reply on Jan 7, 2010 9:54 AM by Handycam

    Scrollable, zoomable, pan-able swfloader?

    Handycam Level 1

      I have a  1200x800 swf loader into a swfloader that is in a smaller group viewport:

       

      <s:Group>
           <s:Group left="0" top="0" width="600" height="400">
                <s:Scroller left="2" right="2" top="2" bottom="2">
                     <s:Group id="vp" horizontalScrollPosition="0" verticalScrollPosition="0">
                          <mx:SWFLoader id="game" source="game.swf"/>
                     </s:Group>
                </s:Scroller>
           </s:Group>
      </s:Group>
      
      

       

      I already know I can change the magnification such as game.scaleX = .5; game.scaleY = .5;

       

      But how can I have the scroller scroll by dragging the content a opposed to scrollbars, and hide the scrollbars when the object "fits" (that is, scaled .5)?

        • 1. Re: Scrollable, zoomable, pan-able swfloader?
          Shongrunden Adobe Employee

          I put together a simple example that demonstrates one way of doing this.  See attached.

          1 person found this helpful
          • 2. Re: Scrollable, zoomable, pan-able swfloader?
            Handycam Level 1

            This is very cool.  The only problem I am having in my case is that the mouse events in my Flash file (swf) are being triggered on mouse up in addition to the scroll, where as your dummy game it did not.

             

            My Flash file is set up with hot spots that dispatch a custom event on mouse up, which I set with a listener in the init method of the main Flex app:

            // listen to mouse down and over events on the viewport
            vp.addEventListener(MouseEvent.MOUSE_DOWN,handleMouseDown);
            vp.addEventListener(MouseEvent.MOUSE_MOVE,handleMouseMove);
            game.addEventListener("hotSpotEvent", goodClickHandler);
            game.addEventListener("BadClick", badClickHandler);
            

             

            How could I modify your code so that when the user lifts the mouse over a hot spot as a result of panning the game, it does not trigger the event from the hot spot?