views:

16

answers:

1

I have a TextField and a Sprite both at y = -20; and they are in the correct position.

Then I do this tween.

Tweener.addTween(t, {y: 20, time:0.5, transition:"linear"});
Tweener.addTween(noteBar, {y: 20, time:0.5, onComplete:Hold, transition:"linear"});

(t is the TextField and noteBar is the Sprite)

What happens when I do this is that the Sprite goes to y = 0; but the TextField goes to y = 20;

It works correctly if I have the TextField y at 0 and the Sprite y at 20.

But then I need to do this to get them back into the original position.

Tweener.addTween(t, {y: -20, time:0.5, transition:"linear"});
Tweener.addTween(noteBar, {y: 0, time:0.5, transition:"linear"});

Because if I let the Sprite go -20 then it will end up at y = -40;

Why does it act this way?

+1  A: 

When you say that "both are at y=-20", are you using the info palette in Flash to determine this?

I ask because the info palette has two modes for displaying the x,y: Registration and Transformation. This is toggled by clicking on the small registration point icon to the left of the X field in the info palette.

The problem is that in Transformation mode, the x,y displayed will be the CENTER of the textfield, but in reality, the x,y of a text field is the top left.

So, the short answer is to make sure the info palette is in Registration mode (the icon with the cross-hair) then put the text field at -20.

Another solution would be to wrap the TextField in a sprite so that it behaves the same way as NoteBar, in which case it doesn't matter what mode the info palette is in.

Of course if you are doing this all in code, not positioning the items in Flash, my solution is moot.

-Gabriel

Gabriel Jensen
I create all items in code. So for the text I determine t.y = -20; and for the sprite I do the same.
Ólafur Waage