[FMX] Shape Tweening With Ease Via AS

Hi I have hit a road block yet again. How would I go about tweening a simple square with AS and with ease. Figure a box about 30x30 to about 300x300.

Thanks in advance

// part 1
box = createEmptyMovieClip("mc", ++depth);
box.beginFill(0xff6600, 70)
box.moveTo(-15, -15)
box.lineTo(-15, 15)
box.lineTo(15, 15)
box.lineTo(15, -15)
box.lineTo(-15, -15)

box._x = (Stage.height/2)-15
box._y = (Stage.width/2)-15

// part 2
box.onEnterFrame = function() {
	var diff = Math.round(300-this._width)
	this._width += diff/4
	this._height += diff/4
}

the first part of the script draws the box and positions it at the middle of the stage… the second part does the easing :slight_smile:

thank you very much, that was an excellent example :slight_smile:

in these two lines

this._width += diff/4
this._height += diff/4

try different values instead of 4 :slight_smile:

A3, i can’t seem to make a border around my mc that i created. i looked up the drawing methods in the reference but can’t seem to find what i need. i then thought of creating an addition mc that would be just the border or the box(mc) but i also can’t figure out how to take the fill out. when i use endFill() the box dissapears. any ideas?

thanks

can i have a look at the code (no fla:))

yes you may


box = createEmptyMovieClip("mc", ++depth);
box.beginFill(0xffffff, 80)

box.moveTo(-5,-5)
box.lineTo(-5,5)
box.lineTo(5,5)
box.lineTo(5,-5)
box.lineTo(-5,-5)
box._x = 160
box._y = 225

box.onEnterFrame = function() {
        var diff = Math.round(275-this._width)
        this._width += diff/2
        this._height += diff/2
}

i have 2 more boxes as well, but i wont post it cuz im sure you’ll see what i mean

oops ahmed i refered to you before as A3, sry about that :slight_smile:

the code works fine here… you’re using white for fill color, maybe that’s why you don’t see it :beam:

no no, i see it but i want it to have a different color border

aahh sorry

just use lineStyle(0, 0xff6600); instead of beginFill :slight_smile:

sweet i tryed something like that but i couldnt get it to work.

thanks again :slight_smile:

why not try

onClipEvent(load) {

_x = 0
_y = 0
scaleSpeed = 10
speed = 5
endx = 300
endy = 300

}

onClipEvent(enterFrame) {
this._xscale += (500 - this._xscale) / scaleSpeed; //or try scaleSpeed
this._yscale += (500 - this._yscale) / scaleSpeed;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;

}