PDA

View Full Version : Some help with a piece of coding..



Bless
December 22nd, 2004, 02:39 PM
Hello. I need some help with a piece of coding. On the click of a button, pics change position. However, I want the pics to change position on their own, without the use of any buttons. To give you a basic idea here is the code:

Button 1

on(press){
first_yPos = 0;
}

Button 2

on(press){
first_yPos = -250;
}

I'm quite sure there is a way for the pics to move with a/s, I just don't know how. Please help!! Thank you

maximum_flash
December 22nd, 2004, 03:04 PM
you want them to move when the movie loads?

Bless
December 22nd, 2004, 03:10 PM
Yes. Straightaway. Do you know how to do this? Thanks for ur help..

dyren
December 22nd, 2004, 04:40 PM
do you want the clips to slide to the second position? or to just load into that position.

if you want a slide, do you want it to ease to that spot?

give us a little more info plz.

maximum_flash
December 22nd, 2004, 08:56 PM
put this code on the clip.



onClipEvent (load){
_x= 0;
_y= 0;
speed=5; //determines how fast your object moves
}




onClipEvent (enterFrame) {
endX = 300; //desired x coordinate
endY = 100; //desired y coordinate
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}



this is a pretty straightforward easing technique.

Bless
December 23rd, 2004, 11:43 AM
Thanx guys. The cheque is in the post....

maximum_flash
December 23rd, 2004, 01:30 PM
:party: