A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Scrub Timeline with AS

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    Scrub Timeline with AS

    hello there,

    does anyone know how to scrub a movie clips timeline with actionscript?

    what i have is a movie that plays continuously and i need it to scrub to a specific frame when someone hits a button.

    any help is much appriciated, thanks!

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    suppose mcScrub is your button instance name then u can use:

    Code:
    mcScrub.onRelease = function() {
    	scrubber(_root, 100, "forward");// scrub(movieclip, uptilFrame, scrubdirection)
    	
    };
    
    
    function scrubber(movie:MovieClip, frameno:Number, scrub:String):Void {
    	movie.stop();
    	movie.onEnterFrame = function() {
    		if (scrub == "reverse") {
    			movie.prevFrame();
    		} else if (scrub == "forward") {
    			movie.nextFrame();
    		}
    		if (movie._currentframe == frameno) {
    			delete movie.onEnterFrame;
    		}
    	};
    }
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Senior Member
    Join Date
    May 2003
    Posts
    160
    thanks for the help, i tried your code and must not be smart enough to get it working. i have attached a sample file of a moving mc and a button. can you please help me get this test working.

    thanks alot!!!!!
    Attached Files Attached Files

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    saved it out as flash player 6 and AS 1... your using flash 5? your settings were for flash player 5..

    sorry flashkit is really slow and i cant upload the file..hopefully someone else can help u out..sorry i gotta run now...
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  5. #5
    Senior Member
    Join Date
    May 2003
    Posts
    160
    no im using flash 8, i just saved it as an older version so whoever needed to open it could if they had an older version.

    thanks for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center