Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / October 2005



Tip: Looking for answers? Try searching our database.

Need button to increase frames per second

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dzynr1980 - 31 Oct 2005 16:28 GMT
Is it possible to put a script on a button that when pressed will increase the frames per second? I need to press the button and double the frame rate to sort of fast-forward through the movie.
Kaare - 31 Oct 2005 18:53 GMT
It's not possible to increase or decrease the actual framerate, but what you
could do is to simply let the MovieCLip play faster by skipping frames in an
onEnterFrame method. Something like mc.gotoANdPlay(mc._currentframe+2); ie.
double speed.
dzynr1980 - 31 Oct 2005 21:18 GMT
That sounds resonable. Exactly what code should be on the button? I tried
mc.gotoANdPlay(mc._currentframe+2); where mc was the name of the movie clip and
then I tried making mc the name of the scene. Neither worked. I'm obviously
doing something wrong.
Kaare - 31 Oct 2005 22:41 GMT
Alright, I've made a generic fast forward function for you. Basically, you just
pass a reference to a MovieClip as a parameter.

Have a Button and the MovieClip that should be fast forward-able in the same
frame, and write this code in a layer in the same frame. The Button should be
named ff_btn, and the MovieClip in question is here named anim_mc. Basically
you can add any MC you want to.

Look through the code, and if there's something you don't understand, I can
for sure explain that for you :)

function fastForwardMC(mc:MovieClip):Void{
    var ff_mc = mc.createEmptyMovieClip("ff_mc", 999);
    ff_mc.onEnterFrame = function(){
        trace(this._parent._currentframe);
        if(this._parent._currentframe <= this._parent._totalframes-2){
            this._parent.gotoAndPlay(this._parent._currentframe+2);
        } else {
            this._parent.gotoAndStop(this._parent._totalframes);
            this.removeMovieClip();
        }
    }
}

ff_btn.onRelease = function(){
    fastForwardMC(anim_mc);
}
Kaare - 31 Oct 2005 22:43 GMT
Whoops, just erase the trace action ;)

Furthermore, to answer your question, with the attached code, nothing should
be written on the Button. It's being applied with dot syntax in this line:

ff_btn.onRelease = function(){
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.