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

#226 2008-11-04 13:18:14

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

Re: coding in flash actionscript 2.0 for beginners

yambanshee wrote:

Thanx! that helps me alot! another question, can you post a flash document without using something like newgrounds, for example, embeding it into this post? one more, how do i make textboxes move? i made a sort of scrolling effect with everything that shouldent scroll counteracting the scrolling by moving their x and ys, however textboxes with things such as score, life ect... still move.
While im at it, does flash have colour sencing?

1. Yes you can but not in forums. Use http://spamtheweb.com
2. Put the text boxes in MovieClip symbols
3. Yes it does I think, but it is part of bitmap data which is hard to use. Shapeflag hitTests eliminate the need for colour sensing though. Colour sensing isn't that useful in scratch either. I usually only use it for detecting things that are stamped because I can't interact with it any other way.


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

 

#227 2008-11-04 13:43:47

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

thanks! I need to go resurch some shapeflag hit tests!

Offline

 

#228 2008-11-04 22:46:46

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

http://spamtheweb.com/ul/upload/051108/24349_RPG-scroll.php  smile

Offline

 

#229 2008-11-04 22:48:23

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

Re: coding in flash actionscript 2.0 for beginners

yambanshee wrote:

http://spamtheweb.com/ul/upload/051108/24349_RPG-scroll.php  smile

Nice!


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

 

#230 2008-11-05 06:37:39

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

yambanshee wrote:

http://spamtheweb.com/ul/upload/051108/24349_RPG-scroll.php  smile

Nice!

thanks!
could you tell me whats wrong with this code?

Code:

on (release) {
    if (_root.level=1) {
        gotoAndStop(8);
    }
    if (_root.level=2) {
        gotoAndStop(9);
    }
    if (_root.level=3) {
        gotoAndStop(10);
    }
    if (_root.level=4) {
        gotoAndStop(3);
        _root.level == 1;
    }
}

its for a button, every level is on a difrent frame and the level does change its value after every level is completed, yet it always goes back to level 1 (frame 3)

Offline

 

#231 2008-11-05 09:07:11

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

Re: coding in flash actionscript 2.0 for beginners

on (release) {
    if (_root.level=1) {
        _root.gotoAndStop(8);
    }
    if (_root.level=2) {
        _root.gotoAndStop(9);
    }
    if (_root.level=3) {
        _root.gotoAndStop(10);
    }
    if (_root.level=4) {
        _root.gotoAndStop(3);
        _root.level = 1;
    }
}
Try that.

And remember == checks to see if 2 values are equal while = sets a value which is was you meant to use.

Last edited by archmage (2008-11-05 09:08:21)


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

 

#232 2008-11-05 11:28:48

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

on (release) {
    if (_root.level=1) {
        _root.gotoAndStop(8);
    }
    if (_root.level=2) {
        _root.gotoAndStop(9);
    }
    if (_root.level=3) {
        _root.gotoAndStop(10);
    }
    if (_root.level=4) {
        _root.gotoAndStop(3);
        _root.level = 1;
    }
}
Try that.

And remember == checks to see if 2 values are equal while = sets a value which is was you meant to use.

thanks, I keep making silly little mistakes like forgeting _root.s :S

Offline

 

#233 2008-11-26 13:04:11

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Hey, could you tell me whats wrong with this script?
onClipEvent (enterFrame) {
    if (_root.life == 0) {
        gotoAndStop(3);
    }
}
when life =0 nothing happens? (frame 3 exists)

Offline

 

#234 2008-11-26 13:18:49

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

Re: coding in flash actionscript 2.0 for beginners

yambanshee wrote:

Hey, could you tell me whats wrong with this script?
onClipEvent (enterFrame) {
    if (_root.life == 0) {
        gotoAndStop(3);
    }
}
when life =0 nothing happens? (frame 3 exists)

It works fine. Your life variable may be less than 0 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

 

#235 2008-11-26 22:35:15

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

yambanshee wrote:

Hey, could you tell me whats wrong with this script?
onClipEvent (enterFrame) {
    if (_root.life == 0) {
        gotoAndStop(3);
    }
}
when life =0 nothing happens? (frame 3 exists)

It works fine. Your life variable may be less than 0 though.

its a quiz styled game though. Life is always either 3,2,1 or0

Offline

 

#236 2008-11-26 23:25:23

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

Re: coding in flash actionscript 2.0 for beginners

You code is correct. Maybe you are not referring to the correct variables? Or perhaps you wanted to make the main timeline gotoAndStop() but forgot to put _root. ?


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

 

#237 2008-11-27 05:45:08

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

Or perhaps you wanted to make the main timeline gotoAndStop() but forgot to put _root. ?

i didint know that...

Offline

 

#238 2008-12-03 10:21:38

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

http://www.newgrounds.com/portal/view/471659  tongue

Offline

 

#239 2008-12-29 13:48:32

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

is there anyway of getting a similer thing as the repeat until block? at moment im making a script that cheaks 2 conditions, 1 a hitTest and 2 a keypress. If both of these are true then it repeats a script untill the hittest is false. It wont work continually running the script as the keypress will need to be continuasly done. I thought of setting a bollean value to true when both the hittest and keypress is clicked and setting it to false when the key press is fake, but is this the most effective method or are there better methods?
script uptill now

Code:

onClipEvent (enterFrame) {
    _x = _root.scrollx+347;
    _y = _root.scrolly+128;
    if (this.hitTest(_root.char)) {
        if (Key.isDown(Key.SPACE)) {
            //the loop here.
        }
    }
}

thanx for the help!

Offline

 

#240 2008-12-29 13:53:36

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

Re: coding in flash actionscript 2.0 for beginners

yambanshee wrote:

is there anyway of getting a similer thing as the repeat until block? at moment im making a script that cheaks 2 conditions, 1 a hitTest and 2 a keypress. If both of these are true then it repeats a script untill the hittest is false. It wont work continually running the script as the keypress will need to be continuasly done. I thought of setting a bollean value to true when both the hittest and keypress is clicked and setting it to false when the key press is fake, but is this the most effective method or are there better methods?
script uptill now

Code:

onClipEvent (enterFrame) {
    _x = _root.scrollx+347;
    _y = _root.scrolly+128;
    if (this.hitTest(_root.char)) {
        if (Key.isDown(Key.SPACE)) {
            //the loop here.
        }
    }
}

thanx for the help!

I dunno, use if statements I guess.


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

 

#241 2009-04-25 14:51:08

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Cool1 Thanks archmage


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#242 2009-04-25 22:52:38

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

Re: coding in flash actionscript 2.0 for beginners

wowww.... cool.

imagine a website completely dedicated to providing the action script codes for every scratch block / blocks.


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

#243 2009-04-25 22:54:54

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

Re: coding in flash actionscript 2.0 for beginners

Dibbo222 wrote:

wowww.... cool.

imagine a website completely dedicated to providing the action script codes for every scratch block / blocks.

There are tons of website that tell you how to code in actionscript.
Once you learn the codes you can translate the blocks yourself.


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