代码之家  ›  专栏  ›  技术社区  ›  Ólafur Waage

我怎样才能在一个数字之间?

  •  1
  • Ólafur Waage  · 技术社区  · 14 年前

    目前使用 Tweener 想知道如何在正则变量之间取舍?

    private var health:int = 100;
    
    // And then somewhere else in the class
    var amount:int = 50;
    
    Tweener.addTween(this.health, {value:amount, 
                                   onComplete:healCompleted, 
                                   time:0.5, 
                                   transition:"easeOutExpo"});
    

    这就是我想象的,这种镊子对其他镊子(如gtween)有效,但这个项目使用的是tweener。

    问题在于“值”部分,如何将变量的值放在那里?

    我得到的错误是

    在数字上找不到属性值,并且没有默认值。

    3 回复  |  直到 14 年前
        1
  •  1
  •   PatrickS    14 年前

    //define a health Object
    //anywhere in your code , instead of accessing the health integer, you 
    //would access its value property. 
    var health:Object = {value:100};
    
    var amount:int = 50;
    
    Tweener.addTween(this.health, {value:amount, 
                                   onComplete:healCompleted, 
                                   time:0.5, 
                                   transition:"easeOutExpo"});
    

        2
  •  2
  •   grapefrukt    14 年前

    Tweener.addTween(this, { health:amount, 
                             onComplete:healCompleted, 
                             time:0.5, 
                             transition:"easeOutExpo"});
    
        3
  •  0
  •   frankhermes lovepreet kaur    14 年前

    health public