This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-05-20 17:52:30

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Can anyone help me with some actionscript?

You guys probably already know how to do this but can you help me with something? Its for a school project. How can I make it so the arrow keys each do something when you press them? Its in flash and we need to use action script. If you can't help thats fine.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#2 2011-05-22 19:59:11

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

please


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#3 2011-05-22 20:01:59

echs
Scratcher
Registered: 2010-03-18
Posts: 1000+

Re: Can anyone help me with some actionscript?

I would, but I'm really ticked since some jerk got my email account and started spamming me.


http://i45.tinypic.com/35m4llw.gif

Offline

 

#4 2011-05-22 20:24:17

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

Awwwwww... well when you are feeling better then you can help


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#5 2011-05-22 20:53:51

rabbit1131
Scratcher
Registered: 2009-10-16
Posts: 1000+

Re: Can anyone help me with some actionscript?

Well... As in... This?
http://i53.tinypic.com/33jo32p.jpg


The Intergalactic Adventures of Revesilia! I hope you will partake in this gigantic undertaking, to build the sequel to the hit map The Adventures of Revesilia! The Intergalactic Adventures of Revesilia Map Builders Application thread! http://internetometer.com/image/35004.png

Offline

 

#6 2011-05-22 21:26:01

guyman55
Scratcher
Registered: 2009-05-23
Posts: 500+

Re: Can anyone help me with some actionscript?

JJROCKER wrote:

please

http://i51.tinypic.com/2ngzmo6.jpg

Offline

 

#7 2011-05-23 09:24:10

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

I mean like in flash.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#8 2011-05-23 09:27:53

rabbit1131
Scratcher
Registered: 2009-10-16
Posts: 1000+

Re: Can anyone help me with some actionscript?

Oh, Math MIGHT know, I don't. I'll tell him


The Intergalactic Adventures of Revesilia! I hope you will partake in this gigantic undertaking, to build the sequel to the hit map The Adventures of Revesilia! The Intergalactic Adventures of Revesilia Map Builders Application thread! http://internetometer.com/image/35004.png

Offline

 

#9 2011-05-23 14:26:32

wmays
Scratcher
Registered: 2008-05-10
Posts: 500+

Re: Can anyone help me with some actionscript?

AS 2 or 3? If it's 2, use the "isKeyDown" event. If 3, I can't help you.


http://i42.tinypic.com/2z5vcz9.gif
http://phpscripthost.comoj.com/imagescripts/ipimg.php

Offline

 

#10 2011-05-23 23:35:54

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

I have all except 4. I have 3 computers.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#11 2011-05-23 23:41:11

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

But how could I make like a guy walk when the arrows are clicked?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#12 2011-05-23 23:53:25

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Can anyone help me with some actionscript?

I'm going to go ahead and assume you're using AS3. Put this on the stage, or inside your document class:

Code:

stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDown)
stage.addEventListener(KeyboardEvent.KEY_UP,keyUp)

function keyDown(e:KeyboardEvent):void
{
  if(e.keyCode == Keyboard.RIGHT)
  {
    //The right arrow key was pressed
  }
  //Repeat with Keyboard.LEFT, Keyboard.UP, Keyboard.DOWN
}

function keyUp(e:KeyboardEvent):void
{
  //You can basically do the same thing with the keyUp event
  //The keyCode property of a KeyboardEvent tells you which key was pressed.
}

Hope that's clear!


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#13 2011-05-24 00:51:05

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

Im still very confused, thanks for helping but I need a major walkthrough.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#14 2011-05-24 01:13:25

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Can anyone help me with some actionscript?

JJROCKER wrote:

Im still very confused, thanks for helping but I need a major walkthrough.

I'd love to explain anything I can. What specifically are you confused about?


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#15 2011-05-24 04:13:19

08jackt
Scratcher
Registered: 2007-09-12
Posts: 1000+

Re: Can anyone help me with some actionscript?

JJROCKER wrote:

Im still very confused, thanks for helping but I need a major walkthrough.

google


http://i39.tinypic.com/jgtswi.png

Offline

 

#16 2011-05-24 23:13:44

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

Where should I put that script? The backround?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#17 2011-05-24 23:29:48

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Can anyone help me with some actionscript?

JJROCKER wrote:

Where should I put that script? The backround?

Yeah, just put that one the first frame of your movie. In AS3 you can't apply scripts directly to a MovieClip (you could with the last version of AS, which was a nifty Scratch-like feature).


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#18 2011-05-24 23:57:16

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

then what do I do?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#19 2011-05-25 16:22:18

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Can anyone help me with some actionscript?

JJROCKER wrote:

then what do I do?

Well, it depends. If you're trying to make a character move, you might create a variable "xVelocity" and manipulate it whenever the left or right keys are pressed. Then have the character's x position change every frame based on the velocity:

Code:

addEventListener(Event.ENTER_FRAME,function(e:Event):void{
  character.x += xVelocity;
  xVelocity *= .98;
})

http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#20 2011-05-25 18:31:43

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

or how about lets make this easier. How about if I just want it so when you press an arrow it goes to the next frame


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#21 2011-05-25 19:13:00

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Can anyone help me with some actionscript?

Dude, you really need to learn some simple code samples, from reading this thread you don't really know anything.

First of all, no one even knows what version of actionscript, and what development tool you are using  so no one can really answer you.

You can 2 options: AS2, very very easy, but less powerful and less structured
or AS3, more difficult but more powerful and better structured, recommended for those who want to learn proper programming.

If you want to do AS3 you need a copy of adobe/macromedia flash, for AS3 you can use flashdevelop.

Last edited by archmage (2011-05-25 19:13:50)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#22 2011-05-25 19:34:45

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

I do have CS3 and CS5.5 I do know some action script.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#23 2011-05-25 20:17:17

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Can anyone help me with some actionscript?

Ok, and what version of actionscript are you using, AS2 and AS3 are completely different.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#24 2011-05-25 21:46:27

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Can anyone help me with some actionscript?

Which one would be better to use?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#25 2011-05-25 22:42:26

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Can anyone help me with some actionscript?

It depends, heres my basic recommendations

AS2: Super easy, lets basically anyone code but its less powerful and not recommended for professionals. At this point in time I recommend it for young people who are not too serious about programming.

AS3: A tad harder than AS2, but it pays off because it is far more structured and powerful. I recommend it for any one who want to code seriously and at a professional level, it also makes it also to learn other popular languages including java and c++.


I am just going to assume you fall in to the first group of people so pick AS2.

Makes programs with the code from these resources as practice and you are good to go on your merry way to make games.

first http://www.newgrounds.com/portal/view/366346
second http://www.newgrounds.com/portal/view/344206

For the first link learn it all, seriously, do this, its all essential stuff.

For the second link you should learn all the basic and intermediate topics. The advanced is not really needed in most cases but it teaches things like basic 3d wireframes.

Last edited by archmage (2011-05-25 22:44:34)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

Board footer