Forum Topic: As3: Main

(35,844 views • 161 replies)

This topic is 6 pages long. [ 1 | 2 | 3 | 4 | 5 | 6 ]

<< < > >>
Happy

Denvish

Reply To Post Reply & Quote

Posted at: 5/5/07 04:30 AM

Denvish DARK LEVEL 45

Sign-Up: 04/25/03

Posts: 16,238

Cool stuff, got a reasonable collection of tuts already. At the moment, while the list is short, I'm not gonna be fussy about which to include - however, as the list grows, some pruning may take place. For now, though, hopefully this will make the learning process a little easier. Keep 'em coming, and once again thanks to the contributers.

AS3 TUTORIALS

AttachMovie via Class ID by Alphabit
Changing Framerate by Siggles
Custom Cursor by Jindo
Events by LesPaulPlayer
Global Buttons by ninjitsuwarrior
hitTests by Jindo
Key Input (AS2 Style) by dELtaluca
OOP by Alphabit
Pointing at Mouse by trig1
Rotate And Shoot To Mouse by Pyromaniac
Springs by trig1
Timer

OTHER USEFUL LINKS

AS3 Overview
Getting Started with AS3
Senocular's AS3 Tip of the Day
AS3 Cookbook Chapters as pdf
Flashscript.biz tuts
FlashWiki
AM Laboratories

AS3 (Flex) Language Specs
AS2.0 Migration
Actionscript Cheatsheet

- - Flash - Music - Images - -

BBS Signature

None

TrueDarkness

Reply To Post Reply & Quote

Posted at: 5/5/07 11:25 AM

TrueDarkness EVIL LEVEL 27

Sign-Up: 08/31/04

Posts: 4,718

I'm interested in a tutorial that teaches you how to move an object with the arrow keys. While delta's tutorial is fantastic, I'm not looking for ways to make it like AS2, I want to learn the actual methods used in order to make it work. I've got something like this so far, but I'm not sure how to assign specific keys yet:

stage.addEventListener(KeyboardEvent.KEY_DOWN ,downEF);
stage.addEventListener(KeyboardEvent.KEY_UP ,up);
function downEF(KeyboardEvent) {
stage.addEventListener(Event.ENTER_FRAME, down);
}
function down(Event){
obj.x+=2
}
function up(KeyboardEvent){
stage.removeEventListener(Event.ENTER_FRAME, down);
}


None

RyanPridgeon

Reply To Post Reply & Quote

Posted at: 5/5/07 11:38 AM

RyanPridgeon LIGHT LEVEL 11

Sign-Up: 12/07/05

Posts: 1,972

Why not use delta's thing?

Anyway, here's a thing i made to see what As3 was like

import flash.events.*;
import flash.display.*;
var moving:Number=0;
var speed:Number=4;
stage.addEventListener(KeyboardEvent.KEY_DOWN ,keyDownFunction);
function keyDownFunction(event:KeyboardEvent):void {
if (event.keyCode==39){
moving=1;
}else if (event.keyCode==37){
moving=-1;
}
}
stage.addEventListener(KeyboardEvent.KEY_UP ,keyUpFunction);
function keyUpFunction(event:KeyboardEvent):void {
moving=0;
}
function mainframe(event:Event):void{
if (asds.hitTestObject(wall)){
while (asds.hitTestObject(wall)){
asds.x-=1;
}
}
if (moving!=0){
asds.scaleX=moving
}
asds.x+=moving*speed;
}
addEventListener(Event.ENTER_FRAME, mainframe);

I make flashes because I can.
PM me for anything flash or web related or visit my blog here on NG!
Also, here's my DICK

BBS Signature

None

Pyromaniac

Reply To Post Reply & Quote

Posted at: 5/5/07 02:37 PM

Pyromaniac EVIL LEVEL 18

Sign-Up: 01/14/05

Posts: 2,974

At 5/5/07 11:25 AM, TrueDarkness wrote: I'm interested in a tutorial that teaches you how to move an object with the arrow keys.

// What your looking for is keyC ode, and we use event.target to refer to what calls the event

var speed:int = 5;
var box:Sprite = new Sprite;
with (box.graphics) {
lineStyle(1, 0x000000, 100);
lineTo(0,10);
lineTo(10,10);
lineTo(10,0);
lineTo(0,0);
}

addChild(box);
box.x=250, box.y=200;

function checkKey(event:KeyboardEvent):void {
if (event.keyCode == 39) {
box.x+=speed;
}
if (event.keyCode == 37) {
box.x-=speed;
}
if (event.keyCode == 40) {
box.y+=speed;
}
if (event.keyCode == 38) {
box.y-=speed;
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN , checkKey);


None

Denvish

Reply To Post Reply & Quote

Posted at: 5/5/07 03:43 PM

Denvish DARK LEVEL 45

Sign-Up: 04/25/03

Posts: 16,238

Guys, requests for tutorials are OK, but please try to keep from posting code snippets or discussing that in here. If you know the code to help out, then create a new AS3: Topic - even if you don't, you can still start the topic, share what you know, and ask others to fill out any gaps. The advantage of having separate threads for each subject is that people can post their own approaches to the problem, point out errors (politely), or simply enhance the topic starter's code.

That's not to say you should start a topic if you have only half-learnt something, you should at least be confident in the fact that your code will actually work :)

In terms of what tutorials to do (if you have free time and the urge to write a tut for AS3), feel free to have a look through the topics in AS: Main, and adapt those that AREN'T obvious, ie, where the AS3 code is virtually identical to the AS2 code.

I'll leave these posts for a bit but I'll be clearing them out before they pass the 7-day limit. Wanna try and keep this thread as compact as possible.

...wonder if we'll reach 50 pages before AS4 comes out.....? :D

- - Flash - Music - Images - -

BBS Signature

None

LesPaulPlayer

Reply To Post Reply & Quote

Posted at: 5/6/07 03:26 PM

LesPaulPlayer DARK LEVEL 12

Sign-Up: 05/18/06

Posts: 673


None

LesPaulPlayer

Reply To Post Reply & Quote

Posted at: 5/6/07 04:10 PM

LesPaulPlayer DARK LEVEL 12

Sign-Up: 05/18/06

Posts: 673


None

hashbrown

Reply To Post Reply & Quote

Posted at: 5/9/07 12:18 AM

hashbrown LIGHT LEVEL 16

Sign-Up: 07/07/05

Posts: 3,068


None

Denvish

Reply To Post Reply & Quote

Posted at: 5/10/07 06:08 PM

Denvish DARK LEVEL 45

Sign-Up: 04/25/03

Posts: 16,238


None

phyconinja

Reply To Post Reply & Quote

Posted at: 5/11/07 05:42 PM

phyconinja EVIL LEVEL 25

Sign-Up: 09/18/04

Posts: 2,828


None

ShooterMG

Reply To Post Reply & Quote

Posted at: 5/11/07 08:11 PM

ShooterMG EVIL LEVEL 03

Sign-Up: 11/10/06

Posts: 267


None

TrueDarkness

Reply To Post Reply & Quote

Posted at: 5/12/07 12:47 PM

TrueDarkness EVIL LEVEL 27

Sign-Up: 08/31/04

Posts: 4,718


None

trig1

Reply To Post Reply & Quote

Posted at: 5/12/07 03:11 PM

trig1 NEUTRAL LEVEL 15

Sign-Up: 10/04/05

Posts: 2,102

Would it be a good idea to link to tutorials that are in AS: Main, but work for as3 and 2. Things like arrays, or loops; otherwise it would take a long time rewriting things already made and working.

BBS Signature

None

jesseRYU

Reply To Post Reply & Quote

Posted at: 5/12/07 03:30 PM

jesseRYU EVIL LEVEL 10

Sign-Up: 02/17/07

Posts: 1,305

Does AS3 have the same basics from AS2 like the hitTests or is it completely different?

New at flash then get some help.

BBS Signature

None

phyconinja

Reply To Post Reply & Quote

Posted at: 5/12/07 03:41 PM

phyconinja EVIL LEVEL 25

Sign-Up: 09/18/04

Posts: 2,828

At 5/12/07 03:30 PM, jesseRYU wrote: Does AS3 have the same basics from AS2 like the hitTests or is it completely different?

dude. theres a hitTest tut. read the list.


None

jesseRYU

Reply To Post Reply & Quote

Posted at: 5/12/07 03:42 PM

jesseRYU EVIL LEVEL 10

Sign-Up: 02/17/07

Posts: 1,305

yehh my bad i noticed it 5 mins after i posted

New at flash then get some help.

BBS Signature

Happy

Depredation

Reply To Post Reply & Quote

Posted at: 5/13/07 02:29 PM

Depredation LIGHT LEVEL 17

Sign-Up: 09/05/05

Posts: 4,781

Flash CS3 Review/Overview

Could it be added to extras please :D.
BBS Signature

None

PrettyMuchBryce

Reply To Post Reply & Quote

Posted at: 5/14/07 01:46 PM

PrettyMuchBryce LIGHT LEVEL 06

Sign-Up: 03/17/01

Posts: 1,340

I'd like to see a displacement filter tutorial.


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 5/14/07 02:01 PM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,315

http://www.newgrounds.com/bbs/topic.php?id=70 1485
Could make one. But then again, it took me a whole two minutes to understand it and might require a whole page of words to qualify as a useful explanation for others.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

PrettyMuchBryce

Reply To Post Reply & Quote

Posted at: 5/14/07 02:05 PM

PrettyMuchBryce LIGHT LEVEL 06

Sign-Up: 03/17/01

Posts: 1,340

At 5/14/07 02:01 PM, GustTheASGuy wrote: Could make one. But then again, it took me a whole two minutes to understand it and might require a whole page of words to qualify as a useful explanation for others.

I'd really appreciate it. I am so confused as to how to even do a simple one. Its much more difficult than adding a more simple filter like glow or blur.


None

Rammer

Reply To Post Reply & Quote

Posted at: 5/14/07 06:28 PM

Rammer DARK LEVEL 32

Sign-Up: 06/08/03

Posts: 4,332

At 5/14/07 01:46 PM, PrettyMuchBryce wrote: I'd like to see a displacement filter tutorial.

i've wanted to see one for a while now ):

it's things like this and this that got me so insanely interested in the DisplacementMapFilter.

snyggys


None

Naois

Reply To Post Reply & Quote

Posted at: 5/15/07 04:16 PM

Naois LIGHT LEVEL 20

Sign-Up: 10/31/05

Posts: 551

This might be good for an "Other Useful Link": Learning AS3 with the Flex 2 SDK for Free
It's an article on how you can compile AS3 *.as files using Flex's SDK, while spending absolutely no money.


None

Battered-Prawn

Reply To Post Reply & Quote

Posted at: 5/19/07 06:13 AM

Battered-Prawn NEUTRAL LEVEL 12

Sign-Up: 08/02/06

Posts: 1,170

Ive looked everywhere, posted on the forum and looked here! now please can someone help me!

can you guys give me the AS3 (not AS2... or 1) to all of the movie control buttons. so far ive got the play button, now i need stop gotoframe onevent and stopall sounds.

pleasey please reply!!!

Why not send me a PM, or visit my User Page

BBS Signature

None

3dwarrior

Reply To Post Reply & Quote

Posted at: 5/19/07 03:04 PM

3dwarrior NEUTRAL LEVEL 10

Sign-Up: 11/03/03

Posts: 390

At 5/19/07 06:13 AM, Battered-Prawn wrote: can you guys give me the AS3 (not AS2... or 1) to all of the movie control buttons.

Look on the AS2 Migration Sheet, but I think someone needs to create a new tutorial as we don't want to teach people the old methods, as that can get confusing for new people and learning AS2 if you have no previous experience is a waste imo.

AS2 Main | AS3 Main | Flash Wiki There is no excuse for not trying to learn. Linux.

BBS Signature

None

Naois

Reply To Post Reply & Quote

Posted at: 5/22/07 09:29 PM

Naois LIGHT LEVEL 20

Sign-Up: 10/31/05

Posts: 551

At 5/5/07 04:30 AM, Denvish wrote: OTHER USEFUL LINKS
AS3 (Flex) Language Specs
AS2.0 Migration

These both point to the Flex 2.0 specs, and 2.01 now exists. You may want to either update them to AS3 (Flex 2.01) Language Specs and AS2.0 Migration (Flex 2.01) or add them below the current links.


None

shazwoogle

Reply To Post Reply & Quote

Posted at: 5/25/07 02:35 AM

shazwoogle NEUTRAL LEVEL 11

Sign-Up: 09/27/04

Posts: 2,674

[Link] Thers a very handy article I found, not sure if its already there but it helped me alot.


None

Skeik-Sprite

Reply To Post Reply & Quote

Posted at: 6/6/07 01:24 AM

Skeik-Sprite LIGHT LEVEL 15

Sign-Up: 06/19/05

Posts: 1,398

I dunno if anyone's covered it, but there really should be an array tutorial.

Programming with arrays make the addChild and removeChild things a lot easier, because you can just load the children in the array onto the stage and reference them individually from the array. I hope I'm not an idiot and the only person who hasn't figured this out.

I think I may write a tut on it tomorrow.


None

3dwarrior

Reply To Post Reply & Quote

Posted at: 6/6/07 02:11 AM

3dwarrior NEUTRAL LEVEL 10

Sign-Up: 11/03/03

Posts: 390

At 6/6/07 01:24 AM, Skeik-Sprite wrote: I dunno if anyone's covered it, but there really should be an array tutorial.

If you were to teach about arrays, then you would try to teach the underlying idea of the array and how to use it. I can't really figure out what would be the difference from the AS2 tutorials that teach you about arrays and one that you would create for AS3 aside from examples which might be useful to use specifically in AS3.

Then again, we still don't have a link in AS3:Main for arrays, and it would get rid of the dependence of the "starting to become old" AS:Main. So why not?

AS2 Main | AS3 Main | Flash Wiki There is no excuse for not trying to learn. Linux.

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 06:25 AM

<< Back

This topic is 6 pages long. [ 1 | 2 | 3 | 4 | 5 | 6 ]

<< < > >>
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!