dasPoda

now with 12% more Poda

EventController

Event Management made easy. An Actionscript 3 Library.

No comments

I just came across this handy class for dealign with events. While there are many who suggest using a framework (at all cost), I've found that often just setting up the project properly can get you moving along smoothly. Of course this works best when you're the only one developing, as soon as you have more people involved, relying on a (well documented) framework can speed things along.

Anyway, one of the most things that got quite a bit of flack was event handling. While I did try using alternatives such as Robert Penner's as3 signals, I've ended up going back the events.

While I haven't had a chance to pop under the hood, the premise is that all events would be handled by a single handler (or multiple if you don't want to use a singleton). Whenever you create an event you pass (Object,Listener,Function,ID), ID is the newcomer. The Event Controller then creates all the bindings internally assigning a string ID. The ID can then be used with a regex call to sort the functions you want to close. 

more infor here: http://fla.as/ec/

Written by dasPoda

Wednesday 01 February 2012 at 10:25 pm

Posted in flash

Used tags: , ,

Flash 11 Beta Update

My favorite new features

No comments

It seems a new update to Flash 11 is out there, while Flash 11's big news item is and will likely remain the molehill API, it's good to see some other updates, here are few that I was excited about. Having a recursice removeChildren would be pretty awesome, as a lot of memory can get trapped easily with multilevel sprites/movieClips, previously I've been using the CasaMovieClip/CasaSprite to ease the pain.

Also exiting is the fact that it is available out-of-browser as AIR3

Garbage Collection Advice — Provides smoother, more responsive user experiences by allowing developers to provide hints (through System.pauseForGCIfCollectionImminent) to optimize garbage collection scheduling.

Cubic Bezier Curves — The Graphics.cubicCurveTo drawing API allows developers can easily create complex cubic Beziers without requiring custom ActionScript code.

DisplayObjectContainer.removeChildren and MovieClip.isPlaying — DisplayObjectContainer now implements a removeChildren API allowing developers to quickly remove all of a container's children using a single API.

64-bit Support — Native support for 64-bit operating systems and 64-bit web browsers on Linux, Mac OS, and Windows.

and of course...

Stage3D Accelerated Graphics Rendering — Stage3D ("Molehill") is a new architecture for hardware accelerated graphics rendering developed by Adobe. Stage3D provides a set of lowlevel APIs that enable advanced 2D/3D rendering capabilities across screens and devices (desktop, mobile, and TV). It gives 2D and 3D app and framework developers access to high performance GPU hardware acceleration, enabling the creation of new classes of rich, interactive experiences. Note: These pre-release builds include Flash Player and AIR desktop support; AIR for Android and iOS support will be enabled in a future pre-release build.

more at adobe labs or bytearray.org

Written by dasPoda

Thursday 14 July 2011 at 11:50 pm

Posted in flash

Used tags: , ,

getDefinitionByName and swc libraries

No comments

anyone that's used getDefinitionByName for a library might very well know that the classes from a library cannot be accessed if they are not defined. I've done "that trick" many times where I have a function somewhere, anywhere that lists the classes that I might need so that they get compiled into the flash file for later retrieval. I remember comming across this workaround (right way of doing it) where I don't need to do this.

I keep forgetting that you can include the complete library. This menu is in FlashDevelop under Options(right click on library, under "Add To Library"), but it's a flex compiler option, presumably, available to all IDEs.

Downside, obviously, is that everything gets compiled so be careful not to include libraries you don't intend to use. For this reason I"m using two separate libraries, an asset library and a content library.

Written by dasPoda

Saturday 18 June 2011 at 7:07 pm

Posted in flash

Used tags: ,

CASA 1.4.0

No comments

I almost missed this...

Aaron Clinger has released a new version of CASA Lib. 

CASA lib became one of those must have libraries taht a lot of my projects use. It is a series of classes that extend the core as3 functionality/classes.

CASA makes loading assets easier with classes like GroupLoad and CasaMovieClip. Using CasaMovieClip or CasaSprite has functionas that make removal easy with functions like destroy() and removeChildrenAndDestroy(). One of my favorites is the SwfLoad class which includes a createClassByName function. This makes it easy to load an swf and grab classes defined in an xml file. I've gotten quite attached, and looking forward to seeing what is new.

Speaking of great libraries, I should also point out that demonsterdebugger has a new version that came out not too long ago, that has heaps of improvements, like stepping through code.

Now I just need Branden Hall to release a new version of HYPE framework that he's been dangling in front of his talks' audiences and I'll be set for libraries.

(that's right, no MVC library for me)

--

Change Log (FROM CASA WEBSITE)

  • Added isMethod to ObjectUtil.
  • Removed a cross-class constant initializer from StageEventProxyuntil Adobe fixes the issue.
  • Fixed edge bug with VideoLoad that is only present in Flash Player 10.1.52.14.
  • Fixed a bug in Stopwatch. Reported by Tim Walling.
  • Fixed a bug in DateUtil. Reported by David Pett.
  • Added flipRectanglerandomlyPlacePoint, andrandomlyPlaceRectangle to GeomUtil.
  • Added children getter to CasaMovieClip and CasaSprite.
  • Added multiton to SingletonUtil.
  • Added spell and formatCurrency to NumberUtil.
  • Optimized format in NumberUtil and rearranged the arguments to be move convenient.
  • Updated NumberUtil‘s randomIntegerWithinRange so it returns a more evenly distributed random value.
  • Added isAge to ValidationUtil.
  • Added pluralize to StringUtil.
  • Updated StringUtil‘s autoLink to use an updated RegEx for improved URL matching.
  • Added normalizeDegree and distanceBetweenDegrees toGeomUtil.
  • Added getChildByNameRecursive to DisplayObjectUtil.
  • Added targetCoordinateSpace to alignment methods in AlignUtil. This means that no matter how many levels deep a Display Object in the display hierarchy tree it will align to the target coordinate space.
  • Updated AlignUtil so it only aligns the properties selected.
  • Updated Inactivity class to detect mouse wheel and clicks.
  • Fixed typo in Error thrown by DrawUtil‘s drawPath.
  • Removed unneeded code from CasaShape.
  • Made a private function protected inside of the UrlVariablesUtilclass.
  • Updated documentation to address typos, and add more examples and clarification.

Written by dasPoda

Saturday 18 June 2011 at 11:56 am

Posted in flash

Used tags: , ,

Grant Skinner on github

as3 libraries for all

No comments

Grant Skinner has started releasing his libraries on github.

The nice thing is that the code comes with descriptions and sample FLAs and SWFs.

Written by dasPoda

Tuesday 19 April 2011 at 09:22 am

Posted in flash

Used tags: ,

Flash Player 11 beta is out

Two comments

Adobe released 'Adobe Flash Player Incubator'

this release allows access to the new molehill api (set of low-level, GPU-accelerated 3D APIs for Flash and AIR)

head over to away3d.com and check out their latest build codenamed "broomstick" to see the demos utilizing the new features.

More Demos

jkiglibflash, the 3d physics engine has some more demos here

Quake 3 Map explorer

Coppercube Demo

but above all, do check out Zombie Tycoon the first 3d GPU accelerated Flash game

ps suck it S. Jobs

Written by dasPoda

Sunday 27 February 2011 at 3:42 pm

Posted in flash

Used tags:

Tonfall SWC

swc library for the tonefall project

No comments

Wanted to try tonfall, but I didn't have a svn client and I prefer having libraries in swc files, as they feel more concise, and I don't have to worry about internal code (unless I'm looking to extend where the as code comes in really handy) So here is a description of what the library does, a link to tonfall on google svn and the swc file.

Tonfall is an Actionscript framework to get you started in audio dsp programming within the Flashplayer(10+). Tonfall introduces only a vague design of an audio engine and is rather focussed on readability and simplicity than performance optimizations. Tonfall was initially written for the 'Audio Code Clash' workshop at 'Flash on the beach' conference 2010 in Brighton.

https://code.google.com/p/tonfall/

TONFALL.SWC

The last change to the library when compiling it was #88 made Sat Dec 18th 2010

library was made by Andre Michelle

Written by dasPoda

Saturday 22 January 2011 at 8:30 pm

Posted in flash

Used tags: ,

Sine Calculation

Speeding up the trig functions

Two comments

I've found a way to speed up the calculation of sin (the same can be done for cos by adding half of PI to the angle)

the theory:

series function

the code:

public function Sin($angle:Number):Number {

    $angle %= 3.14159265358979323846;

    var $angle2:Number = $angle * $angle; //$angle^2

    var $angle3:Number = $angle2 * $angle; //$angle^3

    var sin:Number = $angle

        -1.6666666666667E-01 * $angle3

        +8.333333333333E-03 * $angle2 * $angle3

        -1.984126984127E-04 * $angle3 * $angle2 * $angle2

        +2.755731922399E-06 * $angle3 * $angle3 * $angle3

        -2.505210838544E-08 * $angle3 * $angle3 * $angle3 * $angle2;

    return sin;

}

This is calculating sine every time, but if you head over to polygonal labs, Michael offers another option, where the numbers in the sine function are put in an array and retrieved instead of calculated.

http://lab.polygonal.de/2007/07/18/fast-and-accurate-sinecosine-approximation/

The code isa few years old, and I think there could be some advancments made such as using vectors. There is also an oversight with values outside of +- PI.

if (x >  3.14159265)
    x -= 6.28318531;

if you want to get the sin of 12 radians you might get an error. This could be remedied with a while instead of if so that it is recurstive, but I've found in my first tests that this recursion costs time. Instead a module (%) operation is much faster.

Written by dasPoda

Friday 12 November 2010 at 08:27 am

Posted in flash

Used tags: , , , ,