Actionscript Tweening

Why am i getting this error and how can i fix it?
error 1067: Implicit coercion of a value of type Number to an unrelated type String.
my code:
stop()
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*
// value.valueOf()
var amount:Number = 5
var amount1:Number = 8
var amount2:Number = 12
var amount3:Number = 20
var timer:Timer = new Timer(1)
var time:Timer = new Timer(5000)
var miss:Timer = new Timer(1000)
var value:Number = 1;
var weapon:String;
var txBox:TextField = new TextField;
txBox.width = 128;
txBox.height = 16;
txBox.x = PersonRight.x -txBox.width/2;
txBox.y = PersonRight.y -35;
txBox.border = true;
txBox.borderColor = 0x000000;
txBox.background = true;
txBox.backgroundColor = 0x00FF00;
addChild(txBox);
addEventListener(Event.ENTER_FRAME, checkWeapon)
timer.start()
miss.start()
miss.addEventListener(TimerEvent.TIMER, tooLate)
function tooLate(Event:TimerEvent):void
     timer.stop();
     time.stop();
     present.visible = false
     var presentX:Number = present.x
     var presentY:Number = present.y
     var ranH:Number = Math.random()*stage.stageHeight
     var ranW:Number = Math.random()*stage.stageWidth
     var changePlaceX:Tween = new Tween(present, x, null, presentX, ranW, 5, true);
     var changePlaceY:Tween = new Tween(present, y, null, presentY, ranH, 5, true);
     changePlaceX.addEventListener(TweenEvent.MOTION_FINISH, restart);
     changePlaceY.addEventListener(TweenEvent.MOTION_FINISH, restart);
     function restart(Event:TweenEvent):void
          timer.start();
          miss.stop();
          miss.start();
timer.addEventListener(TimerEvent.TIMER, timering)
function timering(Event:TimerEvent):void
     if(PersonRight.hitTestObject(present))
         timer.stop()
          time.addEventListener(TimerEvent.TIMER, stopAdd);
          time.start()
          if(value == 1)
          amount = amount + 2
          if(value == 2)
          amount1 = amount1 + 5
          if(value == 3)
          amount2 = amount2 + 8
          if(value == 4)
          amount3 = amount3 + 12
          if(value == 5)
               //do nothing
          function stopAdd(Event:TimerEvent):void
               time.stop();
               timer.start();
function checkWeapon(event:Event):void
    if(value == 1)
        weapon = 'Frenzy Plant'
        txBox.text = weapon + '     ' + amount.valueOf();
    else if(value == 2)
        weapon = 'Leaf Storm'
        txBox.text = weapon + '     ' + amount1.valueOf();
    else if(value == 3)
        weapon = 'Solar Beam'
        txBox.text = weapon + '     ' + amount2.valueOf();
    else if(value == 4)
        weapon = 'Giga Drain'
        txBox.text = weapon + '     ' + amount3.valueOf();
    else if(value == 5)
        var neverEnding:String = '∞'
        weapon = 'Razor Leaf'
        txBox.text = weapon + '     ' + neverEnding;
    else
        weapon = 'No Weapon'
        txBox.text = weapon;
PersonRight.visible = false;
PersonDown.visible = false;
PersonDownStill.visible = false;
PersonUp.visible = false;
PersonUpStill.visible = false;
PersonLeft.visible = false;
PersonLeftStill.visible = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, press);
stage.addEventListener(KeyboardEvent.KEY_UP, release);
function press(event:KeyboardEvent):void
    var keyPressed = event.keyCode;
    if(keyPressed == 65)
        PersonRight.visible = false;
        PersonRightStill.visible = false;
        PersonDownStill.visible = false;
        PersonDown.visible = false;
        PersonUp.visible = false;
        PersonUpStill.visible = false;
        PersonLeft.visible = true;
        PersonLeftStill.visible = false;
        txBox.x = PersonLeft.x -txBox.width/2;
        txBox.y = PersonLeft.y -35;
        PersonLeftStill.x = PersonLeft.x;
        PersonLeftStill.y = PersonLeft.y;
        PersonDownStill.x = PersonLeft.x;
        PersonDownStill.y = PersonLeft.y;
        PersonDown.x = PersonLeft.x;
        PersonDown.y = PersonLeft.y;
        PersonRightStill.x = PersonLeft.x
        PersonRightStill.y = PersonLeft.y
        PersonRight.x = PersonLeft.x
        PersonRight.y = PersonLeft.y
        PersonUpStill.x = PersonLeft.x
        PersonUpStill.y = PersonLeft.y
        PersonUp.x = PersonLeft.x
        PersonUp.y = PersonLeft.y
        PersonLeft.x += -5
        checkCollisionWithZombie(wall)
    if(keyPressed == 87)
        PersonRight.visible = false
        PersonRightStill.visible = false
        PersonDownStill.visible = false
        PersonDown.visible = false
        PersonUp.visible = true
        PersonUpStill.visible = false
        PersonLeft.visible = false
        PersonLeftStill.visible = false
        txBox.x = PersonUp.x -txBox.width/2
        txBox.y = PersonUp.y -35
        PersonUpStill.x = PersonUp.x
        PersonUpStill.y = PersonUp.y
        PersonDownStill.x = PersonUp.x
        PersonDownStill.y = PersonUp.y
        PersonDown.x = PersonUp.x
        PersonDown.y = PersonUp.y
        PersonRightStill.x = PersonUp.x
        PersonRightStill.y = PersonUp.y
        PersonRight.x = PersonUp.x
        PersonRight.y = PersonUp.y
        PersonLeftStill.x = PersonUp.x
        PersonLeftStill.y = PersonUp.y
        PersonLeft.x = PersonUp.x
        PersonLeft.y = PersonUp.y
        PersonUp.y += -5
        checkCollisionWithZombie(wall)
    if(keyPressed == 68)
        PersonRight.visible = true
        PersonRightStill.visible = false
        PersonDownStill.visible = false
        PersonDown.visible = false
        PersonUp.visible = false
        PersonUpStill.visible = false
        PersonLeft.visible = false
        PersonLeftStill.visible = false
        txBox.x = PersonRight.x -txBox.width/2
        txBox.y = PersonRight.y -35
        PersonRightStill.x = PersonRight.x
        PersonRightStill.y = PersonRight.y
        PersonDownStill.x = PersonRight.x
        PersonDownStill.y = PersonRight.y
        PersonDown.x = PersonRight.x
        PersonDown.y = PersonRight.y
        PersonUpStill.x = PersonRight.x
        PersonUpStill.y = PersonRight.y
        PersonLeftStill.x = PersonRight.x
        PersonLeftStill.y = PersonRight.y
        PersonLeft.x = PersonRight.x
        PersonLeft.y = PersonRight.y
        PersonUp.x = PersonRight.x
        PersonUp.y = PersonRight.y
        PersonRight.x += 5
        checkCollisionWithZombie(wall)
    if(keyPressed == 83)
        PersonDown.visible = true
        PersonDownStill.visible = false
        PersonRight.visible = false
        PersonRightStill.visible = false
        PersonUp.visible = false
        PersonUpStill.visible = false
        PersonLeft.visible = false
        PersonLeftStill.visible = false
        txBox.x = PersonDown.x -txBox.width/2
        txBox.y = PersonDown.y -35
        PersonDownStill.x = PersonDown.x
        PersonDownStill.y = PersonDown.y
        PersonRightStill.x = PersonDown.x
        PersonRightStill.y = PersonDown.y
        PersonRight.x = PersonDown.x
        PersonRight.y = PersonDown.y
        PersonUpStill.x = PersonDown.x
        PersonUpStill.y = PersonDown.y
        PersonLeftStill.x = PersonDown.x
        PersonLeftStill.y = PersonDown.y
        PersonLeft.x = PersonDown.x
        PersonLeft.y = PersonDown.y
        PersonUp.x = PersonDown.x
        PersonUp.y = PersonDown.y
        PersonDown.y += 5
        checkCollisionWithZombie(wall)
    if(keyPressed == 81)//16
        if(value <= 1)
            value = 5
        else
            value += -1
    if(keyPressed == 69)//17
        value +=1
        if(value == 6)
            value = 1
    if(keyPressed == Keyboard.SPACE)
        if(value == 1)
            if(amount == 0)
                amount = 0
            else
                amount+=-1
        if(value == 2)
            if(amount1 == 0)
                amount1 = 0
            else
                amount1+=-1
        if(value == 3)
            if(amount2 == 0)
                amount2 = 0
            else
                amount2+=-1
        if(value == 4)
            if(amount3 == 0)
                amount3 = 0
            else
                amount3+=-1
        if(value == 5)
function release(event:KeyboardEvent):void
    var keyPressed = event.keyCode;
    var thisKey:Number = event.keyCode;
    if(keyPressed == 65)
        PersonLeft.visible = false
        PersonLeftStill.visible = true
        PersonLeft.x = PersonLeftStill.x
        PersonLeft.y = PersonLeftStill.y
    if(keyPressed == 87)
        PersonUp.visible = false
        PersonUpStill.visible = true
        PersonUp.x = PersonUpStill.x
        PersonUp.y = PersonUpStill.y
    if(keyPressed == 68)
        PersonRight.visible = false
        PersonRightStill.visible = true
        PersonRight.x = PersonRightStill.x
        PersonRight.y = PersonRightStill.y
    if(keyPressed == 83)
        PersonDown.visible = false
        PersonDownStill.visible = true
        PersonDown.x = PersonDownStill.x
        PersonDown.y = PersonDownStill.y
function checkCollisionWithZombie(wall:MovieClip)
    Collision.block(PersonDown, wall)
    Collision.block(PersonDownStill, wall)
    Collision.block(PersonRight, wall)
    Collision.block(PersonRightStill, wall)
    Collision.block(PersonUp, wall)
    Collision.block(PersonUpStill, wall)
    Collision.block(PersonLeft, wall)
    Collision.block(PersonLeftStill, wall)
    Collision.block(PersonDown, wall1)
    Collision.block(PersonDownStill, wall1)
    Collision.block(PersonRight, wall1)
    Collision.block(PersonRightStill, wall1)
    Collision.block(PersonUp, wall1)
    Collision.block(PersonUpStill, wall1)
    Collision.block(PersonLeft, wall1)
    Collision.block(PersonLeftStill, wall1)
    Collision.block(PersonDown, wall2)
    Collision.block(PersonDownStill, wall2)
    Collision.block(PersonRight, wall2)
    Collision.block(PersonRightStill, wall2)
    Collision.block(PersonUp, wall2)
    Collision.block(PersonUpStill, wall2)
    Collision.block(PersonLeft, wall2)
    Collision.block(PersonLeftStill, wall2)
    Collision.block(PersonDown, wall3)
    Collision.block(PersonDownStill, wall3)
    Collision.block(PersonRight, wall3)
    Collision.block(PersonRightStill, wall3)
    Collision.block(PersonUp, wall3)
    Collision.block(PersonUpStill, wall3)
    Collision.block(PersonLeft, wall3)
    Collision.block(PersonLeftStill, wall3)
    Collision.block(PersonDown, wall4)
    Collision.block(PersonDownStill, wall4)
    Collision.block(PersonRight, wall4)
    Collision.block(PersonRightStill, wall4)
    Collision.block(PersonUp, wall4)
    Collision.block(PersonUpStill, wall4)
    Collision.block(PersonLeft, wall4)
    Collision.block(PersonLeftStill, wall4)
    Collision.block(PersonDown, wall5)
    Collision.block(PersonDownStill, wall5)
    Collision.block(PersonRight, wall5)
    Collision.block(PersonRightStill, wall5)
    Collision.block(PersonUp, wall5)
    Collision.block(PersonUpStill, wall5)
    Collision.block(PersonLeft, wall5)
    Collision.block(PersonLeftStill, wall5)
    Collision.block(PersonDown, wall6)
    Collision.block(PersonDownStill, wall6)
    Collision.block(PersonRight, wall6)
    Collision.block(PersonRightStill, wall6)
    Collision.block(PersonUp, wall6)
    Collision.block(PersonUpStill, wall6)
    Collision.block(PersonLeft, wall6)
    Collision.block(PersonLeftStill, wall6)
    Collision.block(PersonDown, wall7)
    Collision.block(PersonDownStill, wall7)
    Collision.block(PersonRight, wall7)
    Collision.block(PersonRightStill, wall7)
    Collision.block(PersonUp, wall7)
    Collision.block(PersonUpStill, wall7)
    Collision.block(PersonLeft, wall7)
    Collision.block(PersonLeftStill, wall7)

You need to use quotations for the x and y...
     var changePlaceX:Tween = new Tween(present, "x", null, presentX, ranW, 5, true);
     var changePlaceY:Tween = new Tween(present, "y", null, presentY, ranH, 5, true);

Similar Messages

  • Actionscript Tweening Help(8 errors!)

    can any one help me fix my errors?
    1136: Incorrect number of arguments.  Expected 4.  x4
    1067: Implicit coercion of a value of type Number to an unrelated type Function.  x4
    my code:
    stop()
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*
    // value.valueOf()
    var amount:Number = 5
    var amount1:Number = 8
    var amount2:Number = 12
    var amount3:Number = 20
    var fireSide:Number
    // 1 = Up
    // 2 = Right
    // 3 = Down
    // 4 = Left
    var timer:Timer = new Timer(1)
    var time:Timer = new Timer(5000)
    var miss:Timer = new Timer(5000)
    var gotPoint:Timer = new Timer(1, 1)
    var value:Number = 1;
    var weapon:String;
    var txBox:TextField = new TextField;
    txBox.width = 128;
    txBox.height = 16;
    txBox.x = PersonRight.x -txBox.width/2;
    txBox.y = PersonRight.y -35;
    txBox.border = true;
    txBox.borderColor = 0x000000;
    txBox.background = true;
    txBox.backgroundColor = 0x00FF00;
    addChild(txBox);
    addEventListener(Event.ENTER_FRAME, checkWeapon)
    timer.start()
    miss.start()
    miss.addEventListener(TimerEvent.TIMER, tooLate)
    function tooLate(Event:TimerEvent):void
         timer.stop();
         miss.stop();
         present.visible = false
         var presentX:Number = present.x
         var presentY:Number = present.y
         var minusX:Number
         if(presentX >= 226)
              minusX = -1
         else if(presentX <= 225)
              minusX = 1
         var minusY:Number
         if(presentY >= 200)
              minusY = -1
         else if(presentY <= 199)
              minusY = 1
         var ranH:Number = Math.random()*(stage.stageHeight-presentY)* minusY
         var ranW:Number = Math.random()*(stage.stageWidth-presentX)* minusX
         var changePlaceX:Tween = new Tween(present, "x", null, presentX, ranW, 5, true);
         var changePlaceY:Tween = new Tween(present, "y", null, presentY, ranH, 5, true);
         changePlaceX.addEventListener(TweenEvent.MOTION_FINISH, restart);
         changePlaceY.addEventListener(TweenEvent.MOTION_FINISH, restart);
         function restart(Event:TweenEvent):void
              timer.start();
              present.visible = true
              miss.start();
    timer.addEventListener(TimerEvent.TIMER, timering)
    function timering(Event:TimerEvent):void
         if(PersonRight.hitTestObject(present))
             gotPoint.addEventListener(TimerEvent.TIMER_COMPLETE, tooLate);
              gotPoint.start();
              timer.stop()
              time.addEventListener(TimerEvent.TIMER, stopAdd);
              time.start()
              if(value == 1)
              amount = amount + 2
              if(value == 2)
              amount1 = amount1 + 5
              if(value == 3)
              amount2 = amount2 + 8
              if(value == 4)
              amount3 = amount3 + 12
              if(value == 5)
                   //do nothing
              function stopAdd(Event:TimerEvent):void
                   timer.stop();
    function checkWeapon(event:Event):void
        if(value == 1)
            weapon = 'Frenzy Plant'
            txBox.text = weapon + '     ' + amount.valueOf();
        else if(value == 2)
            weapon = 'Leaf Storm'
            txBox.text = weapon + '     ' + amount1.valueOf();
        else if(value == 3)
            weapon = 'Solar Beam'
            txBox.text = weapon + '     ' + amount2.valueOf();
        else if(value == 4)
            weapon = 'Giga Drain'
            txBox.text = weapon + '     ' + amount3.valueOf();
        else if(value == 5)
            var neverEnding:String = '∞'
            weapon = 'Razor Leaf'
            txBox.text = weapon + '     ' + neverEnding;
        else
            weapon = 'No Weapon'
            txBox.text = weapon;
    PersonRight.visible = false;
    PersonDown.visible = false;
    PersonDownStill.visible = false;
    PersonUp.visible = false;
    PersonUpStill.visible = false;
    PersonLeft.visible = false;
    PersonLeftStill.visible = false;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, press);
    stage.addEventListener(KeyboardEvent.KEY_UP, release);
    function press(event:KeyboardEvent):void
        var keyPressed = event.keyCode;
        if(keyPressed == 65)
            PersonRight.visible = false;
            PersonRightStill.visible = false;
            PersonDownStill.visible = false;
            PersonDown.visible = false;
            PersonUp.visible = false;
            PersonUpStill.visible = false;
            PersonLeft.visible = true;
            PersonLeftStill.visible = false;
            txBox.x = PersonLeft.x -txBox.width/2;
            txBox.y = PersonLeft.y -35;
            PersonLeftStill.x = PersonLeft.x;
            PersonLeftStill.y = PersonLeft.y;
            PersonDownStill.x = PersonLeft.x;
            PersonDownStill.y = PersonLeft.y;
            PersonDown.x = PersonLeft.x;
            PersonDown.y = PersonLeft.y;
            PersonRightStill.x = PersonLeft.x
            PersonRightStill.y = PersonLeft.y
            PersonRight.x = PersonLeft.x
            PersonRight.y = PersonLeft.y
            PersonUpStill.x = PersonLeft.x
            PersonUpStill.y = PersonLeft.y
            PersonUp.x = PersonLeft.x
            PersonUp.y = PersonLeft.y
            PersonLeft.x += -5
            checkCollisionWithZombie(wall)
              fireSide = 4
        if(keyPressed == 87)
            PersonRight.visible = false
            PersonRightStill.visible = false
            PersonDownStill.visible = false
            PersonDown.visible = false
            PersonUp.visible = true
            PersonUpStill.visible = false
            PersonLeft.visible = false
            PersonLeftStill.visible = false
            txBox.x = PersonUp.x -txBox.width/2
            txBox.y = PersonUp.y -35
            PersonUpStill.x = PersonUp.x
            PersonUpStill.y = PersonUp.y
            PersonDownStill.x = PersonUp.x
            PersonDownStill.y = PersonUp.y
            PersonDown.x = PersonUp.x
            PersonDown.y = PersonUp.y
            PersonRightStill.x = PersonUp.x
            PersonRightStill.y = PersonUp.y
            PersonRight.x = PersonUp.x
            PersonRight.y = PersonUp.y
            PersonLeftStill.x = PersonUp.x
            PersonLeftStill.y = PersonUp.y
            PersonLeft.x = PersonUp.x
            PersonLeft.y = PersonUp.y
            PersonUp.y += -5
            checkCollisionWithZombie(wall)
              fireSide = 1
        if(keyPressed == 68)
            PersonRight.visible = true
            PersonRightStill.visible = false
            PersonDownStill.visible = false
            PersonDown.visible = false
            PersonUp.visible = false
            PersonUpStill.visible = false
            PersonLeft.visible = false
            PersonLeftStill.visible = false
            txBox.x = PersonRight.x -txBox.width/2
            txBox.y = PersonRight.y -35
            PersonRightStill.x = PersonRight.x
            PersonRightStill.y = PersonRight.y
            PersonDownStill.x = PersonRight.x
            PersonDownStill.y = PersonRight.y
            PersonDown.x = PersonRight.x
            PersonDown.y = PersonRight.y
            PersonUpStill.x = PersonRight.x
            PersonUpStill.y = PersonRight.y
            PersonLeftStill.x = PersonRight.x
            PersonLeftStill.y = PersonRight.y
            PersonLeft.x = PersonRight.x
            PersonLeft.y = PersonRight.y
            PersonUp.x = PersonRight.x
            PersonUp.y = PersonRight.y
            PersonRight.x += 5
            checkCollisionWithZombie(wall)
              fireSide = 2
        if(keyPressed == 83)
            PersonDown.visible = true
            PersonDownStill.visible = false
            PersonRight.visible = false
            PersonRightStill.visible = false
            PersonUp.visible = false
            PersonUpStill.visible = false
            PersonLeft.visible = false
            PersonLeftStill.visible = false
            txBox.x = PersonDown.x -txBox.width/2
            txBox.y = PersonDown.y -35
            PersonDownStill.x = PersonDown.x
            PersonDownStill.y = PersonDown.y
            PersonRightStill.x = PersonDown.x
            PersonRightStill.y = PersonDown.y
            PersonRight.x = PersonDown.x
            PersonRight.y = PersonDown.y
            PersonUpStill.x = PersonDown.x
            PersonUpStill.y = PersonDown.y
            PersonLeftStill.x = PersonDown.x
            PersonLeftStill.y = PersonDown.y
            PersonLeft.x = PersonDown.x
            PersonLeft.y = PersonDown.y
            PersonUp.x = PersonDown.x
            PersonUp.y = PersonDown.y
            PersonDown.y += 5
            checkCollisionWithZombie(wall)
              fireSide = 3
        if(keyPressed == 81)//16
            if(value <= 1)
                value = 5
            else
                value += -1
        if(keyPressed == 69)//17
            value +=1
            if(value == 6)
                value = 1
        if(keyPressed == Keyboard.SPACE)
            if(value == 1)
                if(amount == 0)
                    amount = 0
                else
                    amount+=-1
                        switch(fireSide)
                             case 1:
                             frenzyPlant.rotation -= 90
                             frenzyPlant.x = PersonUp.x
                             var attackUp:Tween = new Tween(frenzyPlant, "y", Strong.easeOut(), frenzyPlant.y, -100, 1, true)
                             break;
                             case 2:
                             frenzyPlant.x = PersonRight.x
                             var attackRight:Tween = new Tween(frenzyPlant, "X", Strong.easeOut(), frenzyPlant.x, 500, 1, true)
                             break;
                             case 3:
                             frenzyPlant.rotation += 90
                             frenzyPlant.x = PersonDown.x
                             var attackDown:Tween = new Tween(frenzyPlant, "y", Strong.easeOut(), frenzyPlant.y, 650, 1, true)
                             break;
                             case 4:
                             frenzyPlant.rotation += 180
                             frenzyPlant.x = PersonLeft.x
                             var attackLeft:Tween = new Tween(frenzyPlant, "x", Strong.easeOut(), frenzyPlant.x, -100, 1, true)
                             break;
            if(value == 2)
                if(amount1 == 0)
                    amount1 = 0
                else
                    amount1+=-1
            if(value == 3)
                if(amount2 == 0)
                    amount2 = 0
                else
                    amount2+=-1
            if(value == 4)
                if(amount3 == 0)
                    amount3 = 0
                else
                    amount3+=-1
            if(value == 5)
    function release(event:KeyboardEvent):void
        var keyPressed = event.keyCode;
        var thisKey:Number = event.keyCode;
        if(keyPressed == 65)
            PersonLeft.visible = false
            PersonLeftStill.visible = true
            PersonLeft.x = PersonLeftStill.x
            PersonLeft.y = PersonLeftStill.y
        if(keyPressed == 87)
            PersonUp.visible = false
            PersonUpStill.visible = true
            PersonUp.x = PersonUpStill.x
            PersonUp.y = PersonUpStill.y
        if(keyPressed == 68)
            PersonRight.visible = false
            PersonRightStill.visible = true
            PersonRight.x = PersonRightStill.x
            PersonRight.y = PersonRightStill.y
        if(keyPressed == 83)
            PersonDown.visible = false
            PersonDownStill.visible = true
            PersonDown.x = PersonDownStill.x
            PersonDown.y = PersonDownStill.y
    function checkCollisionWithZombie(wall:MovieClip)
        Collision.block(PersonDown, wall)
        Collision.block(PersonDownStill, wall)
        Collision.block(PersonRight, wall)
        Collision.block(PersonRightStill, wall)
        Collision.block(PersonUp, wall)
        Collision.block(PersonUpStill, wall)
        Collision.block(PersonLeft, wall)
        Collision.block(PersonLeftStill, wall)
        Collision.block(PersonDown, wall1)
        Collision.block(PersonDownStill, wall1)
        Collision.block(PersonRight, wall1)
        Collision.block(PersonRightStill, wall1)
        Collision.block(PersonUp, wall1)
        Collision.block(PersonUpStill, wall1)
        Collision.block(PersonLeft, wall1)
        Collision.block(PersonLeftStill, wall1)
        Collision.block(PersonDown, wall2)
        Collision.block(PersonDownStill, wall2)
        Collision.block(PersonRight, wall2)
        Collision.block(PersonRightStill, wall2)
        Collision.block(PersonUp, wall2)
        Collision.block(PersonUpStill, wall2)
        Collision.block(PersonLeft, wall2)
        Collision.block(PersonLeftStill, wall2)
        Collision.block(PersonDown, wall3)
        Collision.block(PersonDownStill, wall3)
        Collision.block(PersonRight, wall3)
        Collision.block(PersonRightStill, wall3)
        Collision.block(PersonUp, wall3)
        Collision.block(PersonUpStill, wall3)
        Collision.block(PersonLeft, wall3)
        Collision.block(PersonLeftStill, wall3)
        Collision.block(PersonDown, wall4)
        Collision.block(PersonDownStill, wall4)
        Collision.block(PersonRight, wall4)
        Collision.block(PersonRightStill, wall4)
        Collision.block(PersonUp, wall4)
        Collision.block(PersonUpStill, wall4)
        Collision.block(PersonLeft, wall4)
        Collision.block(PersonLeftStill, wall4)
        Collision.block(PersonDown, wall5)
        Collision.block(PersonDownStill, wall5)
        Collision.block(PersonRight, wall5)
        Collision.block(PersonRightStill, wall5)
        Collision.block(PersonUp, wall5)
        Collision.block(PersonUpStill, wall5)
        Collision.block(PersonLeft, wall5)
        Collision.block(PersonLeftStill, wall5)
        Collision.block(PersonDown, wall6)
        Collision.block(PersonDownStill, wall6)
        Collision.block(PersonRight, wall6)
        Collision.block(PersonRightStill, wall6)
        Collision.block(PersonUp, wall6)
        Collision.block(PersonUpStill, wall6)
        Collision.block(PersonLeft, wall6)
        Collision.block(PersonLeftStill, wall6)
        Collision.block(PersonDown, wall7)
        Collision.block(PersonDownStill, wall7)
        Collision.block(PersonRight, wall7)
        Collision.block(PersonRightStill, wall7)
        Collision.block(PersonUp, wall7)
        Collision.block(PersonUpStill, wall7)
        Collision.block(PersonLeft, wall7)
        Collision.block(PersonLeftStill, wall7)
    the lines of codes that are causing the errors(i think)
    switch(fireSide)
                             case 1:
                             frenzyPlant.rotation -= 90
                             frenzyPlant.x = PersonUp.x
                             var attackUp:Tween = new Tween(frenzyPlant, "y", Strong.easeOut(), frenzyPlant.y, -100, 1, true)
                             break;
                             case 2:
                             frenzyPlant.x = PersonRight.x
                             var attackRight:Tween = new Tween(frenzyPlant, "X", Strong.easeOut(), frenzyPlant.x, 500, 1, true)
                             break;
                             case 3:
                             frenzyPlant.rotation += 90
                             frenzyPlant.x = PersonDown.x
                             var attackDown:Tween = new Tween(frenzyPlant, "y", Strong.easeOut(), frenzyPlant.y, 650, 1, true)
                             break;
                             case 4:
                             frenzyPlant.rotation += 180
                             frenzyPlant.x = PersonLeft.x
                             var attackLeft:Tween = new Tween(frenzyPlant, "x", Strong.easeOut(), frenzyPlant.x, -100, 1, true)
                             break;

    i'm not really sure how that will help. i checked and everything is working. just i think i coded something wrong
    my new code:
    stop()
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*
    var fAttackUp:Tween;
    var fAttackRight:Tween;
    var fAttackDown:Tween;
    var fAttackLeft:Tween;
    // value.valueOf()
    var amount:Number = 5
    var amount1:Number = 8
    var amount2:Number = 12
    var amount3:Number = 20
    var fireSide:Number
    // 1 = Up
    // 2 = Right
    // 3 = Down
    // 4 = Left
    var timer:Timer = new Timer(1)
    var time:Timer = new Timer(5000)
    var miss:Timer = new Timer(5000)
    var gotPoint:Timer = new Timer(1, 1)
    var value:Number = 1;
    var weapon:String;
    var txBox:TextField = new TextField;
    txBox.width = 128;
    txBox.height = 16;
    txBox.x = PersonRight.x -txBox.width/2;
    txBox.y = PersonRight.y -35;
    txBox.border = true;
    txBox.borderColor = 0x000000;
    txBox.background = true;
    txBox.backgroundColor = 0x00FF00;
    addChild(txBox);
    addEventListener(Event.ENTER_FRAME, checkWeapon)
    timer.start()
    miss.start()
    miss.addEventListener(TimerEvent.TIMER, tooLate)
    function tooLate(Event:TimerEvent):void
         timer.stop();
         miss.stop();
         present.visible = false
         var presentX:Number = present.x
         var presentY:Number = present.y
         var minusX:Number
         if(presentX >= 226)
              minusX = -1
         else if(presentX <= 225)
              minusX = 1
         var minusY:Number
         if(presentY >= 200)
              minusY = -1
         else if(presentY <= 199)
              minusY = 1
         var ranH:Number = Math.random()*(stage.stageHeight-presentY)* minusY
         var ranW:Number = Math.random()*(stage.stageWidth-presentX)* minusX
         var changePlaceX:Tween = new Tween(present, "x", null, presentX, ranW, 5, true);
         var changePlaceY:Tween = new Tween(present, "y", null, presentY, ranH, 5, true);
         changePlaceX.addEventListener(TweenEvent.MOTION_FINISH, restart);
         changePlaceY.addEventListener(TweenEvent.MOTION_FINISH, restart);
         function restart(Event:TweenEvent):void
              timer.start();
              present.visible = true
              miss.start();
              time.start();
    timer.addEventListener(TimerEvent.TIMER, timering)
    function timering(Event:TimerEvent):void
         if(PersonRight.hitTestObject(present))
             gotPoint.addEventListener(TimerEvent.TIMER_COMPLETE, tooLate);
              gotPoint.start();
              timer.stop()
              time.addEventListener(TimerEvent.TIMER, stopAdd);
              time.start()
              if(value == 1)
              amount = amount + 2
              if(value == 2)
              amount1 = amount1 + 5
              if(value == 3)
              amount2 = amount2 + 8
              if(value == 4)
              amount3 = amount3 + 12
              if(value == 5)
                   //do nothing
              function stopAdd(Event:TimerEvent):void
                   timer.stop();
    function checkWeapon(event:Event):void
        if(value == 1)
            weapon = 'Frenzy Plant'
            txBox.text = weapon + '     ' + amount.valueOf();
        else if(value == 2)
            weapon = 'Leaf Storm'
            txBox.text = weapon + '     ' + amount1.valueOf();
        else if(value == 3)
            weapon = 'Solar Beam'
            txBox.text = weapon + '     ' + amount2.valueOf();
        else if(value == 4)
            weapon = 'Giga Drain'
            txBox.text = weapon + '     ' + amount3.valueOf();
        else if(value == 5)
            var neverEnding:String = '∞'
            weapon = 'Razor Leaf'
            txBox.text = weapon + '     ' + neverEnding;
        else
            weapon = 'No Weapon'
            txBox.text = weapon;
    PersonRight.visible = false;
    PersonDown.visible = false;
    PersonDownStill.visible = false;
    PersonUp.visible = false;
    PersonUpStill.visible = false;
    PersonLeft.visible = false;
    PersonLeftStill.visible = false;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, press);
    stage.addEventListener(KeyboardEvent.KEY_UP, release);
    function press(event:KeyboardEvent):void
        var keyPressed = event.keyCode;
        if(keyPressed == Keyboard.LEFT) // 65
            PersonRight.visible = false;
            PersonRightStill.visible = false;
            PersonDownStill.visible = false;
            PersonDown.visible = false;
            PersonUp.visible = false;
            PersonUpStill.visible = false;
            PersonLeft.visible = true;
            PersonLeftStill.visible = false;
            txBox.x = PersonLeft.x -txBox.width/2;
            txBox.y = PersonLeft.y -35;
            PersonLeftStill.x = PersonLeft.x;
            PersonLeftStill.y = PersonLeft.y;
            PersonDownStill.x = PersonLeft.x;
            PersonDownStill.y = PersonLeft.y;
            PersonDown.x = PersonLeft.x;
            PersonDown.y = PersonLeft.y;
            PersonRightStill.x = PersonLeft.x
            PersonRightStill.y = PersonLeft.y
            PersonRight.x = PersonLeft.x
            PersonRight.y = PersonLeft.y
            PersonUpStill.x = PersonLeft.x
            PersonUpStill.y = PersonLeft.y
            PersonUp.x = PersonLeft.x
            PersonUp.y = PersonLeft.y
            PersonLeft.x += -5
            checkCollisionWithZombie(wall)
              fireSide = 4
        if(keyPressed == Keyboard.UP)//87
            PersonRight.visible = false
            PersonRightStill.visible = false
            PersonDownStill.visible = false
            PersonDown.visible = false
            PersonUp.visible = true
            PersonUpStill.visible = false
            PersonLeft.visible = false
            PersonLeftStill.visible = false
            txBox.x = PersonUp.x -txBox.width/2
            txBox.y = PersonUp.y -35
            PersonUpStill.x = PersonUp.x
            PersonUpStill.y = PersonUp.y
            PersonDownStill.x = PersonUp.x
            PersonDownStill.y = PersonUp.y
            PersonDown.x = PersonUp.x
            PersonDown.y = PersonUp.y
            PersonRightStill.x = PersonUp.x
            PersonRightStill.y = PersonUp.y
            PersonRight.x = PersonUp.x
            PersonRight.y = PersonUp.y
            PersonLeftStill.x = PersonUp.x
            PersonLeftStill.y = PersonUp.y
            PersonLeft.x = PersonUp.x
            PersonLeft.y = PersonUp.y
            PersonUp.y += -5
            checkCollisionWithZombie(wall)
              fireSide = 1
        if(keyPressed == Keyboard.RIGHT)//68
            PersonRight.visible = true
            PersonRightStill.visible = false
            PersonDownStill.visible = false
            PersonDown.visible = false
            PersonUp.visible = false
            PersonUpStill.visible = false
            PersonLeft.visible = false
            PersonLeftStill.visible = false
            txBox.x = PersonRight.x -txBox.width/2
            txBox.y = PersonRight.y -35
            PersonRightStill.x = PersonRight.x
            PersonRightStill.y = PersonRight.y
            PersonDownStill.x = PersonRight.x
            PersonDownStill.y = PersonRight.y
            PersonDown.x = PersonRight.x
            PersonDown.y = PersonRight.y
            PersonUpStill.x = PersonRight.x
            PersonUpStill.y = PersonRight.y
            PersonLeftStill.x = PersonRight.x
            PersonLeftStill.y = PersonRight.y
            PersonLeft.x = PersonRight.x
            PersonLeft.y = PersonRight.y
            PersonUp.x = PersonRight.x
            PersonUp.y = PersonRight.y
            PersonRight.x += 5
            checkCollisionWithZombie(wall)
              fireSide = 2
        if(keyPressed == Keyboard.DOWN)//83
            PersonDown.visible = true
            PersonDownStill.visible = false
            PersonRight.visible = false
            PersonRightStill.visible = false
            PersonUp.visible = false
            PersonUpStill.visible = false
            PersonLeft.visible = false
            PersonLeftStill.visible = false
            txBox.x = PersonDown.x -txBox.width/2
            txBox.y = PersonDown.y -35
            PersonDownStill.x = PersonDown.x
            PersonDownStill.y = PersonDown.y
            PersonRightStill.x = PersonDown.x
            PersonRightStill.y = PersonDown.y
            PersonRight.x = PersonDown.x
            PersonRight.y = PersonDown.y
            PersonUpStill.x = PersonDown.x
            PersonUpStill.y = PersonDown.y
            PersonLeftStill.x = PersonDown.x
            PersonLeftStill.y = PersonDown.y
            PersonLeft.x = PersonDown.x
            PersonLeft.y = PersonDown.y
            PersonUp.x = PersonDown.x
            PersonUp.y = PersonDown.y
            PersonDown.y += 5
            checkCollisionWithZombie(wall)
              fireSide = 3
        if(keyPressed == 81)//16
            if(value <= 1)
                value = 5
            else
                value += -1
        if(keyPressed == 69)//17
            value +=1
            if(value == 6)
                value = 1
        if(keyPressed == Keyboard.SPACE)
              trace(fireSide)
            if(value == 1)
                if(amount == 0)
                    amount = 0
                else
                    amount+=-1
                        switch(fireSide)
                             case 1:
                             frenzyPlant.x = PersonUp.x
                             frenzyPlant.rotation = 270
                             trace(frenzyPlant.x)
                             fAttackUp= new Tween(frenzyPlant, "y", Strong.easeOut, PersonUp.y, -100, 1, true)
                             frenzyPlant.x = PersonRight.x
                             trace("did")
                             break;
                             case 2:
                             frenzyPlant.x = PersonRight.x
                             trace(frenzyPlant.x)
                             fAttackRight = new Tween(frenzyPlant, "x", Strong.easeOut, PersonRight.x, 650, 1, true)
                             frenzyPlant.x = PersonRight.x
                             trace("did")
                             break;
                             case 3:
                             frenzyPlant.x = PersonDown.x
                             frenzyPlant.rotation = 90
                             trace(frenzyPlant.x)
                             fAttackDown = new Tween(frenzyPlant, "y", Strong.easeOut, PersonDown.y, 500, 1, true)
                             frenzyPlant.x = PersonLeft.x
                             trace("did")
                             break;
                             case 4:
                             frenzyPlant.x = PersonLeft.x
                             frenzyPlant.rotation = 180
                             trace(frenzyPlant.x)
                             fAttackLeft = new Tween(frenzyPlant, "x", Strong.easeOut, PersonLeft.x, -100, 1, true)
                             frenzyPlant.x = PersonLeft.x
                             trace("did")
                             break;
            if(value == 2)
                if(amount1 == 0)
                    amount1 = 0
                else
                    amount1+=-1
            if(value == 3)
                if(amount2 == 0)
                    amount2 = 0
                else
                    amount2+=-1
            if(value == 4)
                if(amount3 == 0)
                    amount3 = 0
                else
                    amount3+=-1
            if(value == 5)
    function release(event:KeyboardEvent):void
        var keyPressed = event.keyCode;
        var thisKey:Number = event.keyCode;
        if(keyPressed == 65)
            PersonLeft.visible = false
            PersonLeftStill.visible = true
            PersonLeft.x = PersonLeftStill.x
            PersonLeft.y = PersonLeftStill.y
        if(keyPressed == 87)
            PersonUp.visible = false
            PersonUpStill.visible = true
            PersonUp.x = PersonUpStill.x
            PersonUp.y = PersonUpStill.y
        if(keyPressed == 68)
            PersonRight.visible = false
            PersonRightStill.visible = true
            PersonRight.x = PersonRightStill.x
            PersonRight.y = PersonRightStill.y
        if(keyPressed == 83)
            PersonDown.visible = false
            PersonDownStill.visible = true
            PersonDown.x = PersonDownStill.x
            PersonDown.y = PersonDownStill.y
    function checkCollisionWithZombie(wall:MovieClip)
        Collision.block(PersonDown, wall)
        Collision.block(PersonDownStill, wall)
        Collision.block(PersonRight, wall)
        Collision.block(PersonRightStill, wall)
        Collision.block(PersonUp, wall)
        Collision.block(PersonUpStill, wall)
        Collision.block(PersonLeft, wall)
        Collision.block(PersonLeftStill, wall)
        Collision.block(PersonDown, wall1)
        Collision.block(PersonDownStill, wall1)
        Collision.block(PersonRight, wall1)
        Collision.block(PersonRightStill, wall1)
        Collision.block(PersonUp, wall1)
        Collision.block(PersonUpStill, wall1)
        Collision.block(PersonLeft, wall1)
        Collision.block(PersonLeftStill, wall1)
        Collision.block(PersonDown, wall2)
        Collision.block(PersonDownStill, wall2)
        Collision.block(PersonRight, wall2)
        Collision.block(PersonRightStill, wall2)
        Collision.block(PersonUp, wall2)
        Collision.block(PersonUpStill, wall2)
        Collision.block(PersonLeft, wall2)
        Collision.block(PersonLeftStill, wall2)
        Collision.block(PersonDown, wall3)
        Collision.block(PersonDownStill, wall3)
        Collision.block(PersonRight, wall3)
        Collision.block(PersonRightStill, wall3)
        Collision.block(PersonUp, wall3)
        Collision.block(PersonUpStill, wall3)
        Collision.block(PersonLeft, wall3)
        Collision.block(PersonLeftStill, wall3)
        Collision.block(PersonDown, wall4)
        Collision.block(PersonDownStill, wall4)
        Collision.block(PersonRight, wall4)
        Collision.block(PersonRightStill, wall4)
        Collision.block(PersonUp, wall4)
        Collision.block(PersonUpStill, wall4)
        Collision.block(PersonLeft, wall4)
        Collision.block(PersonLeftStill, wall4)
        Collision.block(PersonDown, wall5)
        Collision.block(PersonDownStill, wall5)
        Collision.block(PersonRight, wall5)
        Collision.block(PersonRightStill, wall5)
        Collision.block(PersonUp, wall5)
        Collision.block(PersonUpStill, wall5)
        Collision.block(PersonLeft, wall5)
        Collision.block(PersonLeftStill, wall5)
        Collision.block(PersonDown, wall6)
        Collision.block(PersonDownStill, wall6)
        Collision.block(PersonRight, wall6)
        Collision.block(PersonRightStill, wall6)
        Collision.block(PersonUp, wall6)
        Collision.block(PersonUpStill, wall6)
        Collision.block(PersonLeft, wall6)
        Collision.block(PersonLeftStill, wall6)
        Collision.block(PersonDown, wall7)
        Collision.block(PersonDownStill, wall7)
        Collision.block(PersonRight, wall7)
        Collision.block(PersonRightStill, wall7)
        Collision.block(PersonUp, wall7)
        Collision.block(PersonUpStill, wall7)
        Collision.block(PersonLeft, wall7)
        Collision.block(PersonLeftStill, wall7)

  • Actionscript Tweening stuck in mouseover position

    Here is my code for rollOver() and rollOut(). This code is
    applied to a small movieclip that moves the movieclip up 10 pixels
    on mouseover and back down on mouseout. It also gives the movieclip
    the elastic effect. Sometimes when I rollover the movieclip when
    viewing the swf, it gets stuck in the mouseover position when I
    have already rolled out. Any idea why it does this?
    on (rollOver) {
    var adobe = _level0.controls.Dock.graphics.adobe;
    var adobereflect =
    _level0.controls.Dock.graphics.adobereflect;
    var adobetxt = _level0.controls.Dock.graphics.adobetxt;
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var Tweenadobe1:Tween = new Tween(adobe, "_y",
    Elastic.easeOut, 27, 12, 15, false);
    var Tweenadobe2:Tween = new Tween(adobereflect, "_y",
    Elastic.easeOut, 55, 65, 15, false);
    var Tweenadobe3:Tween = new Tween(adobetxt, "_alpha", None,
    100, 0, 30, false);
    Tweenadobe1.onMotionFinished = function() {
    Tweenadobe1.stop();
    Tweenadobe2.onMotionFinished = function() {
    Tweenadobe2.stop();
    Tweenadobe3.onMotionFinished = function() {
    Tweenadobe3.stop();
    on (rollOut) {
    var adobe = _level0.controls.Dock.graphics.adobe;
    var adobereflect =
    _level0.controls.Dock.graphics.adobereflect;
    var adobetxt = _level0.controls.Dock.graphics.adobetxt;
    var Tweenadobe4:Tween = new Tween(adobe, "_y",
    Elastic.easeOut, 12, 27, 15, false);
    var Tweenadobe5:Tween = new Tween(adobereflect, "_y",
    Elastic.easeOut, 65, 55, 15, false);
    var Tweenadobe6:Tween = new Tween(adobetxt, "_alpha", None,
    0, 100, 30, false);
    Tweenadobe4.onMotionFinished = function() {
    Tweenadobe4.stop();
    Tweenadobe5.onMotionFinished = function() {
    Tweenadobe5.stop();
    Tweenadobe6.onMotionFinished = function() {
    Tweenadobe6.stop();
    }

    stopping your tweens in an onMotionFinished isn't going to do
    anything useful. stopping your rollOver tweens when you rollOut
    would be helpful and stopping your rollOut tweens when you rollOver
    would be helpful.

  • How do i start a motion tween by clicking a button and stop it at the end of the tween.

    Hi guys,
    I am creating a website for a project and i am trying to activate a box bropping down from another box when i click on the enter here button i have created. I have set the motion tween and its working when i preview i just unsure of the correct actionscript to start this tween when i have clicked the entere here button or how to stop it at the end of the tween.
    I am scared i may have made the layers in the wrong place, they are all currently in scene 1. does my second box that is dropping down need to be set inside the layers of the first box?
    Bit of a newbie at this.
    Thanks in advance!

    Create the dropping box movieclip as an animation by itself with a stop() coomand in the first frame and a stop() command in the last frame.  The click of the button should tell the movieclip to play(); at which point the animation should play and stop at the end.
    Another option would be to use an actionscript Tween to make the box drop.  Going that route the animation is what you code it to be and there is no need to have to stop it as it will end where you tell the Tween to end at.

  • Programmed tween affecting buttons

    I am using Flash CS3 targeting flashplayer 9.
    I have created a menu that has 5 simple buttons in it. I use
    a actionscript tween to move the menu from off the stage into view
    and back again. For some reason when the menu comes on the stage
    the hittable area of the buttons seems to be getting affected. I am
    dropping the menu onto the stage so I am only tweening the y
    property like so
    var menuTween:Tween;
    menuTween = new Tween(toc_mc, "y", toc_mc.y, 78, 1, true);
    When the menu comes into view it is like the hittable area of
    the button gets squashed vertically down. Even though the text
    still appears perfectly fine and the background of the button looks
    right the cursor will only click on a small sliver at the very
    bottom of each button. Has anyone else seen this?

    Oddly I think I found the problem although I am not sure. The
    menu movieclip I refer to above was pulled in from another movie
    that someone else did. For some reason it had a glow filter on it
    that I removed and now everything is working fine. I don't know
    what the glow filter was doing but I think that was the problem.
    Weird.

  • Tween Bug?

    Here's the scenario: I have a main flash movie that has some
    buttons and a container. When you click a button, a MovieclipLoader
    loads an external swf. Both files were originally created with
    Flash 7 and previously had very little actionscript. Mainly just
    some stops, gotos and code for a preloader. The swf being loaded
    previously had some static content and worked fine. Now I want it
    to load an xml file and fade in some text, but the actionscript
    tweens don't work. If I play the swf by itself, it works fine.
    However, when I load it into the main movie the tweens don't work.
    Right now, for testing purposes, I have the text load with _alpha =
    100 and wait a couple frames before the tween script. When the
    tween script starts everything being tweened disappears. I figure
    it has something to do with the fact that they were Flash 7, and
    maybe something isn't being imported right? But even if I publish
    them as Flash 7, the tweens don't work. I've embeded all the fonts
    too. Even non-text (images, shapes, etc) won't tween. They just
    disappear. I've googled this and searched the forums, but I can't
    find anything. So, any suggestions would be greatly appreciated.
    Thanks,
    -Ryan

    Just as information the Tween class uses the _root timeline
    to generate an onEnterFrame event to animate objects. If you
    mistakenly used the onEnterFrame on the _root to create another
    thing like a loader for example. That might be erasing the
    tweenings. Try using the onEnterFrame on an empty movie
    clip.

  • Actionscript 2 help needed on rotating movieclip

    I need help with the "stopping" of a movieclip rotation.  I think this would be easy for you Flash gurus but impossible for me.
    Here is the description.  The code below shows a movieclip rotating after mouse click but i want it to stop in place after 60 degrees.  Basically I need it to rotate 60 degrees after every mouse click and stop.  The "trace" function is there so i know something will happen when it rotates a certain degree.  Right now it rotates continually after the mouse click.
    mc.onRelease=function(){
         mc.onEnterFrame=function(){
              mc._rotation=mc._rotation+=10;
              if(mc._rotation==60){
              trace("HIT");
    As a bonus i would like the rotation of every 60 degrees to ease in and out.  Thank you in advance for any help you can give me.

    When the _rotation value reaches the 60 degree mark, you need to delete the onEnterFrame delete mc.onEnterFrame;.
    There is only one position where the _rotation value will == 60, so if the intention is to stop it at every 60 degrees, then you'll need to change the conditional to be...
    if(mc._rotation%60==0){
    So....
    mc.onRelease = function(){
         mc.onEnterFrame = function(){
              mc._rotation = mc._rotation+=10;
              if(mc._rotation%60==0){
                 trace(mc._rotation);
                 delete mc.onEnterFrame;
    If you want to have easing, I suggest looking into using Actionscript tweening.  With steps of 10 there's little room to ease.

  • Simple Tween Component

    I have been working on (what should be) a VERY simple
    component/compiled
    clip. The component will allow for setting actionscripted
    tweening for
    movie clips. It's so basic that I opted not to even use a
    class and it uses
    all internal actionscript. The problem is, when I drag it on
    the stage as a
    movie clip, it works beautifully. But as soon as I export it
    as an SWC file
    and use it from the Components panel, it doesn't work.
    It basically only sets a function to call in order to make an
    mc tween. It
    uses the mx.transitions for the easing. I've set a trace
    action that shows
    all the parameters.
    When used as a movie clip, it traces the following:
    Instance Name: _level0.tc, Tween Type: _x, Ease Type: [type
    Function],
    Starting: 148, Ending Point: 348, Time: 1
    The Ease Type is a variable called "ease" and it's set with
    the
    mx.transitions (ex: mx.transitions.easing.Regular.easeInOut).
    This works as
    a movie clip.
    After I export it as a SWC the it traces the following:
    Instance Name: _level0.tc, Tween Type: _x, Ease Type:
    undefined, Starting:
    148, Ending Point: 348, Time: 1
    Ease Type is now "undefined"
    Here is the code inside the mc:
    stop();
    //Importing transitions and easings
    import mx.transitions.*;
    import mx.transitions.easing.*;
    //Begin actions for component
    //Loading the transitions
    loadTweens = new mx.transitions.Tween();
    //Function to assign the actions to the MC
    _global[functionName] = function(){
    //This is where the problem occurs
    //It is set from a paramenter variable called easeType and
    based on the
    the mx.transitions are set
    //If statement to determine the easing of the MC
    if(easeType == "Regular.easeIn"){
    ease = mx.transitions.easing.Regular.easeIn;
    }else if(easeType == "Regular.easeOut"){
    ease = mx.transitions.easing.Regular.easeOut;
    }else if(easeType == "Regular.easeInOut"){
    ease = mx.transitions.easing.Regular.easeInOut;
    }else if(easeType == "Strong.easeIn"){
    ease = mx.transitions.easing.Strong.easeIn;
    }else if(easeType == "Strong.easeOut"){
    ease = mx.transitions.easing.Strong.easeOut;
    }else if(easeType == "Strong.easeInOut"){
    ease = mx.transitions.easing.Strong.easeInOut;
    }else if(easeType == "Back.easeIn"){
    ease = mx.transitions.easing.Back.easeIn;
    }else if(easeType == "Back.easeOut"){
    ease = mx.transitions.easing.Back.easeOut;
    }else if(easeType == "Back.easeInOut"){
    ease = mx.transitions.easing.Back.easeInOut;
    }else if(easeType == "Bounce.easeIn"){
    ease = mx.transitions.easing.Bounce.easeIn;
    }else if(easeType == "Bounce.easeOut"){
    ease = mx.transitions.easing.Bounce.easeOut;
    }else if(easeType == "Bounce.easeInOut"){
    ease = mx.transitions.easing.Bounce.easeInOut;
    }else if(easeType == "Elastic.easeIn"){
    ease = mx.transitions.easing.Elastic.easeIn;
    }else if(easeType == "Elastic.easeOut"){
    ease = mx.transitions.easing.Elastic.easeOut;
    }else if(easeType == "Elastic.easeInOut"){
    ease = mx.transitions.easing.Elastic.easeInOut;
    }else if(easeType == "None"){
    ease = mx.transitions.easing.None.easeNone;
    //Determines the direction of the tween
    if(tweenType == "_x"){
    starting = _parent[symbolInstance]._x;
    }else if(tweenType == "_y"){
    starting = _parent[symbolInstance]._y;
    }else if(tweenType == "_xscale"){
    starting = _parent[symbolInstance]._xscale;
    }else if(tweenType == "_yscale"){
    starting = _parent[symbolInstance]._yscale;
    //Ending Point of the MC
    endingPoint = starting + ending;
    trace("Instance Name: "+_parent[symbolInstance]+", Tween
    Type: "+
    tweenType+", Ease Type: "+ease+", Starting: "+starting+",
    Ending Point:
    "+endingPoint+", Time: "+time);//time = 2;
    trace(easeType);
    functionTween = new
    mx.transitions.Tween(_parent[symbolInstance],
    tweenType, ease, starting, endingPoint, time, true);
    Thanks for any help with this.
    Scott

    I've uploaded the FLA file to my web server. It has the Movie
    Clip that I
    wish to convert to a component with a sample mc so you can
    see how this
    works. Test the file and use the buttons or arrow keys to
    move the test mc.
    You will see that it works great as a movie clip in this FLA.
    Bu then, try
    converting it to an SWC and converting it to a component. You
    will see how
    it no longer works after doing so.
    Tha location of the FLA is:
    http://www.stingerweb.com/tweenComponent/TweenComponentStandalone.fla
    Thanks fo any help anyone can provide me with. This isn't a
    ground breaking
    component so anyone is welcome to use it once we get it
    working properly.
    Thanks,
    Scott
    "myIP" <[email protected]> wrote in message
    news:e88not$b8o$[email protected]..
    > How are you using this code as a MovieClip? I used the
    coded you posted
    > inside
    > a MC and when I compile it I don?t get any trace
    outputs. Your problem
    > sounds
    > like a scope issue but I can?t determine that until I
    use it as a
    > component.
    >

  • Change Tween Duration

    I have Actionscript tween and I am using a variable to control duration of the tween and want tot change that variable during a button function that takes place after the tween, but it doesnt change. Is there a way to change a tween property after its already run?
    var tweenDelay=16;
    var btnTween:Tween = new Tween(oneBtn_mc, "y", Strong.easeInOut, oneBtn_mc.y, 334.95, tweenDelay, false);
    I am runing a button function that plays the tween to animate some buttons on with tween.start(); and then I am using tween.yoyo(); to reverse it when the button is pressed again. But they animate to close to each other so I need to offset it. On the second push I have the variable tweenDelay=10, but when I did a trace(btnTween.duration), and it stays 16.

    once btnTween executes what difference would it make to change tweenDelay (which is a misnomer - it's really tweenDuration);
    any way, use a 3rd party tween class like tweenlite that allows the use of a delay parameter.  google: tweenlite as3 greensocks.

  • Actionscript animation with easing

    Hi,
    i need to create a var that contains animation instructions
    that can be called up and applied to a movie clip when a button is
    pressed.
    At the moment i have a movieclip called 'mover' that moves
    down 54 px when a button is pressed (see below command), but i need
    it to animate 54px in 1 second with +100 easing, i have had a
    search on the web but it is not entirely clear how to apply
    actionscripted animation.
    on (release){
    mover._y += 54;
    Cheers for any help.
    Rob.

    try the Tween class;
    i have not much experience with this but maybe this is
    usefull..
    http://www.kirupa.com/developer/actionscript/tween.htm

  • Smooth tweening?

    First of all, i'd like to apologise for my stupid nickname.
    It seemed every nick was already taken (even some that i'm pretty
    sure nobody used) and i got a bit frustrated and just pushed some
    keys at random and of course... That name was available. I don't
    know how to change it so now i'll probably always be known as
    "dafgsdggggg". :)
    Anyway, my question is about tweens. Smooth tweens.
    When i create a timelinebased motion tween i usually crank up
    the framerate to 30 so it'll run smoothly, i also enable "runtime
    bitmap caching" and this is many times more than enough. However,
    if i'd like to make a "discreet" movement where the object almost
    "hovers" in place, my animations get very "jagged" and are very
    unpleasing to the eye. This example here with the red letters is
    exactly what i'm after and now i'd like to ask for directions how
    to approach the problem.
    The top-banner:
    http://www.adobemagazine.com/
    Are these actionscript tweens?

    At the end of everything, simply fade in to the first image,
    then loop... or at the beginning, have it fade in.

  • Button Controlling Motion Tweens

    I am wanting to create a button that, when pressed, will make an image move along the X axis.  However, I want several other buttons to move that object along the X-axis to other locations regardless of where it is currently.
    I want the object to move from one spot to a second spot, stop, and then move from that new location to either its previous spot or a new spot.
    Basically having multiple buttons controlling where 1 or more image goes.  I have seen banners that will scroll horizontally when you click different Menu buttons.  The banner slides along the X-axis and stops to reveal the name of the new page on the banner (i.e. Home, About Us, Contact Us, etc.).  When another menu button is pressed, the banner slides again to reveal the new title page name (ie. Home, etc).
    I am coming from a Graphic Designer point of view and not a very good scripter.  Please assume I know nothing about scripting (I don't understand the language at all but I know how to set it up properly).

    For the example you offered, that control scheme can be realized using Actionscript tweening of the x property of the movieclip(s).  Each tween would be triggered by a button and would start the object moving from its current x position and move it to a predefined x position.
    Here is a simple example using the AS3 built-in Tween class of Flash.  You will get better performance using a third party tweening engine such as TweenLite.  The buttons are movieclips with instance names of "btn0" and "btn300" and the movieclip being movied is named "mc".  So if you create these three objects and assign them the names, the following should make the mc move when you click the buttons.
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var tw:Tween; // declare the tween
    mc.x = 150; // some starting position
    // assign values that the mc will move to for each button
    btn0.finalX = 0;
    btn300.finalX = 300;
    // assign event listeners for the buttons, they can use the same handler function
    btn0.addEventListener(MouseEvent.CLICK, moveMC);
    btn300.addEventListener(MouseEvent.CLICK, moveMC);
    function moveMC(evt:MouseEvent):void {
         var finalX:Number = evt.currentTarget.finalX;
         tw = new Tween(mc, "x", Regular.easeOut, mc.x, finalX, 1, true );
    If you have questions about the code, try researching it using the Flash help documentation.  Everything is explained there and learning to the help documents is as imprtant as anything else.
    The tweening could also be done using other code-based approaches, but what's shown above is probably the sdimpolest to get you started.

  • Photo Gallery - CS4 - Book?

    I'm looking for an ActionScript 3 book that also includes a
    sample or
    tutorial on how to build a dynamic (xml) photo gallery. I've
    built
    simple xml galleries but the problem I'm having being able to
    page left
    or right when there are too many tumbnails to fit in the
    given space.
    http://slideshowpro.net/ is the
    sort of gallery I need.

    I don't know of a book or tutorial, but you could probably
    find a tutorial online via Google.
    The basic approach would be to have a movieclip that contains
    the thumbnails and change its x value to shift things as a group.
    You could use an actionscript tween for the movement to get a
    similar effect as the site you pointed to.

  • Any tutorials on how to use the daily build of the Flex SDK to create Flash Player 10 content?

    Is there a tutorial on Adobe on how to use the daily build of
    the Flex SDK to create Flash Player 10 content?

    The approach you take might depend on a few things, but it boils down to using mouse interactive coding to trigger whatever effect you eventually realize.  The code you use will depend on the version of Actionscript you plan to use.
    You could make this as a movieclip that is normally stopped at its first frame and when you mouseover or click the movieclip, it animates along its own timeline to its enlarged state.  If the thumbnail is very small and the larger version is substantially larger, and both need to be clear images, this might be the better approach.
    If this only involves enlarging something, you could also probably realize it just using Actionscript Tween coding rather than timeline animation.

  • Fade in/out on button click

    Hi, I'm new here and a beginner at Actionscript.
    My question is this:
    I want to make a photo gallery with smooth fade in and out. I
    can do this on Clip Events i.e.
    onClipEvent(enterFrame){
    for(i=0; i>=100; i++){
    myMovieClip._alpha = i;
    But I can't write a script that does it on an on(release) or
    hitTest.
    Any help?

    I recommend using Tween class instead of the
    onClipEvent(enterFrame) construct.
    Have a look at this nice tutorial on how to use the Tween
    class:
    http://www.kirupa.com/developer/actionscript/tween.htm
    In the tut it is used for animation, but can as well be used
    to modify the _alpha property of your MC

Maybe you are looking for

  • How do I convert MTS files to work in Adobe CS6 Premiere on my new iMac (2013)

    I am trying to get AVCHD MTS files to work with my iMac. Is there a free converter or will Premiere Pro CS6 do it?

  • MIRO - hitting to purchase varience account

    Hi, i am trying to post Invoice, when i am giving PO in invoice screen entries are coming correct. but when i simulate the invoice lot of variance accounts are coming with different values. please advice why purchase variance is coming while simulate

  • Session Sharing on Different Servers

    Is it possible to access the data of a session created in one server           instance from a different server instance, without necessarily           clustering? And if so - how?           For example:           User has a session created and some

  • FileInputStream prevent from overwriting

    When I put a lock on a FileInputStream (through the lock() method of its FileChannel), then the file is protected from deletion, but not from overwriting. How can I prevent the FileInputStream from overwriting?

  • Can an iPad purchased in a foreign country subscribe to AT&T in the states?

    Hello all, I am thinking about purchasing the 3G iPad 2 here in the Philippines but am wondering if I ever move back to the states if I will be able to subscribe to an AT&T data plan.  Any feedback would be much appreciated.  Thanks! Jason