First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Aditya Sharma aka adit_ya_sharma | Website: http://www.ctoffakes.tk

Object Creation

1)Open up your .fla once again. Click on the first frame on the main timeline and open up the actions window. 2)Type the following code for making an object for the class:-
var myCircle:Circle = new Circle(circle_mc);
3)The 'circle_mc' is the instance name of the MovieClip 'Circle', as told earlier, and myCircle is the name of the object of the class. 4)Now we need an enterFrame function with the Keypress condition check, which will execute the moveRight() method of the 'circle class. The whole code of the frame now looks like this:-
var myCircle:Circle = new Circle(circle_mc);
onEnterFrame = function()
5)Save it. Ctrl+Enter to test the movie. 6)Press right to see if the circle moves to the right. It should I guess :), did'nt try it in flash, just writing from the top of my head. 7)Party! I hope this example gives you a jump start to the world of classes in AS 2.0.
» Level Intermediate

Added: 2005-10-12
Rating: 7 Votes: 9
» Author
Iam a flash actionscript programmer.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.