3 Replies Latest reply on Sep 8, 2009 3:54 PM by Ned Murphy

    lend us a helping hand: creating a background which moves in the direction that cursor is moving

    Mishmash23

      Hey dudes!

       

      so i have a project where i will be making a website.
      I will be using flash to make it interactive and visually appealing. I found a website with a really cool entrance page, please view it here:http://www.dvf.com/dvf/
      anyways whenever the mouse moves, the background looks like its moving.
      can someone please tell me how you could do this in flash???

      PLEEASSEEE i reallly reallly needd this. thanks so muchh

        • 1. Re: lend us a helping hand: creating a background which moves in the direction that cursor is moving
          Ned Murphy Adobe Community Professional & MVP

          If you don't have any familiarity with Flash programming you will have to get some learning of it under your belt to get things working.  Using AS3, what you want to do is make use of MouseEvent.MOUSE_MOVE for an event listener, and have an event handler function for that which utlizes tweening code.  AS3 has a built in Tween class, and there are third party tween classes available as well.

           

          You say you want a background that moves in the same direction as the mouse, which would be the opposite of what the one you pointed to does.  Also, in that example, there are basically three movieclips that make for semi-3d depth effect, with more blur added the further you go back in depth.

          • 2. Re: lend us a helping hand: creating a background which moves in the direction that cursor is moving
            Mishmash23 Level 1

            Hey thanks it was useful but which event handler function do i use? i know its supposed to be one which utilizes the tweening code but what's it called and what does the tween class do?

            • 3. Re: lend us a helping hand: creating a background which moves in the direction that cursor is moving
              Ned Murphy Adobe Community Professional & MVP

              The event handler function is called whatever you call it... while I'm not going to be giving a course in AS3 programming, here's some basics.

               

              You will create an event listener, and you can apply it to the stage.  This listener will be listening for mouse movement events and I am going to name the event handler function it interacts with "mouseMoved"... no special reason except to give an idea of what the function will do.

               

              stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved);

               

              And here is the basics of the event handler function....

               

              function mouseMoved(evt:MouseEvent):void {

                   // your tweening code goes here

              }

               

              As far as what the Tween class does, it tweens (gradually changes) things using code rather than the timeline, like positions, sizes, and other physical characteristics.  You can use Tweens to move an object from one place to another, which is essentially what you will be looking to do.  Except in your case you'll be trying to determine the direction you need to move as well as how far.  I haven't tackled the type of thing you displayed, so I do not know how complicated it might get when it comes to managing the speed and the distance of movement in combination with direction.  That will probably be something to scratch your head over.  I suggest getting the basics of the interactions down first... move the mouse and make something else move as a result.

               

              I just noticed you are cross posting this, so I will probably not try to help you further.  You shouldn't cross-post -- it's a courtesy thing -- it can result in people wasting time offering information that may have already been offered elsewhere, or info that never gets returned to by the poster when they find an answer elsewhere.  http://forums.adobe.com/thread/419406