UNENDED - _blog

  • Home
  • About
  • Books
  • Notes
  • Marks
Post 245

MathUtilities Class (AS 3)

  • Archive

    • March 2010
    • December 2009
    • July 2009
    • June 2009
    • April 2009
    • March 2009
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • May 2007
  • Filed Under: Flash, Programming
  • Tags: ActionScript, Flash
  • Publish Date: 28 May 2007
  • Share this post
    • Twitter
    • Facebook
    • Buzz

While the core classes in Flash have most of what I need, I often find myself wishing there were a few extra elements built into those classes.

A couple of years ago I put together a class called Math2. It was an ActionScript 2.0 class that extends the core Math class in Flash. A majority of the methods are based off of functions Robert Penner’s Programming for Macromedia Flash MX. I have since extended this class and converted it to ActionScript.

MathUtilities features include:

- radiansToDegrees
- degreesToRadians
- sinD
- cosD
- tanD
- atan2D
- angleOfLine
- acosD
- asinD
- fixAngle
- cartisianToPolar
- polarToCartisian
- color24
- color32

I also added the following public methods to the class:

- mean
- median
- mode
- range

I have not yet updated the class for ActionScript 3.0, but hope to do so soon. Converting this to AS 3 was easier than I thought seeing as this class isn’t very involved. The link is below. If you find this class useful, feel free to use and distribute this class freely, provided that it is not modified in any way (including removing the header or changing the package path):

- Math 2MathUtilities – ActionScript 3.0

Unfortunately I cannot provide any support for this class so please use the class in your projects at your own risk. If you would like to report any bugs, or have any feature requests, please feel free to post them here. All feedback is welcome.

ActionScript 3.0 Math Utilities Class (was Math2).

–

Updates
// 16.11.2008 – - – - – - – - – - -
New behaviors added:
- radiansToDegrees
- color24
- color32

Syntax changes:
- minor parameter names
- changed class name to MathUtilities from Math2
- moved the class to the new package ‘com.unended.util’ (from com.unended.core)

Add the First Comment

Add to the Discussion X

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

  • Recent Posts

    1. SXSWi 2010 – Content Strategy
      SXSWi 2010 – Content Strategy

      14 March 2010 Interactive

    2. ABC URL Game
      ABC URL Game

      6 March 2010 Miscellaneous

    3. Fatal Error: Allowed Memory Size Fix for ExpressionEngine 2.0 PB
      Fatal Error: Allowed Memory Size Fix for ExpressionEngine 2.0 PB

      2 December 2009 Programming

    4. "No input file specified." ExpressionEngine Issue Resolved
      "No input file specified." ExpressionEngine Issue Resolved

      28 July 2009 Programming

    5. Exporting Dynamic SWF Art to Illustrator
      Exporting Dynamic SWF Art to Illustrator

      4 June 2009 Flash

    6. AIGA and the Design Industry in 2015
      AIGA and the Design Industry in 2015

      6 April 2009 Design

    7. Storyboarding Interactive Experiences
      Storyboarding Interactive Experiences

      21 March 2009 Interactive

    8. Understanding the Interactive Audience: Audience Types
      Understanding the Interactive Audience: Audience Types

      18 October 2008 Interactive

  • © Patrick Ashamalla.
  • RSS 1.0
  • RSS 2.0