+ -
当前位置:首页 → 问答吧 → 关于TWEENLITE的问题

关于TWEENLITE的问题

时间:2010-11-04

来源:互联网

以下这段程序是一个类定义中的一段,意思就是让类对象永远生成一个随机的角度和速度去旋转,可是好像第二个TweenLite.to就不起作用了,代码有什么问题么?
复制内容到剪贴板
代码:
TweenLite.to(this,speed_random_number,{rotation:position_angle_random,onComplete:otherPlay});
function otherPlay()
{
    trace("ok");
    speed_random_number = obtain_radom_num(5,10);
    position_angle_random = obtain_radom_num(-60,60);
    trace(speed_random_number);
    trace(position_angle_random);
    TweenLite.to(this,speed_random_number,{rotation:position_angle_random,onComplete:otherPlay});        
}

作者: kook66   发布时间: 2010-11-04

断章取义,猜不到

要看otherPlay 是什么时候执行的

作者: flash023   发布时间: 2010-11-04

以下是整个类定义

package
{

       import flash.display.MovieClip;
       import gs.TweenLite;
       import flash.events.Event;
       import flash.events.TimerEvent;
       import flash.utils.Timer;


       public class light_line extends MovieClip
       {

              var stage_width:Number = new Number  ;
              var stage_height:Number = new Number  ;

              var max:Number = new Number  ;
              var min:Number = new Number  ;

              var ap_random_number:Number;
              var width_random_number:Number;
              var height_random_number:Number;
              var speed_random_number:Number;
              var frist_angle_random:Number;
              var position_angle_random:Number;
              var act_re:Boolean = new Boolean(true);

              var re_act_timer:Timer = new Timer(100);



              public function light_line(stage_width:Number,stage_height:Number)
              {
                     //得到随机数
                     ap_random_number = show_radom_num(0.1,0.3);
                     width_random_number = show_radom_num(5,300);
                     height_random_number = show_radom_num(200,600);
                     frist_angle_random = show_radom_num(-60,60);
                     //定义初始属性
                     this.height = height_random_number;
                     this.width = width_random_number;
                     this.alpha = ap_random_number;
                     this.rotation = frist_angle_random;
                     this.x = stage_width / 2;
                     this.y = stage_height;



                     speed_random_number = show_radom_num(5,10);
                     position_angle_random = show_radom_num(-60,60);
                     trace(speed_random_number);
                     trace(position_angle_random);
                     TweenLite.to(this,speed_random_number,{rotationosition_angle_random,onCompletetherPlay});

                     //定义转动动画;
                     function otherPlay()
                     {
                            trace("ok");
                            speed_random_number = show_radom_num(5,10);
                            position_angle_random = show_radom_num(-60,60);
                            trace(speed_random_number);
                            trace(position_angle_random);
                            TweenLite.to(this,speed_random_number,{x:123});
                     }
                     
                     // constructor code
              }
              function show_radom_num(max:Number,min:Number)
              {
                     var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
                     return randomNum;
              }
       }

}

作者: kook66   发布时间: 2010-11-04