argh
argh

Reputation: 143

action script 3.0 resizing an image as animation

I want after clicking on button mini1 pic1 to go to the center of page and change the size... This code works fine but I would like to change the size and position dynamically... Can I change this code somehow to achieve the effect of resizing the image or I have to do this by motion tweens...?

mini1.addEventListener(MouseEvent.CLICK, show1);

function show1(event:MouseEvent):void
{
    pic1.visible = true;

    if (pic1.y > 440) {
        pic1.y -= 270;
        pic1.x = 300;
        pic1.width = 400;
        pic1.height = 400;
    }

    pic2.visible = false;
    pic3.visible = false;
    pic4.visible = false;
}

Upvotes: 0

Views: 218

Answers (1)

Harrison
Harrison

Reputation: 305

Try

pic1.width = 400;
pic1.height = 400;
pic1.x = stage.stageWidth-pic1.width;
pic1.y = stage.stageHeight-pic1.height;

Plase note that the x and y property need to change just after you resize the image

Upvotes: 1

Related Questions