Hey, I found the best gadget of all time:
AS: Main ;)

Hey, I found the best gadget of all time:
AS: Main ;)
function getGCD(a, b)
{
while (b != 0)
{
tmpB = b;
b = a % b;
a = tmpB;
}
return a;
}
Usage:
A short way to get the greatest common denominator of a and b. For example:
trace(getGCD(20, 8)); // returns 4
trace(getGCD(121, 44)); // returns 11
trace(getGCD(9, 129)); // returns 3
At 11/24/05 09:50 AM, Begoner wrote: function getGCD(a, b)
Nice one there
At 11/24/05 09:50 AM, Begoner wrote: function getGCD(a, b)
It's a good function, you could get rid of the != 0 in while (b != 0) though =)
At 11/23/05 06:15 PM, -dELta- wrote: function cout():Void
{
trace(arguments);
}
Nice function, I had no idea you could use arguments in flash (I've never seen it used before) so that might come in handy too ^^
At 11/24/05 04:43 AM, T-H wrote: This is a shite excuse for an AS thread, come on...
Yeah, it's a good thread but I can't see why it's an AS thread =\
At 11/24/05 05:11 AM, ZYX3D wrote: Since "null" is too much for a nothing for me, I use 0 instead. The very same effect, but 75% shorter.
Same here, I can't see why everyone uses null when 0 is so much shorter and easier.
Sup, bitches :)
At 11/24/05 08:16 AM, T-H wrote: Very true, but my point being: I've never had to do that, and can't think of a time when I will.
on my new game, i wanted something special
to happen every 5 rounds, so i set it up to happen:
if (round%5==0){
// do thing
}
At 11/24/05 01:37 PM, authorblues wrote: if (round%5==0){
// do thing
}
Thats a good example of how it can be used
Sup, bitches :)
At 11/24/05 05:23 AM, Rantzien wrote:At 11/24/05 04:43 AM, T-H wrote: Nonono, it really isn't. The only use Ive ever found for it is to make object snap to a grib by getting the remainder and adding/taking it, but there is an even easier way to do that anyway.You could also check if something is evenly divisible by something:
function isDiv (a:Number, b:Number):Boolean {
return a%b ? false : true;
}
As was mentioned before, true = 1, false = 0, and vise versa. So a variation of that function could be:
function isDiv(a:Number, b:Number):Boolean {
return !Boolean(a%b);
}
At 11/24/05 02:24 PM, -fwe- wrote:
:(...)
As was mentioned before, true = 1, false = 0, and vise versa. So a variation of that function could be:
Actually, 0 and undefined are false, everything else (1,2, INFINITY, -200...) is true.
At 11/24/05 02:04 PM, -liam- wrote: =P
hehe, liam cant get pwned
At 11/24/05 02:24 PM, -fwe- wrote: As was mentioned before, true = 1, false = 0, and vise versa.
Yeah, I know. It's not a very useful function anyways, just a quick example =D
At 11/24/05 01:37 PM, authorblues wrote: on my new game, i wanted something special
to happen every 5 rounds, so i set it up to happen:
if (round%5==0){
// do thing
}
And that couldn't have been done using
if(round == 5){
:S ?
At 11/24/05 05:11 PM, T-H wrote: And that couldn't have been done using
if(round == 5){
Actually not =)
If round is 10, for example:
round == 5 // false
round%5 == 0 // true
You could say that modulo (%) divides round by 5, and returns the remainder.
At 11/24/05 05:15 PM, Rantzien wrote:At 11/24/05 05:11 PM, T-H wrote: And that couldn't have been done usingActually not =)
if(round == 5){
If round is 10, for example:
round == 5 // false
round%5 == 0 // true
You could say that modulo (%) divides round by 5, and returns the remainder.
I missed the every 5 rounds part , thanks :D
thought it just said on round 5
At 11/24/05 02:04 PM, -liam- wrote: Thats a good example of how it can be used
=P
awww... theifer. that was my idea, with the encryption variable.
good work. i KNOW you only did that out of spite for TD's 1337-translator...
...kids today, with their grudges and their pumpkin pies...
hey something just gave me an idea based on all these translator thingies...
if you did << with a string what would it do
At 11/27/05 06:11 PM, Glaiel_Gamer wrote: hey something just gave me an idea based on all these translator thingies...
if you did << with a string what would it do
if you use bitwise shift on a string (non numeric) then you get 0
At 11/23/05 03:23 PM, -cherries- wrote:
stop;
wow. your such crap at action script you said that! it stop(); not stop;
At 2/18/06 01:39 PM, DragonFruit_Clock wrote: wow. your such crap at action script you said that! it stop(); not stop;
myMovieClip.onMouseDown = stop;
Sup, bitches :)
At 11/23/05 06:15 PM, -dELta- wrote: you have 3 variables: x,y,z
and you want to trace them:
can somebody tell me waht trace means?
At 2/18/06 02:34 PM, ryanpridgeon wrote:At 11/23/05 06:15 PM, -dELta- wrote: you have 3 variables: x,y,zcan somebody tell me waht trace means?
and you want to trace them:
trace(); is an action that receives data and displays it in the Output box, which only you will see on your version of flash.
trace("this is what the trace action does");
//this will make the text "this is what the trace actoin does" appear in your Output box
:ppl said stuff about trace
wow thats kinda useful... no more temporary dynamic text boxes... lol..
At 2/18/06 02:40 PM, ryanpridgeon wrote:ppl said stuff about tracewow thats kinda useful... no more temporary dynamic text boxes... lol..
haha yea, trace is a lot easier when you want to solve problems on your own or calculate data or something. But just remember that only you see it and it won't show up on the regular swf.
Be a l337 h4rdc0r3 h4xx0r and write actionscript in pure bytecode!
__bytecode__("88240002006900486F6C79207368
69742C2062797465636F646520696E207468652066
6C612100960B0008000600000000000000003C9602
0008001C960500070A00000048129D020015009602
00080126960400080008001C501D990200D6FF00")
;
At 2/18/06 02:54 PM, Newsdee wrote: Be a l337 h4rdc0r3 h4xx0r and write actionscript in pure bytecode!
__bytecode__("numbers");
Yeah... How did you do that again?
At 2/18/06 02:54 PM, Newsdee wrote: Be a l337 h4rdc0r3 h4xx0r and write actionscript in pure bytecode!
__bytecode__("numbers");
WTFZ0Rz
At 2/18/06 02:54 PM, Newsdee wrote: Be a l337 h4rdc0r3 h4xx0r and write actionscript in pure bytecode!
__bytecode__("88240002006900486F6C79207368
69742C2062797465636F646520696E207468652066
6C612100960B0008000600000000000000003C9602
0008001C960500070A00000048129D020015009602
00080126960400080008001C501D990200D6FF00")
;
"holy shit, bitecode in the fla" i think is what it translates into
At 2/18/06 02:58 PM, Rantzien wrote:__bytecode__("numbers");Yeah... How did you do that again?
You can use Flasm to compile the bytecode from Flash assembly language. Or you can try opening an swf with a hex editor and copy/pasting :-)
At 2/18/06 03:12 PM, Newsdee wrote: You can use Flasm to compile the bytecode from Flash assembly language. Or you can try opening an swf with a hex editor and copy/pasting :-)
Oh, ok =)
It doesn't work with graphics too, does it?
At 2/18/06 03:15 PM, Rantzien wrote: It doesn't work with graphics too, does it?
For embedding jpgs, for example? No, it's just encoded AS. :-(
That being said, it's easy to make your own bytecode interpreter for images. Just grab every 2 characters in a hex string and convert them a single byte...