Flash playback speed of the system to do

Source: Internet
Author: User
Tags pow
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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.