Flash Script - Showing Key Presses in Flash


Download the sample files here.

1. Create a circle and make it into a movie clip. Name it "circle".

2. Right click the movieclip, and click "action" to go to the actions tab.

3. Insert the action below:

// action to move left   onClipEvent (keyDown)   {   if (Key.isDown( key.LEFT))   {   _x-=10;   }   }  

// action to move right   onClipEvent (keyDown)   {   if (Key.isDown( key.RIGHT))   {   _x+=10;   }   }  

// action to move up   onClipEvent (keyDown)   {   if (Key.isDown( key.UP ))   {   _y-=10;   }   }  

// action to move down   onClipEvent (keyDown)   {   if (Key.isDown( key.DOWN ))   {   _y+=10;   }   }

4. Done! Press ctrl+enter to test the movie, and press the arrow keys to see it work.

Replay

Category: software Time: 2003-04-28 Views: 0
Tags:

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.233 (s). 12 q(s)