Forum Topic: Easiest way to learn actionscript?

(183 views • 11 replies)

This topic is 1 page long.

<< < > >>
Resigned

CkGordon

Reply To Post Reply & Quote

Posted at: 11/8/09 05:37 AM

CkGordon LIGHT LEVEL 09

Sign-Up: 04/13/05

Posts: 477

I really want to learn actionscript but I dont have any programming knowledge whatsoever... so what's the easiest way to learn? Can someone recommend me a good book? Im not sure what version of actionscript I have... I think 2.0 but not positive... im using MX 2004. Im extremely familiar with the controls of flash as I've been using it for like 5 years but I'd really like to start making games. I tried reading a book on actionscript like a few years ago but felt kind of overwhelmed and confused... prolly the ADD and the fact that I was working 3 jobs at the time :P . I've been checking craigslist to see if theres a tutor but it doesnt seem like this is something you can find a tutor for so is there any really easy to understand books or videos or anything, and how did you learn? I'm unemployed right now so I have a bunch of unwanted free time and would really like to do something constructive with it and believe this would be great.

The preceding statement was bullshit.
Playstation Network: CkGordon
Battlefield: Bad Company 2 March 2nd, 2010

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/8/09 05:55 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,608

let me start by saying, i self tough myself, to a extend. In my opinion the number one way to learn is using newgrounds, and not being afraid to go for it. A extreamly important like, that is a must too bookmark, is the AS2: Main (yes, you have as2. as3 was only bought out by adobe in cs3 and cs4 and soon to come cs5). Scroll down to the bottom 2 posts, as these are the two most important ones. Go through the posts that look important to you in the begginers section. Read it, try thinking about it in your head, and try scripting the example (assuming there is one). One you got that, try to rewrite it without looking back too much unless you are really stuck. Then move on to the next. You'll soon enough get use to how the world of coding works, start to learn syntaxs and so on...

Once you feel you know some basics, try making a very small game just to experement with. Dont be scared to try something your not sure of, because failure is the fastest method of learning (and also the fastest way to get gray hair). If your not sure about something, see if you can find help on the AS: Main post, or (and this is usually extreamly helpful) by right clicking a keyword (usually turns blue) and viewing the help files on it. If none of that works, feel free to post a topic on the forums and you'll be gladly help (you can even send me a pm).

One important thing i must mention is try to code in frames as much as possible. You'll get a lot more respect and help from users because its easier to follow, and you'll better prepare yourself for new languages, and in general its just so much better. Unfortunatily alot of the tutorials on the AS: Main is in movieclip coding, so you'll have to try and convert it. Its quite easy though:

firstly, coding in the timeline means you never have to refer too _root. as the timeline is the root
If you want to change any movieclip's values its just:

MyMovieClipName.MyMovieClip'sValue

second is functions:

MovieClip code:
onClipEvent (enterFrame) {

timeline code:
function onEnterFrame () {

(enterFrames means that the code in between the { and the } is run every 1/fps seconds

MovieClip code:
onClipEvent(load){

timeline code:
not needed, as you can code without a function
(load) is run only once ever, so by not putting any code in a function means that it will only happen once (such as variable declaration)

buttons:

on(press) {

is the same as:

myButton.onPress = function () {

and ill let you work out how to do on release, etc...

Like i said before, dont be afraid of a challenge, check out the as main, and please do post if you need help, its the only way to learn!

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

CkGordon

Reply To Post Reply & Quote

Posted at: 11/8/09 07:10 AM

CkGordon LIGHT LEVEL 09

Sign-Up: 04/13/05

Posts: 477

I've been looking over the ASmain thread and also some of the actionscript tutorials on the help page. But I still dont understand the formatting of actionscript. What exactly the { and } do and when I should capitalize and when not to capitalize and where to insert periods... not to sound like a complete dumbass lol but Id really like to learn from scratch... square one... ya know?

The preceding statement was bullshit.
Playstation Network: CkGordon
Battlefield: Bad Company 2 March 2nd, 2010

BBS Signature

None

grafik2d

Reply To Post Reply & Quote

Posted at: 11/8/09 08:32 AM

grafik2d NEUTRAL LEVEL 10

Sign-Up: 06/29/04

Posts: 185

At 11/8/09 07:10 AM, CkGordon wrote: I've been looking over the ASmain thread and also some of the actionscript tutorials on the help page. But I still dont understand the formatting of actionscript. What exactly the { and } do and when I should capitalize and when not to capitalize and where to insert periods... not to sound like a complete dumbass lol but Id really like to learn from scratch... square one... ya know?

You use the {} "Braquets" to limit the scope of your code

if I write this someCode1 will execute at your frame rate (ideally between 25-30 frame per second) and someCode2 will execute only once.

stop();
onEnterframe=function(){
someCode1 like myHero._y++
}
someCode2 like myHero._x++

another use of braquets is for if statement. In this case the code only execute if a certain condition is true, else will execute the code if the condition is false. (when you become famillar whit "if" check out "while","for" and "switch")

if(some condition like myHero._x>200){
myHero._y++
}else{
myHero._y--
}

When you use instance name you cannot put spaces in between words like my hero, instead we use camel typing as a convention the rule is simple capitalize the firs letter of every word after the firs one. EX: my hero becomes myHero.

Dots are use to represent the target path. If I have a movie clip called humain and this clip as a clip inside called leftArm then the path is _root.humain.leftArm. When you put a dot at the end of the target path you access the properties of the movie clip _root.humain.leftArm. _x. Properties includes _x,_y,_xscale,_yscale,_alpha,_rotation. you can also create your own property like _root.myCar.carMaker="Ferrari" or _root.myHero.Xspeed

This should help you get started


None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/8/09 08:41 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,608

The first 3 or so weeks is always the toughest. Basicly:

( ) is parameters. You'll usually not use them that much till you get use to flash.

{ } are loops. Basicly anything that is between those two will run when the line that it was opend { is true

eg:
if(STATEMENT_A){
if(STATEMENT_B) {
//CODE FOR WHEN THE STATEMENT IS TRUE
}
}

if STATEMENT_A is true (eg 1<2) then what ever is between it's { } will be run, in this case statement_b. if it was false, every single thing, incluiding even checking the status of statement_b, is skiped.

another common example is functions such as onEnterFrame
This works a little different then if statements, because it doesint check if something is true. Regardless, everything inbetween its { and its } will be run when the program sends it onEnterFrame command (1/fps times per second)

" " is string. Basicly string is a variable that is letters based

[ ] is an array (there is a topic about it in the intermediate section, its not very important to begin with)

as for capatilization, its just something you have to learn. Usually (because its a key word and not a key phrase) key words are a single word, but contatins a whole phrase eg. getNextHighestDepth() (not important now what it means). as you can see, every new word has a cap. Also, variable types begin with a cap, eg. Number String Array etc...

also lasly, before you get confused, if a key word ends in () like getNextHighestDepth() its a function call. U'll understand it better about 4 months in, for now just accept it and learn it. Thats why i told you to practice the code on your own so you can learn all the keywords and what they do.

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

bnwproductions

Reply To Post Reply & Quote

Posted at: 11/8/09 08:45 AM

bnwproductions LIGHT LEVEL 03

Sign-Up: 09/07/07

Posts: 503

The best way is practice. What you do is you look for how to do whatever it is you wanna do. Look for tutorials on the internet for it and shit like that... Pretty soon, you'd have done these things so much that you've learned actionscript! Well, some, at least.

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/8/09 08:45 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,608

At 11/8/09 08:32 AM, grafik2d wrote: the same thing i wrote, but faster

Yup, i forgot to mention the . But as he said, its to refer to that target path. So if your coding on the timeline, and you have a instance name called myGuy, you can access all of it's properties by referring to it, eg: myGuy.someProperty

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

Elated

CkGordon

Reply To Post Reply & Quote

Posted at: 11/8/09 02:30 PM

CkGordon LIGHT LEVEL 09

Sign-Up: 04/13/05

Posts: 477

Thanks these comments are really helpful. I spent all night going through the tutorials and reading the forums and experimenting. I managed to make a dynamic text box displaying 100 health with a button that you click to minus 5 (and understanding it) and also make it so that when the health reached 0 it goes to a different keyframe and stops and also made a button that when you click it causes a movie clip on screen to rotate :P . I know, hardly impressive but it's a start. I got a couple hrs of sleep and now im gonna stop by the library and see what books they have available. Another thing I experimented with (not actionscript related really but still pissed me off) was trying to make it so if you hover over a button in the corner of the screen text would appear in the center of the screen... but every time you hover over the center of the screen it would still act like you were hovering over the button. Not sure what I was doing wrong but oh well.

The preceding statement was bullshit.
Playstation Network: CkGordon
Battlefield: Bad Company 2 March 2nd, 2010

BBS Signature

None

Johnny

Reply To Post Reply & Quote

Posted at: 11/8/09 03:00 PM

Johnny DARK LEVEL 21

Sign-Up: 04/17/04

Posts: 4,594

At 11/8/09 02:30 PM, CkGordon wrote: Thanks these comments are really helpful. I spent all night going through the tutorials and reading the forums and experimenting.

Then you're well on your way. I generally read/tutorial, then use that information and experiment the hell out of it.

All sites currently down. Deal with it. <3

BBS Signature

None

grafik2d

Reply To Post Reply & Quote

Posted at: 11/10/09 12:09 PM

grafik2d NEUTRAL LEVEL 10

Sign-Up: 06/29/04

Posts: 185

At 11/8/09 02:30 PM, CkGordon wrote:

Another thing I experimented with (not actionscript related really but still pissed me off) was trying to make it so if you hover over a button in the corner of the screen text would appear in the center of the screen... but every time you hover over the center of the screen it would still act like you were hovering over the button. Not sure what I was doing wrong but oh well.

Did you by any chance placed the text inside the button? trySomething like this on the main timeline. Dont't forget to change the instance name.

stop();
myText._visible=false
myButton.onRollOver=function(){myText._v isible=true}
myButton.onRollOut=function(){myText._vi sible=false}


Shouting

hdxmike

Reply To Post Reply & Quote

Posted at: 11/10/09 12:23 PM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,839

Holy shit yambanshee , you just made everyone feel insignificant for a second there.

Well i might as well jump in and say.
Essential Actionscript 2.0 by colin moock
Kirupa
Tutorialized
NG tutorial collection
Emanuele fertanano ( or something )
8 bit rocket
Adobe documentation

just some good sites to get you started ( Essential AS2 is a book though )

Also dont piss around with a teacher , AS is best self taut

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/10/09 12:51 PM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,608

At 11/10/09 12:23 PM, hdxmike wrote: Holy shit yambanshee , you just made everyone feel insignificant for a second there.

haha, that would be a first :]

yea, i had previous scripting knowledge (in a programed aimed at 10-) but still even after 4 hours, and a direct tutorial on it i was still so proud the first time i made a character move with keys! and then with a bit more practice i made walls, and i just got a jittery happy feeling from inside. Now it takes me under 10 seconds in a more complicated language to get the same result :]. But the fact that you presiveeded shows potential, and in programming commitment and understanding is a lot more important then pure knowledge, as knowledge can be learnt where as commitment is based purly on the person.

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 12:47 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!