home *** CD-ROM | disk | FTP | other *** search
- class huang.HAnimation
- {
- var dmc;
- var Hpath;
- var vloop = 0;
- var times = 0;
- var pnow = 0;
- function HAnimation(mc, path)
- {
- this.dmc = eval(mc);
- this.Hpath = path;
- }
- function Start()
- {
- var myClass = this;
- this.dmc.onEnterFrame = function()
- {
- if(myClass.DoSomeAnimation())
- {
- myClass.Hpath[myClass.pnow].bloop <= 0 ? myClass.pnow++ : myClass.Hpath[myClass.pnow].bloop--;
- if(myClass.Hpath.length - myClass.pnow < 2)
- {
- if(myClass.vloop < 1)
- {
- delete myClass.dmc.onEnterFrame;
- myClass.Arrived();
- }
- else
- {
- myClass.vloop--;
- myClass.pnow = 0;
- }
- }
- }
- };
- }
- function Arrived()
- {
- this.dmc.gotoAndPlay(this.Hpath[this.pnow].framename);
- }
- function Close()
- {
- delete this.dmc.onEnterFrame;
- false;
- }
- function DoSomeAnimation()
- {
- if(this.times == 0)
- {
- this.dmc._x = this.Hpath[this.pnow].x;
- this.dmc._y = this.Hpath[this.pnow].y;
- }
- if(this.times < this.Hpath[this.pnow].step)
- {
- this.DoMovement();
- this.times = this.times + 1;
- return false;
- }
- this.times = 0;
- return true;
- }
- function DoMovement()
- {
- this.dmc._x += (this.Hpath[this.pnow + 1].x - this.Hpath[this.pnow].x) / this.Hpath[this.pnow].step;
- this.dmc._y += (this.Hpath[this.pnow + 1].y - this.Hpath[this.pnow].y) / this.Hpath[this.pnow].step;
- this.dmc._rotation += this.Hpath[this.pnow].gama;
- if(this.Hpath[this.pnow].framename != undefined)
- {
- this.dmc.gotoAndStop(this.Hpath[this.pnow].framename);
- }
- }
- }
-