Skip to main content
Participant
June 22, 2006
Answered

Animation irregularity

I am very new to flash so please bear with me..

I am trying to create a simple interaction: when the user mouses over one coloured box that the second coloured box will move to the side (instead of partially covering the first box)

I have used this code:

on(rollOver){
red._x=10
}
on(rollOut){
red._x=-10
}

This provides what I am looking for, except when you mouse over for the first time, the 2nd box jumps to the side of the screen, any subsequent mouseovers and mouse offs results in the desired effect (but with the box having assumed a new origin half off the screen)

Any idea why this is happening? or a better suggestion on how to do this?
This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
June 22, 2006
if that code is attached to a movieclip then red must be a child movieclip and it's going to move to an _x position relative to its parent timeline. ie, if red is currently at 400 on its parent timeline, it will move quite a bit on the first rollover.

if you want red to move BY 10 pixels with each rollover/rollout use:

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 22, 2006
if that code is attached to a movieclip then red must be a child movieclip and it's going to move to an _x position relative to its parent timeline. ie, if red is currently at 400 on its parent timeline, it will move quite a bit on the first rollover.

if you want red to move BY 10 pixels with each rollover/rollout use:

Translate