all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

Moving Photos


Moving Photos Paul_Pacey
11/28/2004 10:53:05 PM
flash actionscript:
I'd like to be able to move a row of photos horizontally whose direction and
speed depends on where a user moves their mouse on the horizontal axis.

I don't know code but am trying to find some type of action script that will
get me moving in the right direction. Does Flash have anything like this or do
I have to know how to write code manually?

I like figuring this stuff on my own but if someone could at least point me
in the right direction it would be greatly appreciated :)

Thanks, Paul
Re: Moving Photos mandingo
11/28/2004 11:54:14 PM
To my [limited] knowledge, there is not a component that will do it... but it
shouldn't take a lot of scripting either...

If you have your images placed in a movieClip across the stage and set a
registration point in the centre of the movieClip, then when the mouse moves to
the right, find the difference between _xmouse and the registration point and
move your photos movieClip to the left using photoClip._x -=5; or similar
variant. Then work into that an acceleration variant so that it moves faster
as it gets further away.

This then can be placed in an onEnterFrame event or combined with a hitTest on
the mouse to make sure that the mouse is over the slider before it starts.

I haven't gone into much detail... just a pointer... there are a couple of
people on this forum that have made 360 degree sliders in this fashion and they
may assist...

I think www.flashfugitive.com could be a place to go to see some work like
this.

cheers
Re: Moving Photos NSurveyor
11/29/2004 12:26:52 AM
Convert each image into a movieclip. Then give each on an instance name.
Finally on the frame that holds these movieclips, paste in this actionscript:
===============================================
//For each image add this line of script: followX(THE_MCS_INSTANCE_NAME,SPEED);
//NOTE: THE LOWER THE SPEED SETTING THE FASTER!
//The 4 lines below are sample ideas on how to use the script:
followX(myMC4,40);
followX(myMC3,20);
followX(myMC2,10);
followX(myMC1,5);
//End of sample lines. Everything below is necessary.
function followX(object,ease) {
object.intervalID = setInterval(followOnce,1,object,ease);
}
function followOnce(object,ease) {
easing = Math.abs(_xmouse-object._x)/ease;
object._x+=(Math.abs(_xmouse-object._x)/(_xmouse-object._x))*easing;
if (Math.abs(_xmouse-object._x)<easing) {
object._x = _xmouse;
}
updateAfterEvent();
}
=======================================================

AddThis Social Bookmark Button