Play the games, create the levels

Topic, Sharing AS3 Classes

Checkout our iPhone & iPad games!

You must register or log in to post a message.

Hexicube 13 years ago
  "Bumpity Bump, here is a correct Calculator class in AS2."
make something that can parse a string such as "2(4+5/(3*4))^(1/7)"
manufan 13 years ago
  Bumpity Bump, I have an E-mail class, in AS3, which can E-mail anyone, just about anywhere in the world. In addition to the main class, there is a PHP file, which handles some of the data.

Instructions:

If you don't have your own testing server, don't download the PHP file at all. I have an example server, which works.

Next, upload the PHP file to your server and replace the line with:

var mailAddress:URLRequest = new URLRequest(The link to your server);

And delete the comment. Remember, this is optional.

Arguments:

Email(sender:String, recEmail:String, subject:String, body:String);

sender = You
recEmail = Reciever's E-mail Address
subject = Self-explanatory
body = Self-explanatory

All in String data type.

How is it useful?

Well, instead of all that stupid code with URLVariables and URL Request you'll only have to type:

import root_folder.Email;
var msg:Email = new Email("Jonathan", "randomguy@gmail.com", "Hello!", "Hello World! This E-mail has been sent from Flash using my very own Email class, courtesy of Manufan!");


Now you've seen it, who wants it?
allyally 13 years ago
  also. as for your calculator class. I have a collection of claass which ill upload soon that can do this, (type ? for help).

Top that.
birjolaxew 13 years ago
  ಠ_ಠ


Please, take a seat.

What I need to use your class:

import folder.Ellipse
var ell:Ellipse = new Ellipse(0, 0, 50, 50, 0xFFFFFF);



That's one less line than it would've been without your class, and way more intensive.
manufan 13 years ago
  I will, but it might be a tiny bit useless...

[Edit: Allyally will object, this is supposedly beyond shite until I produce V.02]

Please tell me if I have coded correctly though. :)

Here [V.01] AS3

Arguments:

Ellipse(x:uint, y:uint, w:uint, h:uint, color:uint);

You'll know what to do. ;)
Example if anyone needs it (;P):

Ellipse(10, 10, 10, 10, 0xff0000);

Next Update:
SPOILER
birjolaxew 13 years ago
  y u no simply post link?
manufan 13 years ago
  @Allyally, Birjo and Simon: Today is going to feel a bit like Christmas or your birthdays as I have created a useful or at least semi-useful AS3 class with Flash Develop. (Hell that was easy.)

It's called Ellipse. If you are interested, I will give you the link.
SimonM 13 years ago
  the return keyword is used in functions, you can return any variable you like, so if you use your function you can use it as a variable. make sure function functionname:returntype {....}
manufan 13 years ago
  @Allyally and Birjolaxew: I understand that it is useless, yes there is a Math Class and yes I suppose I should've used return - I've heard of it, but I don't actually know what it does.

All I want to know is whether it is right and you think you can use it properly. After that, then I will start to create more useful classes. Telling me it is a piece of shite doesn't help at all.

BTW, I also edited it A HELL OF A LOT last night and this morning.
birjolaxew 13 years ago
  I'm sorry, but he's right.

Typing var num:int = 1+2; is way easier than importing your class, making an instance of it (unless your functions are static) and calling a function in it. Hell, even when you get everything you've talked about into it, the built-in Math class covers more than we'd ever need.

Also, why the f*** do you trace the answer? Ever heard of the return command?
allyally 13 years ago
  So? Thats still completely shite. The function you are basically making is one that's existed in every standard library in ANY LANGUAGE ANYWHERE. Worse than that, you're just using their function rather than your own! Wholl ever actually use your class? We all already have Math.pow, douchebag.
manufan 13 years ago
  That's because it's not finished, it will have square-roots, cube-roots power of-roots, whatever mathmatical function there is.
allyally 13 years ago
  Its the most f*cking useless class ive ever seen, "ooh! i wonder what 1+3 is? If only I had Manufans class..."
manufan 13 years ago
  Why? It's not useless.. I'm adding more functions right now...
allyally 13 years ago
  Manufan, adding lots of technical looking comments to your code wont make the class any better. That is beyond shit.
manufan 13 years ago
  @GIS: Gecko says it's OK! Marc did.
gameinsky 13 years ago
  the great and powerful manufan turned this topic about AS3 into AS2...
manufan 13 years ago
  This is AS2 AK. You just have to ask Gecko. He said yes to Marc, and said yes to me.
AK 13 years ago
  I'm still on AS2 XD

I'll learn AS3 when i'm done...
manufan 13 years ago
  Bumpity Bump, here is a correct Calculator class in AS2.

Useful to have if you don't want to faff around trying to open up your computer's cheap calculator and enter the opposites, hypotenuses and adjacents and whatever to get a sine of something when all you really need is another window open in Flash.

Here: Calculator.as

Arguments:
SPOILER


More Suggestions Welcome.
manufan 13 years ago
  The only problem is that instead of on(press) you would have (MouseEvent.CLICK, click) and stuff like that. I don't know if I'm right with AS3, I don't really care.
SimonM 13 years ago
  Manufan, just learn AS3, like you've learned AS2.
MARC2009 13 years ago
  he doesnt understand array =/
birjolaxew 13 years ago
  ... Seriously, you should know these types after a minute of learning AS... Writing them down here won't help.
manufan 13 years ago
  For beginners of AS2, I can explain the most common data types which will be helpful to make classes:

:String - A simple text which can be A-Z, a-z or Symbols.
:Number - Any Numeric value.
:Boolean - Refers to the Boolean Algebra, output is True or False.
:Array - A Group (well, sort of).
manufan 13 years ago
  OK, I have Flash Develop, do I just learn from there?
birjolaxew 13 years ago
  Manufan, I would advice you to move on from AS2. It will be outdated soon, and there really is absolutely no reason to not learn AS3.
manufan 13 years ago
  Bumpity Bump, again I will make some classes now but I have an idea:

I can enhance allyally's class to make it as2 but instead of :uint I would have to use :Number

Don't worry, it will be 'enhanced by Manufan' original by Allyally

Here it is. Is it right?

New Function:

public function customTF(x:Number, y:Number, font:String, size:Number, colour:Number, Obj:Object, property:String)
allyally 13 years ago
  Bumpity Bump, here's a small text field class I made thats handy when making games,
Its will basically take a property of an object that you want a TF to display, then display that property & automatically update it when it changes.

Arguments:
public function customTF(x:uint ,y:uint, font:String, size:uint, colour:uint, Obj:Object, property:String)

x & y = position,
font = the text field font
size = he texts size
colour = the text colour,
Obj = the Object that has the property that you want your Textfield to display
property the property of the Obj that you want to textfield to display,

For example:
public function customTF(4 ,4, "Arial", 16, 0xffffff, mySprite, "x")
Hexicube 13 years ago
  the usefulness of that is sqrt(-1), imaginary lmao
but yeh, most people who use AS know colour codes :P

[<<] [1] [2] [3]

Flash game development

First post of the topic

geckojsc 14 years ago
  Here's a topic for developers to find, create and share AS3 classes/libraries.
If you are still using AS2, I highly recommend downloading the free Flex SDK and FlashDevelop tools. There's a great tutorial on the FlashPunk site.

AS3 SFXR is great tool for making video game sound effects. Use the interface to perfect your noise, then use the free SfxrSynth class to generate and play your sounds on the fly without importing any .wav files! Magic.

Flixel and FlashPunk (thanks to JP for pointing them out) are both libraries which allow you to make sprite-based games easily by extending the base classes.

Calista is a collection of cryptography classes. You will need a SVN client to download it though, or you could use the source browser to copy the files individually.

Tweener will help you to move things around the stage smoothly using only code. Great when you're using Flex.
Our free flash games   Games for your site   Games for your iPhone   Contact   Twitter @jpsarda & @bonuslevelorg