How do I make a scrubber for an animation?

I created an animation on how a 4 stroke motor works and want to be able to play, stop and scrub through the animation. All i can find on the internet is scrubbing for video/audio. Can someone help. Thanks

I did not write this. It will play and scrub the timeline of a movieclip (instance name: MCflow) on the stage.
You will need an MC for the scrub bar (instance name scrubBarMC) and the handle (instance name scrubHandleMC) that users will click and drag. Select both of these MCs, create a new MC and give it an instance name of scrubberMC
Place the button component on the stage and give it an instance name of toggleBtnMC. Add a dynamic text field and give it an instance name frameTxtMC. The text field will display the frame number as the movieclip plays or while you are scrubbing the timeline.
//code for movieclip scrubber
var animLengthMC : int = MCflow.totalFrames;
var leftBoundMC : Number = scrubberMC.scrubBarMC.x;
var rightBoundMC : Number = scrubberMC.scrubBarMC.x + scrubberMC.scrubBarMC.width;
var dragBoundMC : Rectangle = new Rectangle(leftBoundMC, scrubberMC.scrubHandleMC.y, scrubberMC.scrubBarMC.width, 0);
var calcWidthMC : Number = scrubberMC.scrubBarMC.width / animLengthMC;
var animPlayingMC : Boolean = false;
MCflow.gotoAndStop(1);
frameTxtMC.text = String(MCflow.currentFrame);
scrubberMC.scrubHandleMC.x = leftBoundMC;
scrubberMC.scrubHandleMC.buttonMode = true;
scrubberMC.scrubHandleMC.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseEventsMC);
toggleBtnMC.label = "PLAY";
toggleBtnMC.addEventListener(MouseEvent.CLICK, togglePlayMC);
function handleMouseEventsMC(evt:MouseEvent):void
  switch(String(evt.type)) {
  case MouseEvent.MOUSE_DOWN:
  scrubberMC.scrubHandleMC.startDrag(false, dragBoundMC);
  stage.addEventListener(MouseEvent.MOUSE_UP, handleMouseEventsMC);
  MCflow.addEventListener(Event.ENTER_FRAME, scrubMovieMC);
  break;
  case MouseEvent.MOUSE_UP:
  scrubberMC.scrubHandleMC.stopDrag();
  stage.removeEventListener(MouseEvent.MOUSE_UP, handleMouseEventsMC);
  MCflow.removeEventListener(Event.ENTER_FRAME, scrubMovieMC);
  break;
function scrubMovieMC(evt:Event):void
  var scrubPosMC : int = scrubberMC.scrubHandleMC.x;
  var gotoFrameMC : int = Math.ceil(scrubPosMC / calcWidthMC);
  MCflow.gotoAndStop(gotoFrameMC);
  frameTxtMC.text = String(MCflow.currentFrame);
function togglePlayMC(evt:MouseEvent):void
  if (!animPlayingMC) {
  MCflow.play();
  animPlayingMC = true;
  toggleBtnMC.label = "PAUSE";
  scrubberMC.addEventListener(Event.ENTER_FRAME, updateScrubberMC);
  // DISABLE SCRUBBER INTERACTION WHILE ANIMATION PLAYS
  scrubberMC.mouseChildren = false;
  } else {
  MCflow.stop();
  animPlayingMC = false;
  toggleBtnMC.label = "PLAY";
  scrubberMC.removeEventListener(Event.ENTER_FRAME, updateScrubberMC);
  // ENABLE SCRUBBER INTERACTION AFTER ANIMATION STOPS
  scrubberMC.mouseChildren = true;
function updateScrubberMC(evt:Event):void
  var percentMC : Number = MCflow.currentFrame / animLengthMC;
  scrubberMC.scrubHandleMC.x = percentMC * scrubberMC.scrubBarMC.width;
  frameTxtMC.text = String(MCflow.currentFrame);

Similar Messages

  • How can i make a email for my printer

    how can i make a email for my printer to send the things to the email and get it printed if i was out of the house my printer model is 3525

    Hi alhashmi_sy,
    Welcome to the HP Support Forums. I see that you would like to learn how to setup the ePrint feature of your Deskjet Ink Advantage 3525 printer.
    The first step is to connect your printer to your wireless network. Please follow the steps in the Installing the Printer Software for a Wireless Network Connection document for your operating system. If you have already setup your printer with a USB cable, each operating system section has the steps to switch from the USB connection to a wireless connection.
    After connecting the printer to your wireless network please follow the steps for Getting the Printer Claim Code. Once you have the web services information sheet with your claim code please Set Up a Custom Email Address for ePrint.
    You should now have a customized ePrint email address for your printer. If you run into any issues please let me know at what step things went awry and the contents of any error messages. Please also let me know what operating system you are using on your computer (whatsmyos.com). Thank you.
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • HT1918 How do i change my username to another when they both have accts with itunes one is on my computer and one is on my ipad? Two different e-mail address that are both mine....so how do i make one acct for both?

    How do i change my username to another when they both have accts with itunes one is on my computer and one is on my ipad? Two different e-mail address that are both mine....so how do i make one acct for both?

    If you selected open a new Apple ID account, go back a step and enter use existing Apple ID.
    You will have to set up a separate iCloud account or your iPads will mirror each other.

  • Help - I have an apple id account, where is my iPod and iPad registered, but also the iPod of my daughter. How can I make an account for my daughter and keep all the apps she has on her iPod?

    Help - I have an apple id account, where is my iPod and iPad registered, but also the iPod of my daughter. How can I make an account for my daughter and keep all the apps she has on her iPod and in her own iTunes?

    Sorry, content bought with one Apple ID cannot be merged or transferred to another Apple ID.

  • HT204053 My family shares one apple id among 4 devices.  How do I make it impossible for my children (i pad mini and i pod touch 5) to see my contacts and texts, but yet still share all of my apps? Been trying to figure this out for hours.  Please help.

    my family shares one apple id among 4 devices. how do i make it IMPPOSSIBLE for my children (i pad mini and i pod touch 5) to view my contacts and texts while still sharing my apps? please help. been working on this for hours.

    Delete your account in 1. "Settings > iCloud" + 2. "Settings > Messages > Send & Receive" + 3. "Settings > FaceTime", but still let them using your account for iTunes and app purchases in "Settings > iTunes & App Stores". Of course, please make sure that they do not know your password to set up your account for iCloud again or purchase anything alone.

  • How can I make a shortcut for bluetooth in my iPhone 4 ?

    Hello everyone
    How can I make a shortcut for bluetooth in my iPhone 4 ?

    sorry not that I know of, out of the box that is, would be heady to quickly change between headset and normal mode though
    let apple know you want this feature
    http://www.apple.com/feedback/iphone.html
    there are 3th party solutions though
    http://www.macrumors.com/2012/04/17/new-app-turns-bluetooth-on-and-off-with-one- touch/

  • My calendar notifications disappear about an hour before the event. How do I make them stay for longer?

    My calendar notifications disappear from the notification center about an hour before the event. How do I make them stay for longer? It is it's 5

    This is normal and is how Apple handles photos.
    There are NOT duplicate photos.
    Just as a song is in your itunes library and you can access that exact same song from a playlist,  all  photos synced to iphone are in the photo library and those exact same photos (NOT duplicates) can be accessed from the individual albums.
    It is working exactly as it should.

  • 2 days ago i rented The Avengers, beside it took almost 7h to download, at the end it did not get fully downloaded... 20 last minutes were not there. I know is just 5 dollars, but, how can i make a claim for the amount paid?

    2 days ago i rented The Avengers, beside it took almost 7h to download, at the end it did not get fully downloaded... 20 last minutes were not there. I know is just 5 dollars, but, how can i make a claim for the amount paid?, what if I buy a movie later? i will get the same problem!!! still I do not know how the avengers ends!! please do not tell me haha, focus on the problem here!

    Welcome to the Apple Community.
    Apple's policy on sales of digital content is that all sales are final. If however you wish to appeal to Apple, select the content which is causing a problem and use the 'Report a problem' button in Your Purchase History on your computer.
    Currently, if your purchase happens to be your most recent purchase you will not be redirected to the report form, in this case use the report a problem option from the invoice that was emailed to you.
    I believe your issues are probably a network issue, which unless you resolve are likely to be repeated again.

  • ICal does not allow me to edit "minutes" in the appointments. when i make an appointment it defaults it to xxhrs 08mins (example 16:08) how can i make an appointment for 16:00 or 15:30 hrs ...etc.

    iCal does not allow me to edit "minutes" in the appointments. when i make an appointment it defaults it to xxhrs 08mins (example 16:08) how can i make an appointment for 16:00 or 15:30 hrs ...etc.

    Hi,
    You can change this in System Preferences, Language & Text.
    Go to System Preferences > Language & Text > Formats tab and change where it says Custom to your location. Then re-open iCal.
    Let us know how it goes.
    Best wishes
    John M

  • How I can make an account for the app store Spain without credit card?

    How I can make an account for the app store Spain without credit card?

    Follow these instructions and open an iTunes account. Then use that same account to get free apps from the Mac App Store.
    Create an iTunes App Store account without a credit card
    http://support.apple.com/kb/ht2534

  • Hi experts, how i can make confirmed quantity for the same day ???

    Hi experts, how i can make confirmed quantity for the same day ???
    regards,
    uday

    Hi Joao/ Phani,
    I have created a sales order in my IDES system with VA01 today and the delivery dates is confirmed for tomorrow ie 21st.
    My Question is how can i change the confirmed delivery date for the same day ???

  • 2 questions : How do I know if a video in Flash is streaming? 2nd - how can I make an overlay for video?

    Two questions :
    1) I have created a QT.mov, imported it into Flash, but after
    thinking about it, I want to be sure it is streaming for the web.
    How can I be sure of that? If it is not, what code can I put to
    make sure it is loading?
    2) How can I make an overlay for the video that disappears as
    soon as the user clicks on the play button?

    1. Without a flash ciommunication server for TRUE streaming
    of the file, what you get is called Progressive streaming. This
    means once the video begins to download it can start playing before
    the file has completely downloaded to the user. There are good
    descriptions (including pros and cons) of this here:
    http://www.mediacollege.com/video/streaming/overview.html
    2. If you have the file set to start automatically there will
    be no need for the user to push the play button. You could just put
    a graphic on top of the video component, and use actionscript to
    make the graphic invisible when the play button is pushed.

  • How I can make an ibook for iphone?

    how I can make an ibook for iphone? when I export my book, the iphone says that the format is just for ipad

    You need to recreate your book in .epub format.  The apple app for that is Pages. 

  • How to generate an XML file for an animation of IK armature

    Can someone please tell me how to generate an XML file for an animation of IK armature.
    I have a 5 keyframe/16 frame animation of a human character made up of a series of moveiclip symbols that is animated with an IK armature.  I need the XML information from the animation. 
    When I go to Commands > Export Motion XML I get the error message "There is more than one object on frame 1" and then nothing happens.
    Thank you,
    c

    I hope that's not the case.  I want to write to adobe about it.  I think it's a great feature and it functions really well even though it is not a very developed IK tool.  My biggest issue with it is ouput options and integration with motion tweens.
    I have seen a lot of examples of animators using it online, just no one talked about output.  I just feel it hasn't been developed.  It can generate a sprite sheet but only for a single pose frame of the animation, and not all the key frames or pose tweens.  I find that functionality quite odd, as if adobe just forgot about IK when added in sprite sheets, etc. and the reason it half works is just an accident.

  • How can I make (automatic) accounts for users of my adobe muse site?

    Adobe, google, facebook and more site haves accounts for his users, but how can I make a system with accounts for users of my adobe muse site?

    Hi,
    Try some suggestion given in this thread
    http://forums.adobe.com/message/5362643#5362643

Maybe you are looking for

  • Defining a table field as radiobutton

    Hi experts, I have a client table with two fields defined as char 1. Now, when creating the screen for SM30, I want these two fields as radiobutton. In the layout, I have created them as radiobutton but now, I don't know how to group them. It underst

  • *7.01 LOSAPKRN during upgrade -- /*SYSBAS incorrectly inserted in path*

    Hallo Everybody,    This issue is solved by the ILE-Patch #88 which should be used during upgrade from now on. The patch will shortly be available in the service marketplace but can also be downloaded from the URL [https://sapmats-de.sap-ag.de/downlo

  • "Vertical Align Center" Text and a Shape

    Hi designers, I wonder if anyone could give me a hand with aligning text and shapes? I would like to align a number to the center of a circle. "Horizontal Align Center" works well. "Vertical Align Center", however, does not yield the desired result.

  • Can't export to AIR with Windows Style as Custom Chrome (transparent)

    I can export to AIR with Xcelsius SP1 and FP1 as long as the Windows Style is set to either System Chrome or Custom Chrome (Opaque). However, if I choose Custom Chrome (transparent), it does not generate the AIR file but also does not create an error

  • LIMIT Command through OLAP_TABLE

    Hi, I have a program within an AW that limits the dimensions to the values I am interested in. While acessing data from the AW through OLAP_TABLE, I call this program in the parameter that allows me one DML command. When the data is returned, I see t