Move parent object by half

newbie-question

#1

Hi! I’m trying to do something very simple in terms of coding but I can’t find the way in Axure. I have a circle and a square. When i drag the circle in x I want the square to move in x but by half the pixels.
So far I put in the circle the interaction OnDrag-move-this.x and move-square-drag x.
I tried setting some variables but I couldn’t get it either.

Thanks!


#2

Hi!

You can use the built in property DragX in the OnDrag event. DragX is the distance you’ve dragged since the last OnDrag event. (The OnDrag event fires constantly while you are dragging.) In fact…

OnDrag
  Move this by [[DragX]], 0

…is identical to:

OnDrag
  Move this with drag (horizontal only)

So in your case you could do this:

OnDrag (of circle)
  Move This by [[DragX]], 0
  Move (square) by [[DragX/2]], 0

#3

I can’t believe it, it was so easy. My mistake was that I used ‘With Drag x’ instead of ‘Move by’. Thank you very much!


closed #4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.