TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

"Tween" from code?

Page: 1 Reply
Dec 23rd 2003#134720 Report
Member since: Apr 24th 2002
Posts: 55
I want to transform a symbol (rotate, move, scale) in a smooth way. Think of a box that when clicked slowly moves from one end of the screen to the other. Pretty simple using a motion tween. The tricky part is that the sysmbol I want to transform is being created at runtime and I don't think it's possible to use tweens at runtime (it would sure make me happy if it were).

Using an interval, I have adjusted the necessary properties of the symbol until I have achieved the 'desired' results. The problem is that the movement looks jumpy (if properties are adjusted by a number that's too large) or is way too slow. Should I keep experimenting with interval settings or is there an easier way around this?

Thanks.
Reply with Quote Reply
Dec 23rd 2003#134721 Report
Member since: Aug 9th 2001
Posts: 2333
runtime...? care to explaim?
Reply with Quote Reply
Dec 23rd 2003#134722 Report
Member since: Apr 24th 2002
Posts: 55
Let's consider the box example: I have created a rectangle and converted it to a symbol called mySymbol.

[php]
//create and attach
createEmptyMovieClip("clip", 1);
clip.attachMovie("mySymbol", "bla", 1);
clip.bla._x = 0;
clip.bla._y = 0;
[/php]

[php]
//now I want to move the rectangle from (0, 0) to (100, 100)
function moveIt(){
++clip.bla._x;
++clip.bla._y;
if( clip.bla._x == 100 ){
clearInterval(intt);
}
}

intt = setInterval(moveIt, 50);
[/php]

Can this be done in a simpler way? e.g: MoveBoxSmoothly(clip.bla, 100, 100).
Reply with Quote Reply
Dec 23rd 2003#134730 Report
Member since: Apr 25th 2003
Posts: 1977
I want to transform is being created at runtime and I don't think it's possible to use tweens at runtime (it would sure make me happy if it were).


Is there any way that u could duplicate the mc instead of creating it dynmaically? That way you could create your tween off stage and at the specific time in the movie just duplicate it and pull it down. You may have already thought of it.....not sure.....but its an idea.

The problem is that the movement looks jumpy (if properties are adjusted by a number that's too large) or is way too slow. Should I keep experimenting with interval settings or is there an easier way around this?


No easy way. Setting the interval will only work within the FPS you have. So if your movie is 12 frames per second and you want to move 100 pixels.....u can guess thats going to be jumpy. You can either crank your fps (if u can afford it and it doesnt affect your movie) or your just going to have to settle with the non-smooth tween.
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum