3 Replies Latest reply on Apr 23, 2017 2:38 PM by Dylan32609

    Control frames with mouse x coordinates




      I will try to rewrite an earlier question to be more precise:


      I want to take a folder with 20 pictures, in some way convert them into a movie. And then apply so that I can navigate the frames one by one in the movieclip by moving the mouse right and left  (move mouse left - navigate backwards frame by frame, move mouse right - navigate forward frame by frame).


      Anyone knows a good tutorial for this? Or maybe some tips to get started?  I'm pretty new to Flash CS3.




        • 1. Re: Control frames with mouse x coordinates
          Ned Murphy Adobe Community Professional & MVP

          I don't know that there will be a good tutorial for this, if any, mainly because as described, it may not be a desirable means of controlling a movieclip's timeline.  While the "in some way convert them into a movie" is your call, assuming that movie will occupy a timeline, the controlling of frames by moving the mouse may need a little more thought/criteria resolution.


          If the desired control is to merely make it such that moving the mouse left or right changes it one frame for each movement, then you can use a variable that keeps track of the mouseX value (where the mouse was) and a MOUSE_MOVE listener to trigger a function that tests where it is.  If the new mouseX value is greater than the stored value, the mouse moved right, so you advance one frame in the movie's timeline.


          The thing with this approach is that you really want to wait for the mouse to stop moving before you process a command to move, or somehow otherwise build in some stalling, otherwise one movement could end up moving several frames of the movie.  Also, one movement could limit how much space you have left to continue moving--running out of room to move....  You would need to sneak around to the opposite end of the stage at some point in order to keep moving in one direction.


          It may be better to create another area/movieclip that you use as a stepper control... if you pass the cursor over it from left to right, it advances the movie one frame and vice versa.  You use rollover and rollout detection to capture the position of the mouse for each event and that can tell you which way the mouse was moving.

          • 2. Re: Control frames with mouse x coordinates
            Ned Murphy Adobe Community Professional & MVP

            I should add that the title of your posting is not the same animal as what you described.  Using the mouseX value to define which frame your movie is on is a somewhat more normal control, though it would not be without a stumbling block at startup... if when the file started, the mouse was in the middle of the screen, where should the movie be in its timeline?

            • 3. Re: Control frames with mouse x coordinates

              seven years later I'm after the same answer.....have you gotten anywhere with developing a solution to this?


              There is a tutorial on YouTube that uses the mouseX and mouseY commands dated 2009...

              ActionScript 3 Basics Tutorial : 001 - YouTube

              And I have the same issue....I drag and drop an MP4 exported from Animate with 160 frames to the actionscript3 canvas and write his function, but the script treats the movie as an object and the mouse moves the whole screen left or right while the movie is playing. I want the screen to stay still while the mouse controls the flow of frames forward or backward as this thread originally asked also....to comment on Ned Murphy's reply of Feb 1 2017, the mouse would control the flow on a downclick only, so the user can place the cursor anywhere on the screen and downclick for the movement seen in the tutorial....a button should also be installed that toggles the mouseX command on and off right?

              Actually, the issue is moot if a slidebar is placed along the lower margin of the screen like it is just about everywhere nowadays....I'm looking into that now...