Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-26-2007, 06:12 PM   #1
eyeronik
Senior Member
 
Join Date: May 2005
Posts: 156
Default actionscript 3 what is a class?

Im having a lot of trouble trying to understand the new actionscript 3 and wondering whether to do my final uni project in as3, although im a designer that means i wont be expected to code things in a job, (so ive been told). The problem is I have a deadline, I know how to use actionscript 2 and I have a lot of work to do and learning new scripting method which is difficult wont get me anymore marks and may make my work worse visually etc because I wont be able to code the things I want.

Now I would however like someone to explain to me what classes are, Ive read some explanations, some of which dont even make sense.

So in actionscript 2 Id create a variable, turn it to on, or 100 then Id just say variable now is 60 etc. This is quite easy to understand. Now they have changed everything!

I just dont understand the setup. I read you have to now import things at the start of everything. I have read everything is now an object. It was before wasnt it!

I hope someone can just explain the setup in a better way or link to a good explanation because the ones I have found I dont really think the people fully understand it.
eyeronik is offline   Reply With Quote
Old 11-26-2007, 09:20 PM   #2
ryryguy
Scripts with Action!
 
ryryguy's Avatar
 
Join Date: Aug 2007
Location: Seattle, WA
Posts: 164
Default

A good analogy for classes and objects: think of classes as cookie cutters, and objects as cookies.

With a gingerbread man cookie cutter (class), you can stamp out many gingerbread man cookies (objects). The cutter defines the initial shape of the gingerbread man - two arms, two legs, two heads. Each cookie, though, is its own entity. Bite off the arm of one cookie, and now it only has one arm. However, all the other cookies on the tray aren't affected - they still have two arms. And if you make a new cookie using the cutter, it will start out with two arms.

In AS 3 not all objects are made from classes. There are primitive types like int and Boolean and you can still make variables of those and just set them to True/False, 100/60.

You don't have to make your own classes really. You may have to use some classes that are part of the AS3 library, like Sprite, Font, Array, and Loader. For these you may have to use an import statement, but that's pretty easy. In the documentation at the top will be something that says "Package". Just stick a period on the end and the name of the class after that, and put "import" in front of that, and you have the import statement you need, like
ActionScript Code:
import flash.display.Sprite; // "flash.display" is the package, "Sprite" is the class

Put that at the top of the first frame of code and you can use "Sprite" anywhere in the timeline.
ryryguy is offline   Reply With Quote
Old 11-27-2007, 03:43 AM   #3
theRemix
Senior Member
 
Join Date: Nov 2006
Posts: 111
Default

Quote:
Originally Posted by ryryguy View Post
... shape of the gingerbread man - two arms, two legs, two heads. ...
nice dual core gingerbread men you got there.
theRemix is offline   Reply With Quote
Old 11-27-2007, 03:48 AM   #4
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,141
Default

classes are one complete idea. They are a group of functions (called methods) and variables (called properties) contained in a file.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 11-27-2007, 05:48 PM   #5
ryryguy
Scripts with Action!
 
ryryguy's Avatar
 
Join Date: Aug 2007
Location: Seattle, WA
Posts: 164
Default

Quote:
Originally Posted by theRemix View Post
nice dual core gingerbread men you got there.



You think that's something, you should see my animal crackers...
ryryguy is offline   Reply With Quote
Old 11-28-2007, 09:58 AM   #6
Clox
Flexer 'n Flasher
 
Clox's Avatar
 
Join Date: Nov 2004
Location: Sweden
Posts: 496
Send a message via MSN to Clox Send a message via Skype™ to Clox
Default

Quote:
Originally Posted by theRemix View Post
nice dual core gingerbread men you got there.
Haha, thanks a lot. That really made me laugh, I needed that! =D
__________________
You don't need a reason to help people. - Zidane/FF9
I wish there were more flashing girls. - ( |_ [] }{
Clox is offline   Reply With Quote
Old 01-27-2008, 11:37 PM   #7
eyeronik
Senior Member
 
Join Date: May 2005
Posts: 156
Default

sorry i didnt reply, thanks for the information!
eyeronik is offline   Reply With Quote
Old 11-27-2007, 01:12 PM   #8
jaga
Senior Member
 
Join Date: Nov 2007
Posts: 529
Default

From an artists point of view, there doesn't seem to be any reason to use actionscript 3 if you don't have to..

There are things you can do with code in AS3 that you can't do with AS2, but in terms of design and art I can't think of any real benefits.
jaga is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ActionScript 2.0 class scripts may only define class or interface constructs. vsgill ActionScript 2.0 5 02-12-2010 06:19 AM
Is it possible to know the column name of a datagrid column in Actionscript Class? tanusree Flex 2, 3 & 4 0 10-01-2007 12:15 PM
Using #include with an ActionScript 2.0 class file oris ActionScript 2.0 6 11-23-2006 02:42 PM
Reusable class ... ? xxlm ActionScript 2.0 3 01-18-2006 03:29 AM
Actionscript 2 class gotoAndPlay() problem :((( azerty ActionScript 2.0 3 10-05-2004 02:51 PM


All times are GMT. The time now is 10:02 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.