Welcome, Have a Nice Friday


OnMouseDown Simulation - Swishmax

Learn how to substitute the OnMouseDown function in swishmax.



First Of All

Open swishmax and set the size for the movie, i have used 189 x 233

and frame rate of 25 fps..



Step.1

Create your object to control, as you can see i have created a helicopter for the purpose of this demonstration, if you do not have an object or cannot think of an object feel free to download an animated gif of the vector helicopter used in the demonstartion movie above.
Right click on the image below and save image as



Step.2

Import the helicopter.gif into swishmax and name the sprite as helicopter
and place the following code onto Scene_1

CODE:

onLoad () {
/*on (OnMouseDown) {
swishmax Work-a-round Code By Craig Lowe
http://www.swish-designs.co.uk
for more help or tuorials visit www.swish-designs.co.uk/forums
this credit must stay in place.
}
*/
scrollSpeed=5;
//sets up to false when the movie starts
up=false;
//hides system cursor
mouse.hide();
//hides custom cursor at runtime
cursor._visible=false;
//sets friction
}
on (press) {
//sets up to true when mouse button is down
if (_root.up==false) {
_root.up=true;
}
}
on (release) {
//sets up to false when mouse button is up(released)
if (_root.up==true) {
_root.up = false;
}
}
onEnterFrame() {
//checks every frame (looping)
if (up==true) {
//moves object up
helicopter._y = helicopter._y -4;
//rotates the object by 10 pixels
helicopter._rotation = -10;
} else if (up==false) {
//moves object down
helicopter._y=helicopter._y + 4;
////rotates the object by 10 pixels
helicopter._rotation = 10;
}
}
onEnterFrame() {
//sets boundaries
if (helicopter._y<26) {
helicopter._y=26;
helicopter._rotation = 0;
}
if (helicopter._y>208) {
helicopter._y=208;
helicopter._rotation = 0;
}
}
on (rollOver,dragOver) {
cursor._visible=true;
}
on (rollOut,dragOut,dragOver) {
cursor._visible=false;
}

 

Press CTRL+T to see it work in the flash player.

Latest Submissions

Site Overview

swish-designs.co.uk
relies on donations and purchases from users
to enable too keep this site running. as the site has grown in its content and reputation so has the cost of keeping this site going, thank you to all who help and have helped me achieve this goal. still many files are offered for free in the download center to help others learn and understand swishmax.
however files that acompany tutorials have a download fee as do shop files which help towards the the sites running costs, happy swishing.


Contact Me

You can use the following information
to either find or contact me.

Blog:www.loweonline.co.uk
Facebook: Facebook Group
E-mail: craig@swishdesigns.co.uk

Find Me At

Swishzone:Find Me There
Loweonline: Find Me There