Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Flash (all versions)
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2011, 12:33 PM
Registered User
 
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to move movieclips using code in AS 2.0

to move a movieclip in flash using code it is very simple, give the instance name of char (or any other name, but you will have to change the name in the code) to the movieclip you want to move.

open up the actions panel and click on your movieclip. now if you want to move the movieclip up with arrowkeys, copy&paste this code into the actions panel;

onClipEvent(enterFrame){

if(Key.isDown(Key.LEFT)){
_root.char._x-=10

// this can be copied&pasted, but do not copy the onClipEvent part
// don't forget that the y axis is reversed!
}
}

"char" is the instance name, and the _x can be changed to _y

dont forget to change it to RIGHT, UP, or DOWN





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I move on .....???? pennkaiser BOOK: Beginning ASP.NET 4 : in C# and VB 3 August 14th, 2010 03:18 AM
How do you move the mouse outside the form and to move diagonally? fangzhien Visual Studio 2005 0 July 28th, 2009 10:06 PM
Using VBA Code to Move Data Nanette Access VBA 1 November 3rd, 2006 04:16 PM
buttons and movieclips kocken85 Flash (all versions) 0 March 3rd, 2005 07:27 AM
Move a file via code fordrs3 VB How-To 2 June 26th, 2003 01:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.