24_Gio_Hoc_Flash_2267_89039819

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: inh t mouse n trung tâm movie xa bao nhiêu. R i nó s d ng kho ng cách ,c chi u cao chi u r ng tính ph n trăm t l cho movie clip. CODE onClipEvent (load) { // get the original width and height of the mc origWidth = this._width; origHeight = this._height; } onClipEvent (enterFrame) { // get the distance from the center of the mc to the mouse dx = _root._xmouse-this._x; dy = _root._ymouse-this._y; // calculate the percentage of scale sx = 100*dx/(origWidth/2); sy = 100*dy/(origHeight/2); // set the scale of the mc this._xscale = sx; this._yscale = sy; } Chú ý ây ta s d ng 2 thu c tính m i, _width và _height tr v chi u cao và chi u r ng c a movie clip b ng Pixel. CHúng ư c lưu giú trong onClipEvent (load) vì khi ta c n l y l i giá tr g c c a movie. Thu c tính _width, _height S khác nhau gi a scale và width,height í scale s d ng giá tr ph n trăm. Còn width height s d ng pixel . Movie có th có giá tr sau: width 75, height 45, nhưng scale cho c xscale and yscale là 100 ph n trăm. Dư i â...
View Full Document

This note was uploaded on 01/16/2013 for the course BANKING 111 taught by Professor Johnsmith during the Spring '13 term at University of Economics and Technology.

Ask a homework question - tutors are online