Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads | All Downloads

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Swish Templates
   SWiSH Climax
   GimpTalk
   Idea Designs
   Sposatoettore
   Try Acai Berry Diet
   Download Free Ringtones
   Swishzone

Manage your site with Flax Article Content Management System
Transmission of Movement with Easing
Category : SWiSHMax | Level : Beginner | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

Hi all:

There is an easy tutorial of Transmission of Movement with easing.

a) We need a sprite motor (movement) with next code:

onEnterFrame() {
moveTo = _root.destiny;
pos_clipPresent = _root.clip._x;
distance = moveTo-pos_clipPresent;
speedMov = distance/5;
_root.clip._x = _root.clip._x+speedMov;

}

cool.gif 3 Buttons(but1,but2,but3) or more with next code:

1st button:

on (release) {
_root.destiny=but1._x
}

2ond button:

on (release) {
_root.destiny=but2._x
}

and so on.

c) The sprite that we want move, on our example is a square named "clip".

Well i try to explain a little, we have on the timeline a variable named "destiny", that have a 0 value when the movie start.But every button change destiny value, equaling the variable "destiny" to value x of the button:

_root.destiny=but2._x

Now we want see how works destiny variable with sprite "movement".On movement script we have a new variable that takes the value of "destiny".(moveTo)

moveTo = _root.destiny

after we check _x.clip position on this moment.

pos_clipPresent = _root.clip._x;

next steep we calculate the distance of the button position (moveTo) and sprite "clip" position (pos_clipPresent ):

distance = moveTo-pos_clipPresent;

Now we give a speed for the movement:

speedMov = distance/5;

and finally we come to move the sprite "clip".

_root.clip._x = _root.clip._x+speedMov;

Thatīs all.

Take a look Transmission of Movement

Enjoy


All rights reserved - swish-db.com