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

#101 2008-08-11 15:59:00

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

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

I've tried a couple places and got no answers. SO now i will ask here:

1) How can i make something have "costumes". Would it just be a frame for each possibility and change accordingly?
2) I'm making Bomb Squad- should I use movieClips for the buttons or buttons for the buttons, and
3) If I use buttons for the buttons (you know, the things you click), how can I make it only switch (and stay) on 1 of the button clips if a certain condition is true?

1) Use movieClips and change frame for different costumes.

2)Use buttons placed inside movieclips.

3) Use if (condition==true){  gotoAndStop(the correct frame)  }

Also, try to ask more AS questions on newgrounds. You can get quick responses there.

Last edited by archmage (2008-08-11 15:59:15)


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

 

#102 2008-08-11 16:00:20

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

Bluestribute wrote:

I've tried a couple places and got no answers. SO now i will ask here:

1) How can i make something have "costumes". Would it just be a frame for each possibility and change accordingly?
2) I'm making Bomb Squad- should I use movieClips for the buttons or buttons for the buttons, and
3) If I use buttons for the buttons (you know, the things you click), how can I make it only switch (and stay) on 1 of the button clips if a certain condition is true?

1) Use movieClips and change frame for different costumes.

2)Use buttons placed inside movieclips.

3) Use if (condition==true){  gotoAndStop(the correct frame)  }

Also, try to ask more AS questions on newgrounds. You can get quick responses there.

I'll say this again (cause i said it in another post):

They don't seem that helpful towards "noobs". Anyways, I guess I'll try that.


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#103 2008-08-11 18:01:49

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

could u put up a scratch/flash translation thing, have the blocks in scratch and tell the equivilant in flash  smile

Offline

 

#104 2008-08-11 18:22:29

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

Re: coding in flash actionscript 2.0 for beginners

deatheater wrote:

could u put up a scratch/flash translation thing, have the blocks in scratch and tell the equivilant in flash  smile

I guess so. But really, all you need to know is here.
http://www.newgrounds.com/bbs/topic/638183

That is for actionscript. You will also need to find tutorials on google for the basics of flash animation.

Hmmm lets see.

<move( number  )steps>

_x += Math.sin(_rotation*(Math.PI/180))*number;
_y += Math.cos(_rotation*(Math.PI/180))*-number;

<turn cw(  number )degrees>

_rotation+=number

<point towards( mouse

//This rotates me to the cursor, you can set the x and y to other things though
        adjside = this._x+0-_root._xmouse;
        oppside = this._y+0-_root._ymouse;
        angle = Math.atan2(-oppside, adjside);
        angle = Math.round(angle/Math.PI*180);
        this._rotation = 270-angle;

<switch to costume[ number

//on a movieClip symbol with multiple keyframes inside
gotoAndStop(number)

<size>

_xscale for horizontal size and _yscale for vertical size.

<go back(  )layers>

You can set the depth of an MC with this
swapDepths(Number);

<pen up>

For pen like effects see
http://www.newgrounds.com/bbs/topic.php?id=295557

<abs(    <round(

Math.abs()    Math.round()

Just a few. It would be too much to type to show all of the different codes.

Last edited by archmage (2008-08-11 18:25:10)


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

 

#105 2008-08-11 18:38:54

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

thanks  smile

Offline

 

#106 2008-08-11 22:55:23

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

perhaps u can do the rest when u have nothing to do

Offline

 

#107 2008-08-12 00:48:31

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

How can I set the rotation center (asking here because you know what that is, I'll get a quick response, and is "noob" friendly, Archmage  tongue )?


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#108 2008-08-12 01:38:33

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

How can I set the rotation center (asking here because you know what that is, I'll get a quick response, and is "noob" friendly, Archmage  tongue )?

when ur turning it into a movie clip, see those white boxes with a black box in one of them, I think u set the rotation using those blocks, and noob means begginer I think

Offline

 

#109 2008-08-12 02:21:21

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

deatheater wrote:

Bluestribute wrote:

How can I set the rotation center (asking here because you know what that is, I'll get a quick response, and is "noob" friendly, Archmage  tongue )?

when ur turning it into a movie clip, see those white boxes with a black box in one of them, I think u set the rotation using those blocks, and noob means begginer I think

I know what nnob is, just don't like it. Soudns mean. And I already made it a movie Clip, I just need to set the rotation so it doesn't look like its on ice


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#110 2008-08-12 04:01:42

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

deatheater wrote:

Bluestribute wrote:

How can I set the rotation center (asking here because you know what that is, I'll get a quick response, and is "noob" friendly, Archmage  tongue )?

when ur turning it into a movie clip, see those white boxes with a black box in one of them, I think u set the rotation using those blocks, and noob means begginer I think

I know what nnob is, just don't like it. Soudns mean. And I already made it a movie Clip, I just need to set the rotation so it doesn't look like its on ice

IDK what to do, probably something with sine and cos, wait, make a movieclip called starter, and put this code in, might want to check with archmage with this script

onClipEvent(enterframe){
_x=_x.starter
_y=_y.starter
_x += Math.sin(_rotation*(Math.PI/180))*10;
_y += Math.cos(_rotation*(Math.PI/180))*10;
}

there I think, it should rotate around the starter which will decide were it moves that should work I think, and make sure ur characters 90 degrees angle is facing upwards  smile , happy uh.. ummm..... flashing

Offline

 

#111 2008-08-12 10:32:12

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

I have a non-noob question. For a change lol! How do you create a "shared object"? I understand them to be a necessity for saving data as a cookie on the users computer. I already know the AS for saving and loading, but I do not know anything about how to create a shared object. I have looked all over. Is it even possible in CS3? People were only talking about it in reference to flash 8.


All your base are belong to us

Offline

 

#112 2008-08-12 11:41:07

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

Re: coding in flash actionscript 2.0 for beginners

Cyclone103 wrote:

I have a non-noob question. For a change lol! How do you create a "shared object"? I understand them to be a necessity for saving data as a cookie on the users computer. I already know the AS for saving and loading, but I do not know anything about how to create a shared object. I have looked all over. Is it even possible in CS3? People were only talking about it in reference to flash 8.

Try here. You seem to have caught on to AS pretty fast!

Bluestribute wrote:

How can I set the rotation center (asking here because you know what that is, I'll get a quick response, and is "noob" friendly, Archmage  tongue )?

The rotation center is the white circle on a movie clip you see when you free-tranform it (select the clip, hit Q). You can just drag it around, but be sure it stays in the same place for the beginning and end of a tween or it'll mess things up.


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

Offline

 

#113 2008-08-12 14:09:11

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Thanks! I think I get it now!


All your base are belong to us

Offline

 

#114 2008-08-12 15:29:45

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

I can't find where it is, but how would I use the Flash equivalent of    <wait(  )secsc>    in a code. Here is what I'm using:
if (time>0){
     time -= 1;
     _root.timer = time;
}
And something that supposedly is a second, but I know it is useless to put (just timeout(1000)). Thanks! And I did post it somewhere else FYI, but they aren't helpful there…  sad


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#115 2008-08-12 15:42:28

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

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

I can't find where it is, but how would I use the Flash equivalent of    <wait(  )secsc>    in a code. Here is what I'm using:
if (time>0){
     time -= 1;
     _root.timer = time;
}
And something that supposedly is a second, but I know it is useless to put (just timeout(1000)). Thanks! And I did post it somewhere else FYI, but they aren't helpful there…  sad

Flash doesn't have a wait script. Wait isn't that useful anyways.

Just try something like this.

onClipEvent(enterFrame){
time++;
if (time>=90){
// on 30 frames per second 3 seconds have passed
}
}

You honestly need to look at more tutorials and stuff. I remember when I was learning AS I only asked questions if I absolutely could not find another answer somewhere. Most of the questions you are asking can be answered by making a search on google.


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

 

#116 2008-08-12 15:48:23

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

Bluestribute wrote:

I can't find where it is, but how would I use the Flash equivalent of    <wait(  )secsc>    in a code. Here is what I'm using:
if (time>0){
     time -= 1;
     _root.timer = time;
}
And something that supposedly is a second, but I know it is useless to put (just timeout(1000)). Thanks! And I did post it somewhere else FYI, but they aren't helpful there…  sad

Flash doesn't have a wait script. Wait isn't that useful anyways.

Just try something like this.

onClipEvent(enterFrame){
time++;
if (time>=90){
// on 30 frames per second 3 seconds have passed
}
}

You honestly need to look at more tutorials and stuff. I remember when I was learning AS I only asked questions if I absolutely could not find another answer somewhere. Most of the questions you are asking can be answered by making a search on google.

I like figuring it out by myself, which is why I ask- gives me a chance to figure it out too. And I figured an easier way- just changing it by .1 and making the text box smaller, cutting off the decimal placs\es


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#117 2008-08-12 21:55:04

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Here is one I can't use google for- why isn't this working?
http://board.flashkit.com/board/showthread.php?t=774650
That has the .fla file. I can't even continue because for some reason the score is whack, and it is too bad to put on Newgrounds yet (I'll improve it after someone figures this out). I've spent like a couple hours trying to figure out why, using all kinds of ways to keep score…


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#118 2008-08-13 12:30:31

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Ok, how do ya make an object point towards another object?


All your base are belong to us

Offline

 

#119 2008-08-13 13:48:20

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Alright, I got this.

Code:

onClipEvent(enterFrame){
this.direction=Math.atan2(_root._ymouse,_root._xmouse)
}

it works fine. Now, how do I make it point in that direction plus 90? I tried everything.....


All your base are belong to us

Offline

 

#120 2008-08-13 14:51:54

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

Re: coding in flash actionscript 2.0 for beginners

Cyclone103 wrote:

Alright, I got this.

Code:

onClipEvent(enterFrame){
this.direction=Math.atan2(_root._ymouse,_root._xmouse)
}

it works fine. Now, how do I make it point in that direction plus 90? I tried everything.....

onClipEvent(enterFrame){
this.direction=Math.atan2(_root._ymouse,_root._xmouse)+90
}


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

 

#121 2008-08-13 17:38:05

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Ok, um, its not pointing. Its kinda just does nothing........


All your base are belong to us

Offline

 

#122 2008-08-13 17:58:59

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Is there a way to change costumes in 1 frame? So I don't have hundreds of frames, but only 1?


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#123 2008-08-13 18:05:16

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

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

Is there a way to change costumes in 1 frame? So I don't have hundreds of frames, but only 1?

Nope, 1 frame per costume. You can put animated MCs insides the frames if you want though.


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

 

#124 2008-08-13 18:07:35

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

Bluestribute wrote:

Is there a way to change costumes in 1 frame? So I don't have hundreds of frames, but only 1?

Nope, 1 frame per costume. You can put animated MCs insides the frames if you want though.

How can I do that? And is there a way only if a certain condition is true?


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#125 2008-08-13 18:10:54

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

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

archmage wrote:

Bluestribute wrote:

Is there a way to change costumes in 1 frame? So I don't have hundreds of frames, but only 1?

Nope, 1 frame per costume. You can put animated MCs insides the frames if you want though.

How can I do that? And is there a way only if a certain condition is true?

Double click on an MC to get inside so you can add frames. Use gotoAndStop to control which frame the MC is on.


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