Solved

How to link a slider bar to play frames of a movie clip in Flash

Posted on 2009-04-08
2
602 Views
Last Modified: 2013-11-11
I am trying to link a slider bar to control a sequence of images I have in a movie clip. It is a 3d rotation of a TV.  I have created a slider with a line and dragger, I followed the tutorial from http://www.kirupa.com/developer/mx/slider.htm

Here is the code I have in frame 1 of the movie clip that is my slider:

this.ratio=0 ;
dragger.onPress=function(){
      this.startDrag(true,0,0,0,((line._height)-120));
      this.onEnterFrame=function(){
            ratio=Math.round(this._y*100/line._height) ;
      }
}
dragger.onRelease=dragger.onreleaseOutside=stopDrag;

And here is the code I have in frame 1 of the movie it appears in:

this.onEnterFrame=function(){
   ratio.text=mySlider.ratio;
}

My movie clip is called Images. The action script above the movie clip Images I got off a tutorial and looks like this.

Images.stop();

var startX:Number;
var startFrame:Number;
var changeDistance:Number;
var travelDistance:Number;

Images.onPress = pressHandler;
Images.onRelease = releaseHandler;
Images.onReleaseOutside = releaseHandler;

function pressHandler():Void {
  startX = Images._xmouse;
  startFrame = Images._currentframe;
  this.onMouseMove = moveHandler;
}
function releaseHandler():Void {
  this.onMouseMove = null;
}
function moveHandler():Void {
      changeDistance = Math.round((Images._xmouse-startX)/10);
      travelDistance = startFrame+changeDistance;
      if (travelDistance>Images._totalframes) {
            Images.gotoAndStop(travelDistance%Images._totalframes);
      } else if (travelDistance<0) {
            Images.gotoAndStop(Images._totalframes+(travelDistance%Images._totalframes));
      } else {
            Images.gotoAndStop(travelDistance);
      }
}
0
Comment
Question by:jacobted
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 300 total points
ID: 24248309
You can use freely available movieController component


http://www.flashloaded.com/freebies/moviecontroller/

You just need to register for Flashloaded newsletter with a valid email and you can download this freebie component
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

688 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