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

#26 2011-05-25 22:52:39

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

Re: Can anyone help me with some actionscript?

I know the REALLY basic stuff like stop(); and that kind of stuff. I want to become serious about programming and I am going to buy a book on it.


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

 

#27 2011-05-25 22:58:28

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

Re: Can anyone help me with some actionscript?

Thank You A Ton Archmage! That Is Really Helpful! Im Going To Learn It All! Todays My Birthday And Thats Awesome!


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

 

#28 2011-05-26 10:25:31

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Can anyone help me with some actionscript?

I don't really understand what you want, but I can try to help anyway.  If you want to make an object move with the arrow keys, just use code snippets (with Flash CS5) and change the variable names and you might fool your teacher.  The real answer is this:

This is the code (Actionscript 3.0): wrote:

import flash.events.KeyboardEvent;

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);

function keyPressed(evt:KeyboardEvent):void
{
    switch(evt.keyCode)
    {
       
        case Keyboard.UP :
        //Your code goes here
        /*Example:*/trace("You pressed the UP key")
        break;//the break; is very important
       
        case Keyboard.RIGHT :
        //Your code goes here
        /*Example:*/trace("You pressed the RIGHT arrow key")
        break;//the break; is very important
       
        case Keyboard.DOWN :
        //Your code goes here
        /*Example:*/trace("You pressed the DOWN arrow key")
        break;//the break; is very important
       
        case Keyboard.LEFT  hmm /going clockwise
        //Your code goes here
        /*Example*/trace("You pressed the LEFT arrow key")
        break;//the break; is very important
    }
}

If you have access to Code Hinting you don't have to write the import flash.events.KeyboardEvents part.  Hope this helps you cheat on your homework!

Offline

 

#29 2011-05-26 10:29:31

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Can anyone help me with some actionscript?

I suggest always putting your scripts on a blank layer, and Keyboard events work best on the stage.  Check out http://www.lynda.com/ for some Actionscript tutorials.

Offline

 

#30 2011-05-26 13:20:43

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

Re: Can anyone help me with some actionscript?

Thank you


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

 

#31 2011-05-26 19:21:31

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

Re: Can anyone help me with some actionscript?

Dude, that is AS3, learn key presses from flash game source man.

Really just learn everything on the flashgame source tutorial for AS2 and you can make some games already, take like a week if you have no idea about anything.


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

 

#32 2011-05-26 21:37:38

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

Re: Can anyone help me with some actionscript?

My goal is to finish like 5 of those tutorials a day.


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

 

Board footer