Button to move plugin in X pixels increments (on each click)

  • Hi Guys,


    I'd like to create a button that moves a plugin in 160 px each time I click on it.
    Is it possible?


    The only thing I made is the change of the plugin position with this code:


    Code
    onclick="tween(plugin[img01].x, 150, distance(300,0.7), linear);"


    But it only moves to another position on the first click. I need to be an every click change of that amount (150px)


    I give up to try to make it! Just browsed the forum and couldn't find it though.

    Could I have your help please???

    Thanks,
    Daniel

  • I never used tween, so I don't know very well how it works, but there seems to be an argument for running an action when the tween is done, so if the new position is not getting saved you could try just plugging the add() call in there...

  • Don't know if I understood....


    The Tween makes the movement appear.
    Like... Go from here to there in 1 second.

    The SET makes a plugin that is here, appear there in a click.

    Anyone know if it's possible to tween every 150px in each "onclick"??

    Thank you again!!
    Daniel

  • Hi,


    Thank you Job.1


    with this code, I have to input it on the plugin that will change position.
    The situation is a Button that changes a plugin in that 150px increment, with smooth (rolling like) movement.

    But great to have you code!! Just thinking how to apply it correctly!!

    Thanks!!

  • Hi,

    Here an exemple using tween:

    Hope this help...

    SAlut.

  • Hi,
    It worked now, but it's like the other code:


    Code
    add(plugin[img01].x,180);


    It jumps to the other location.
    And... the last value that sets the end position is not working.

    Well.. no problem by now.
    It's working ok, instead i'd love to have a tween (scrolling) movement.


    EDIT: Ooops. Sorry.. I'll look the tween code now!!


    Thanks,
    Daniel

  • On the Michel's code

    on clicking the other plugin move, you have 2 différents solution *wink*

  • On the Michel's code

    on clicking the other plugin move, you have 2 différents solution *wink*

  • WOW!!
    LOVED THAT!! :)

    I have 2 arrows (left and right)


    I'm getting confused with these values....


    The original position of the img01 plugin is 315

    The increment is of 180 px


    I want to let user make only 4 clicks to the right.

    Things are messy there..

    Thaaaaaaaaaaaaaaaanks!!!
    Daniel

  • Hi Daniel,

    the action move_x_by(arg1,arg2,arg3,arg4); needs:
    arg1 = name of the plugin to be moved
    arg2 = inc or dec (increase/decrease)
    arg3 = value to increase/decrease by
    arg4 = max and min value for the inc or dec ( inc(var,byvalue*,max*,min*) )

    Hope this help...

    SAlut.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!