Be a Supporter!

AS3 pwned me!

  • 395 Views
  • 14 Replies
New Topic Respond to this Topic
Reeoz
Reeoz
  • Member since: Jul. 18, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
AS3 pwned me! 2008-11-18 20:17:35 Reply

Here is where I demonstrate my lame AS skills. Trying to make a lame play button, but new As3 pwned me.
BEfore, oh Holy AS2, I could just select my button, F9, and just go on(release)... and so on.
But now I don't know how the f*ck tomake a SIMPLE PLAY BUTTON!!!!
help, please.
Thanks.


Ich bin Mr. Reevers!
I OWN you all. Period.

BBS Signature
14hourlunchbreak
14hourlunchbreak
  • Member since: Jul. 27, 2007
  • Offline.
Forum Stats
Member
Level 30
Game Developer
Response to AS3 pwned me! 2008-11-18 20:22:42 Reply

At 11/18/08 08:17 PM, Reeoz wrote: Here is where I demonstrate my lame AS skills. Trying to make a lame play button, but new As3 pwned me.
BEfore, oh Holy AS2, I could just select my button, F9, and just go on(release)... and so on.
But now I don't know how the f*ck tomake a SIMPLE PLAY BUTTON!!!!
help, please.
Thanks.

Only god can help you now. Sorry, I don't have AS3 so I wouldn't know. I just had to post the first part for the lols.


BBS Signature
Reeoz
Reeoz
  • Member since: Jul. 18, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS3 pwned me! 2008-11-18 20:24:05 Reply

At 11/18/08 08:22 PM, 14hourlunchbreak wrote:
Only god can help you now. Sorry, I don't have AS3 so I wouldn't know. I just had to post the first part for the lols.

thanks a lot.


Ich bin Mr. Reevers!
I OWN you all. Period.

BBS Signature
MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to AS3 pwned me! 2008-11-18 20:25:42 Reply

button_btn.addEventListener(MouseEvent.CLICK,go_funct)

function go_funct (type:MouseEvent){
// gotoAndPlay or whatever
}

If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
14hourlunchbreak
14hourlunchbreak
  • Member since: Jul. 27, 2007
  • Offline.
Forum Stats
Member
Level 30
Game Developer
Response to AS3 pwned me! 2008-11-18 20:26:11 Reply

At 11/18/08 08:24 PM, Reeoz wrote:
At 11/18/08 08:22 PM, 14hourlunchbreak wrote:
Only god can help you now. Sorry, I don't have AS3 so I wouldn't know. I just had to post the first part for the lols.
thanks a lot.

You're welcome. Anytime you need help with AS2 just call. Oh wait......


BBS Signature
Reeoz
Reeoz
  • Member since: Jul. 18, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS3 pwned me! 2008-11-18 20:27:45 Reply

At 11/18/08 08:25 PM, sasuke2910 wrote: button_btn.addEventListener(MouseEvent.C LICK,go_funct)

function go_funct (type:MouseEvent){
// gotoAndPlay or whatever
}

ok, thanks a lot, but can someone explain to me what is happening there so i don't have to come here again asking for help in a Pause button?


Ich bin Mr. Reevers!
I OWN you all. Period.

BBS Signature
Deathcon7
Deathcon7
  • Member since: Oct. 1, 2003
  • Offline.
Forum Stats
Member
Level 21
Writer
Response to AS3 pwned me! 2008-11-18 20:29:12 Reply

[Play Button Instance].addEventListener(MouseEvent.MOUSE_DOWN, playFunction);
function playFunction(playEvent:MouseEvent):void {
_root.play();
}

This was the more proper way of creating buttons in AS2, using listeners. Had you taken the time to do it right back then, you wouldn't be in this situation now ey? ;)

Reeoz
Reeoz
  • Member since: Jul. 18, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS3 pwned me! 2008-11-18 20:36:52 Reply

Its not my fault I'm so lazy.
| wait. It is


Ich bin Mr. Reevers!
I OWN you all. Period.

BBS Signature
uyersuyer
uyersuyer
  • Member since: May. 15, 2002
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to AS3 pwned me! 2008-11-18 21:05:04 Reply

There's an option in CS3 to use AS2, just like you could use AS1 in Flash 8.


"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe

BBS Signature
Deathcon7
Deathcon7
  • Member since: Oct. 1, 2003
  • Offline.
Forum Stats
Member
Level 21
Writer
Response to AS3 pwned me! 2008-11-18 21:11:42 Reply

Button.addEventListener(MouseEvent.MOUSE _DOWN, playFunction);

Button is the instance name of the button. addEventListner() creates an event listener to listen for the parameters within it's parenthesis. MouseEvent.MOUSE_DOWN is a type of mouse event (when the mouse is pressed, MOUSE_UP for when it's release). playFunction is the function to be called when the event the listener is listening for happens.

function playFunction(playEvent:MouseEvent):void {

Creates an event handler reminiscent to the onClipEvent(enterFrame){} except it's different. The handler would the the function playFunction, and the event its handling is the playEvent of type MouseEvent and the return value is void (or no value is being returned).

_root.play();

Plays the root movie clip.

}

Ends the event handler. :P

Reeoz
Reeoz
  • Member since: Jul. 18, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS3 pwned me! 2008-11-18 22:06:17 Reply

Button is the instance name of the button. addEventListner() creates an event listener to listen for the parameters within it's parenthesis. MouseEvent.MOUSE_DOWN is a type of mouse event (when the mouse is pressed, MOUSE_UP for when it's release). playFunction is the function to be called when the event the listener is listening for happens.
Creates an event handler reminiscent to the onClipEvent(enterFrame){} except it's different. The handler would the the function playFunction, and the event its handling is the playEvent of type MouseEvent and the return value is void (or no value is being returned).

Thanks a lot. 10/10 for you. That's how it should be done. Just writing a bunch of code doesn't get you outta your doubts. Thanks again.


Ich bin Mr. Reevers!
I OWN you all. Period.

BBS Signature
Reeoz
Reeoz
  • Member since: Jul. 18, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS3 pwned me! 2008-12-04 07:51:03 Reply

OH, By the way, _root doesn't work on AS3.
Any help?
Should I use stage?


Ich bin Mr. Reevers!
I OWN you all. Period.

BBS Signature
blah569
blah569
  • Member since: Jan. 18, 2005
  • Offline.
Forum Stats
Member
Level 25
Programmer
Response to AS3 pwned me! 2008-12-04 09:31:51 Reply

At 12/4/08 07:51 AM, Reeoz wrote: OH, By the way, _root doesn't work on AS3.
Any help?
Should I use stage?

Any pram with a leading underscore is depleted. _root. doesn not work but root. works fine.


BBS Signature
andy70707
andy70707
  • Member since: Sep. 30, 2007
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to AS3 pwned me! 2008-12-04 15:02:57 Reply

im also learning AS3, and I think I have found the alternative for _root.

MovieClip(insertinstancenameofmoviecliphere).dowhatever

and for refering back to the timeline from a movieclip:

MovieClip(root).dowhatever

and jeez, AS3 is hard. I only use it when I want to do 3D effects and IK (I have CS4), and only simple thing like tutorials and quizes, all I really know how to do is make buttons and refer to movieclips. gotoAndStop() and stop() actions are the same though. Im still gonna use AS2 for most stuff, even with CS4.


My websites: MayesMods | FireStorm | I'm also on almost every other website in existence, mostly under the username: andy70707 (youtube: brainiac777, eBay: 10andy70707).

BBS Signature
GustTheASGuy
GustTheASGuy
  • Member since: Nov. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS3 pwned me! 2008-12-04 15:42:36 Reply

At 12/4/08 03:02 PM, andy70707 wrote: im also learning AS3, and I think I have found the alternative for _root.
MovieClip(root).dowhatever

Yeah. Don't do that.

and jeez, AS3 is hard. I only use it when I want to do 3D effects and IK (I have CS4), and only simple thing like tutorials and quizes, all I really know how to do is make buttons and refer to movieclips. gotoAndStop() and stop() actions are the same though. Im still gonna use AS2 for most stuff, even with CS4.

I don't see why you'd use AS3 instead of AS2 for basic UI interactivity. -_-

Dear retards (please disregard if you feel I'm addressing you but feel you cannot agree, no reason to waste one of your five brain cells on anger):

I understand it's possible for you specimens to not understand basic programming even after using Flash for years, but aside from that, don't spread your 'solutions' to other potential specimens.

I mean, you don't have a clue what you're doing; for you programming consists of mutating some code until it kind of works, and AS3 is 'hard' because it doesn't go together with retards typing random bullshit, neither can you copy code around out of context and end up with it working.
You never had the mental capacity to see that working out code as a logical structure might be beneficial somehow.
Knowing this, why the fuck do you people feel you have something to offer here?

Please don't accuse me of arrogance when you cannot get over the level of intellect of my early thirteenth.

The only thing I can suggest that could potentially help is take a few months to study Lisp - it is normally an incredibly simple language, but, you know, you guys don't understand programming and/or logic and/or common sense the least - and books such as the following and others you might find:
http://www.cs.cmu.edu/People/dst/LispBoo k/book.pdf
http://www.cs.umd.edu/~nau/cmsc421/lisp-
intro.pdf


BBS Signature