![]() |
|
|||||
Topic, Sharing AS3 Classes | ||||||
| ||||||
You must register or log in to post a message.MathUtils() [Throws an Error] average(a:Array) [Returns the average of the numbers in an array] formatAsCurrency(c:String, n:Number, english:Boolean, decimal:Boolean) [See FlxU.formatMoney() - c = the symbol] formatAsDate(d:Date) [Returns a String along the lines of "Monday 3rd September 2012"] formatAsTime(d:Date, seconds:Boolean, showGMT:Boolean) [Returns a string along the lines of "14:31:00 (GMT +1)"] roundToNearest(n:Number, r:Number) [Returns an integer.] Other functions MathUtils has are used by other functions, such as formatAsDate() uses getWeekday(). If you want to work on it with me, I'll create a shared folder for it on DropBox. I was making a library to help with games as a whole - utilities that could take forever to script in a game - especially when you want to keep the file size down. For Beginners: Object Oriented Programming in AS3 At the moment, I'm sticking with Game as the prefix. The idea of the library is to help with making Games that involve level data serialization (e.g. BL Games). I'm not sure whether it's very good, I'd just like feedback infact, but I decided to code an Animation Engine in AS3. It's not that user friendly, but I just want to know: a) Whether my code is right. b) Is it actually useful. It was targeted at the FlashDevelop Community, even though this was made in Flash CS6, due to the fact that everything has to be coded, and so there's no drawing MovieClips or IK. Parameters & Functions PRIVATE: EMPTY_OBJECT (An Empty MovieClip) PRIVATE: MOVIE_LIST (An Array storing all MovieClips) PRIVATE: TOTAL_FRAMES (Total Frames of the MovieClip) CONSTRUCTOR: Animation(empty_object:MovieClip, movie_list:Array, total_frames:int) The class also includes 7 other functions (one private, containing a 'for' loop) and the others for timeline control, such as gotoAndStop(); Download Animation.as Next Updates - No need to supply an Empty MovieClip - More Suggestions Welcome if your internet is down it wont work... It's a static class, so goofy names won't work. :S @Gecko: Also, you said throwing exceptions was good practice. How come you didn't throw an exception for your constructor function in your "Keys" class? Edit: You'll need Array.reverse(); if you want to sort them Chronologically, it does it backwards! BTW I love making games. I'm thinking about making a very useful class, a basic editor class that I will use, that extends from MyEditorManager. You can enhance the code in any way you like, to your specifications, and before you aks "WHERE DA F*** IS THE LINK?" there isn't one, becuase it hasn't been made yet. :) I used the mail function in PHP, that's how it actually e-mails people. It's no good adding it to a website. Both HTML, PHP and Javascript have easy e-mail functions available. There's no reason to add it to a standalone .swf because... Well, why would you? Email [V.0.1] AS3 by Manufan. @Birjo: Epic! I will post my code soon And some example code. For an actual example of it in action, see this. make something that can parse a string such as "2(4+5/(3*4))^(1/7)" 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? Top that. 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. | Flash game developmentFirst post of the topicIf 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. |
|||||
