How do you make an automatic seekbar/scrubber?

Hi there,
              I have made my own functional mp3 media player in actionscript 3.0 where I can play a song, and I have a seekbar/scrubber which I can scrub through the song.
The question I am now asking as I have searched many forums and on google, is how I can make the seekbar/scrubber move with the song automatically.
Any help is appreciated, Thanks Casey
// Variable List
var my_songs:XMLList; // create variable for reference to XML nodes in playlist
var my_total:Number; // create variable to hold number of songs in playlist
var my_sound:Sound; // create variable to hold sound object
var my_channel:SoundChannel; // create variable to hold sound channel object
var dragging:Boolean = false; // boolean to detect state of vol slider drag
var isDragging:Boolean = true; // boolean to detect state of scrubber/seekbar
var rectangle:Rectangle = new Rectangle(0,-75,0,75); // place vol slider objects
var rectangle2:Rectangle = new Rectangle(0,0,685.5,0);
var current_song:Number = 0; // current song counter (first position in the array)
var song_position:Number; // song position
var song_paused:Boolean; // is song paused? true or false?
var myXMLLoader:URLLoader = new URLLoader(); // variable to hold the URLLoader class
var pausePosition:int=0;
// seekbar ui controls setup
seekBar_mc.sliderSeek_mc.buttonMode = true;
seekBar_mc.sliderSeek_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragIt2); // call drag function
stage.addEventListener(MouseEvent.MOUSE_UP, dropIt2); // call drop function
// function dragIT2
// dragging slider
function dragIt2(e:Event):void
          e.currentTarget.startDrag(true, rectangle2); // seek bar of rectangle constrained
          isDragging = true; // flip the boolean value to true (dragging)
          seekBar_mc.sliderSeek_mc.addEventListener(Event.ENTER_FRAME, onPlayProgress); // call the onPlayProgress function
// function dropIT2
// dropping slider
function dropIt2(e:Event):void
          if (song_paused == false)
                    if (isDragging == true)
                              stopDrag();
                              var fullTime:int = Math.floor(my_sound.length/1000);
                              //my_sound.length:int = Math.ceil(my_sound.length /(my_sound.bytesLoaded / my_sound.bytesTotal));
                              var newPos:Number = fullTime/685.5 * Math.floor(seekBar_mc.sliderSeek_mc.x * 1000);
                              pausePosition = newPos/2;
                              my_channel.stop();
                              gotoAndPlay(2);
                              my_channel = my_sound.play(newPos);
                              song_paused = false;
                              isDragging = false;
          }else
                    isDragging = false;
                    seekBar_mc.sliderSeek_mc.stopDrag();
                    //seekBar_mc.sliderSeek_mc.visible = false;
                    //pausePosition = _totalTime / 100 * Math.floor(seekBar_mc.sliderSeek.mc.x * 1000);
// onPlayProgress
function onPlayProgress(event:Event):void
          var seekbar:Number = seekBar_mc.sliderSeek_mc.x / 100; 

create a loop (eg, enterframe) and repeatedly use your soundchannel's position property to update your play indicator.

Similar Messages

  • How do you make it send an email on a condition? Or automate emails?

    How do you make it automatically send emails or even on a condtiion? (like qty left of inventory is 0)

    As far as making the report emailed conditionally, if the report is an exception report (only showing items with inventory = 0, for example), then you could add this to the report footer to prevent an email from being sent if no exceptions exist (basic syntax):
    WhilePrintingRecords
    dim noEmail as number
    if count({any field}) = 0 then  ' If no records processed...
      noEmail = noEmail / noEmail ' divide by zero failure prevents email from being sent
    end if
    This assumes that the data coming back from the database will only be exception records.  If that is not the case, then you'll have to manually count the number of records with inventory = 0 and use that formula field in the IF statement above.
    The down sides to this technique are that this will cause BOE to not generate anything (not even a blank report), and the status of the run will be Failed...
    HTH,
    Carl

  • How do you make a photo in DW that changes automatically in a loop and needs  no visable buttons

    How do you make a photo in DW that changes automatically in a loop and needs  no visable buttons?

    I'm sorry to be so vague. I have recently found out that what I want 
    to do is put my images in a javascript image rotator. I have looked 
    this up on google and have now tried about 6 different codes. I try to 
    follow the insert directions but I must be doing something wrong. I 
    get the first photo linked up but can never make the picture change to 
    show the other two photos in the image folder.
    Can you direct me as to how this works in dw?
    Thank you so much for helping.
    Pam

  • How do you make a 3d octagon in photoshop cs4 extended?

    How do you make a 3d octagon in photoshop cs4 extended that you can map artwork to? I've been searched online for a solution that doesn't involve using a 3D program but can't find anything. Can't you extrude a shape like in Illustrator, or exporta true 3D shape from Illustrator that will work? I'd use Illustrator but the mapping thing is finicky, and doesn't alow wrapping images around angles. (now someones going to say: "Don't mention any other programs in a PHotoshop forum!" Yeah yeah, there should be a forum then about using different Adobe programs together.) End of rant, any suggestions much appreciated.
    Thanks,
    Mike

    Thanks for your prompt response!
    Suggested Bridge Update
    It turns out that I got a message that this update had already been installed, which led me to more carefully look at the Bridge window and (finally) see that the Output module had a Quality dropdown: Full, 300 ppi, 150 ppi, 96 ppi and 72 ppi.  Thanks!  I decided to compare the CS4/Bridge results to those I got in CS2 with its convenient File/Automate/PDF Presentation/Multi-Page Document routine that I like.
    My project was an 8-page PDF made from scanned pages of handwritten notes into which some fairly small type had been insert using the Photoshop CS2 Type tool.  In Photoshop CS2, I had settled on "medium quality" JPEG compression as giving a "reasonable" file size (about 7 MB) and "very good/excellent" image quality.  I experimented with making the PDF in Bridge, using all five Quality levels.  See table below.  The Bridge "good minus" file was about the same size as the file produced in CS2, which I judged to be "very good/excellent" and slightly better visually than the 300-ppi, 23.5-MB Bridge file.
    Bridge Quality:
    Full
    300 ppi
    150 ppi
    96 ppi
    72 ppi
    File Size:
    25.2 MB
    23.5 MB
    7.6 MB
    3.2 MB
    2.1 MB
    Subjective Quality:
    Very good
    Very good
    Good minus
    Poor
    Useless
    I appreciate that you may not be all that interested in these observations, but it seems to me that Adobe has done us no favors in the multi-page PDF department in going from CS2 to CS4!
    Install the Old Contact Sheet/Picture Package Plug-Ins
    I had already done this some time ago, in order to get in CS4 the File/Automate/Contact Sheet II feature I liked in CS2.  It does not appear to me that this plug-in has anything to do with make multi-page PDF's.  Perhaps I'm missing something.
    Again, thanks for your response!

  • How can you make your persona show on the top and bottom? Also can you make it bigger at the top to show more of the picture?

    How can you make your persona show on the top and bottom?
    Also can you make it bigger at the top to show more of the picture?

    Add extra empty toolbars if you want to see more of the persona.<br />
    You can create extra toolbars to get extra space via View > Toolbars > Customize<br />
    You have to put something on a toolbar (drag a Space item onto it) before closing the Customize window because empty toolbars are automatically removed.<br />
    See http://kb.mozillazine.org/Toolbar_customization

  • HT203909 Why can't you provide specific instructions here about how to make the USB drive bootable?  The article referenced is not dedicated to Bootcamp--too long, too many options.  How do you make it bootable?

    Why can't you provide specific instructions here in HT203909 (Boot Camp: Creating an ISO image from a Windows installation DVD) about how to make the USB drive bootable?  The article referenced for partitioning the drive is not dedicated to Bootcamp--too long, too many options.  How do you make it bootable?

    If your BC Assistant shows the option to create a USB Installer, it automatically is marked as bootable. There is no need to have manual intervention to make a bootable USB. Once the process is manually modified, it is supported by the person modifying it.
    You have two or three options (depending on your Mac Model).
    1. Create USB... - Use a USB2 flash drive, which is erased and formatted. If your Mac supports ISOs then BCA will prompt for the Media. Any Mac which does not have a built-in Optical drive will support an ISO. There are specific Mac models which support both, DVD and USB based installation.
    2. Download Software from Apple servers...
    3. Install Windows...
    Are any additional instructions really necessary?

  • How do you make an expanadble text box in a pdf form?

    How do you make a text box expand automatically in a pdf form?

    Hi;
    Is this a question related to FormsCentral or to PDF forms in general?  If it is for PDF forms you should ask in the Acrobat forms forums: http://forums.adobe.com/community/acrobat/forms
    If it is related to FormsCentral the text boxes do not expand automatically in a PDF, except for when saving a Response as a PDF form, when the responses from the View Responses tab are saved as a PDF form all Multi-line text fields are expanded to fit the text the user had entered.
    Thanks,
    Josh

  • How do I make Firefox automatically display my homepage when opening a new tab (instead of a blank page now)?

    How do I make Firefox automatically display my homepage when opening a new tab (instead of a blank page now)?
    (version 3.6.6 on a Windows7 64-bit rig)

    If you are using the latest version of firefox you dont need an addon simply change it in the config
    http://computerlearnhow.com/how-to-change-the-firefox-new-tab-homepage-to-something-useful/#.T6om38USU4k

  • How do you make new pages from a page so they have the first page in their address.

    I am talking about something like the adobe site.
    Like www.adobe.com/support/dreamweaver/whatever
    How do you make a page be under another like the dreamweaver page is a link from the support page.
    My goal is something like this.
    I have www.architecture.com/profile
    I need
    www.architecture.com/profile/Commercial
    www.architecture.com/profile/Residential

    If im understanding you correctly, you want the folder to have an automatic landing page. Ex. If your folder is
    "profile" you want the visitor to see the first profile page when they visit www.yoursite.com/profile. Correct?
    If thats what you need, name the page you want your visitor to see when they go to ex. www.yoursite.com/profile "index.html" or "index.php" ad save that file in your "profile" folder. When you're visitor will go to www.yoursite.com/profile the page you named "index" will open.
    Let me know if you dont understand or if its not what your trying to do.

  • How do you make in app purchase with store credit

    how do you make in app purchase with store credit

    It's automatic, as long as your balance covers the price of the item (including any applicable taxes e.g. state sales tax if you are in the US) then only your account's balance will be charged (if it doesn't cover it then any remainder will be charged to your credit card).

  • ITunes updates podcasts each hour but won't refresh. When I sync my iPhone, it gets yesterdays podcasts and I have to manually hit refresh to make it update. How can I make it automatically refresh?

    iTunes updates podcasts each hour but won't refresh. When I sync my iPhone, it gets yesterdays podcasts and I have to manually hit refresh to make it update. How can I make it automatically refresh?

    I think figured out what is going on here... If you have set your Windows OS time manually, Apple iTunes will not honor the time you set in Windows XP...
    In my case, I had not applied the Windows update that changes the Daylight savings rules. No big deal I thought... I can easily correct the time manually. Well... iTunes will not like it if you do that. You have to have your daylight savings rules set correctly on the PC. Microsoft has a free program called TZEdit that will let you adjust the DST boundaries.
    Once I set the rules correctly and then set my time keeping back to "Automatic" it fixed it. Hope this helps...

  • How do you make a web browser?

    I would like to make a Web Browser of my own but how did you make FireFox?

    Read this:
    http://thepattysite.com/window_sizes1.cfm
    You don't want to try to launch your site to full screen,
    honest, as you'd
    drive your (potential) visitors away.
    Jo
    "Steve Zavodny" <[email protected]> wrote in
    message
    news:escrfa$s7$[email protected]..
    > How do you make a web browser launch your site to a
    specific size or even
    > full screen?
    > Thanks...

  • How do you make superscripts and mathematics in Preview's text annotation?

    When adding text annotations that include scientific notations, how do you make superscripts, e.g. "3.2 × 10^{-23}"?
    Searching Help for 'superscript' turns up nothing, suggesting the command does not exist, as it does under Baseline etc. in iWork. Please tell me this is not the case! If it is, has the situation been improved in the new operating system?
    A related issue: I wish to include other mathematics -- is there a way to include mathematics similar to LaTeX? Might Preview incorporate using latex code in the future, so I can easily type "\exp{-\lambda t}" etc and have the math appear?
    I'm adding text annotations to PDF lecture notes in Preview, basically filling in blanks the instructor has left so students will pay attention in class, and these annotations include superscripts; I wish to format properly.
    Thank you!

    Once you have the circle shape displayed, long press on the border of the circle. Once it is highlighted, drag horizontally or vertically. This should allow you to distort the circle into an ellipse (or the square into a rectangle).
    Hope that helps,
    Frank
    Sketch Engineering

  • How can you make one button preform different actions in Xcode?

    How can you make one button "preform a click" and "orderfront"? Is that possible? Because what I am doing is making a welcome window to my application for Mac OS X 10.6, and I have two buttons in that window, one says "Connect" which connects a a WebView to a url and the other button opens up the main window. So how can I a make a button do multiple things at once??

    Ah - If you are just using bindings between various objects from Interface Builder, you can reduce your application code a bit (sometimes quite a bit), but there is only so far you can go. Typically variables and routines are defined in your application that Interface Builder hooks into, so that your application code (usually Objective-C, but can be others) can use these variables and routines to determine what is happening in the user interface.
    I'm not sure how up-to-date the project code is (or what programming code you are familiar with), but you can take a look at Apple's Cocoa Application Tutorial to see what is (usually) involved in creating an application.

  • How can you make the iPod tell the diff between a movie and music video

    Greetings!
    How can you make iPod tell the difference between a Music Video and Movie? Everything I put up on the iPod falls into Movie. So is it something I have to do in iTunes?
    Thanks for the help!

    Rightclick the video in iTUnes, hit Get info then the "Options" tab. Beside kind you can set it to movie. music video. or TV show

Maybe you are looking for

  • Multiple photo streams on one PC?

    My wife and I each have iPhones and we also have several iPads in the house. We used to use one Apple ID on all the devices.  But with Family Sharing I decided to switch to each person having their own Apple ID but I don't know exactly how this works

  • How do I get GarageBand files from an older mac onto my iPad 2?

    How do I get GarageBand files from an older mac onto my iPad 2? I can open the GarageBand Documents folder through iTunes while the iPad is sync'd but I can't seem to "add..." any of my old .band folders to the iPad to be able to view those music pro

  • Songs in my Itunes Library now won't play

    I just switched to a new Mac and now I have songs in my Itunes library that will not authorize.  They were fine on my cloud and last computer?  How can I solve this? I used Migration assistant to transfer files.  It's always worked for me in the past

  • How to set password protection in iphone5 for yahoo mail app

    I have password protection for my iPhone5. Is it possible to set a seperate password protection for my Yahoo mail account?

  • N78 problem

    Hello, I have N78 and have a problem with playing online streams. Youtube works fine but atdhe.net for example not working. It asking for flash player 9. Can anyone help me with this problem? I have searched for instalation of flash player 9 for N78