Solved

Control Flash video with mouse

Posted on 2009-06-28
1
385 Views
Last Modified: 2013-11-11
Hi,

I'm not sure if this is possible, but is there a way to control flash video with mouse movement? For instance, if you move the mouse to the right of center over a video, it advances, if you move the mouse to the left of center it rewinds. I guess the functionality I'm looking for would be similar to that of a thumbnail slider.

Another solution could perhaps be, to put frames of the video on separate frames in the timeline, then have the mouse movement advance or rewind the timeline?

I've been researching this quite a bit, but I haven't found any viable solutions. Any help from the experts here would be greatly appreciated!!!

Thanks!
0
Comment
Question by:Coobakai
1 Comment
 
LVL 8

Accepted Solution

by:
ccarey earned 500 total points
ID: 24744145
if you put the video on the timeline in a movieclip (say with an instance name 'mc') then this will do the job:



// mc is present on root timeline
// this code lives on frame 1 of root timeline
 
stage.addEventListener(MouseEvent.MOUSE_MOVE, _onMouseMove, false, 0, true);
 
function _onMouseMove(evt:MouseEvent) : void {
    var pct:Number = Math.max( stage.mouseX / stage.stageWidth, 0);
    var frame:Number = Math.ceil(pct * mc.totalFrames);
    mc.gotoAndStop(frame);
}

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question