Flash playback rate is set in the edit, so can not be dynamically controlled by the program, to achieve similar effects, only the use of some small skills. Take the following small animation as an example, the speed of the direction arrow rotation (determined by the playback speed) as the distance between the mouse and from slow to fast change.
First do a section of the arrow rotation animation, as far as possible to set the frame more, for example, my set has 192 frames. The frame rate is increased by one fold, similar to playing one frame at every other frame, and so on. So I wrote a function:
function playratectr (Movie:movieclip, Rate:number) { Movie: A movie to control the speed of playback; rate: Frame rate Multiples (Rate = = undefined)? Rate=1:null; (movie = = undefined)? Movie=this:null; Set the default movie and rate values var cframe = Movie._currentframe; var nframe = cframe+rate; Movie.gotoandplay (Nframe); } |
Suppose the arrow's movie name is: Logo_part_1 (part of the logo I'm going to do)
Write:
Logo_part_1.onenterframe = function () { _ROOT.PLAYRATECTR (this,3); }; |
Then, the arrow animation will play at the original three times times the frame rate.
In order for the mouse position to be associated with a multiple of the playback speed, the following function is also available:
function Dtorate (Movie:movieclip, Rate_max:number, Tran:number) { Movie: Film Name: Rate_max: Controllable speed Maximum multiple: Tran: Distance Unit when converted to multiples (movie = = undefined)? Movie=this:null; (Rate_max = = undefined)? Rate_max=3:null; (Tran = = undefined)? Tran=50:null; var dx = movie._xmouse; var dy = movie._ymouse; var dr = Math.min (Rate_max, Math.floor (math.sqrt (Math.pow (DX, 2) +math.pow (DY, 2))/tran); Gets the distance between the mouse and the movie, it is converted return (RATE_MAX-DR+1); } |
Overwrite the original Onenterframe function:
Logo_part_1.onenterframe = function () { var rate = _root. Dtorate (this,15,35); Trace (rate); _ROOT.PLAYRATECTR (this, rate); }; |
Then you can test it. Because this is done using the jump frame method, the specific effect to test several times, and adjust the animation frame number, can get good results. Please use Flashplayer 7 to watch.