as3

An easy to use AS3 shape drawing class, gear, cogs, wedge, arc, star, burst

Monday, April 19th, 2010 | #FreeCodeSunday, Actionscript 3 | 8 Comments

Every other Sunday i’m going to try and release some free code. Things like projects i thought had legs, got to the prototype stage but never had time to finish, or Actionscript libraries that i think other might find useful.

In this case i’m releasing my shape drawing AS3 class. This is mainly just an Actionscript 3 implementation of the hard work done by both Kevin Williams and Ric Ewing. I’ve also used a Minimal Comps Slider as well and included the slightly amended code for that which does not require the Flex SDK (makes it easier for people not familiar with it).

Any comments, suggestions, or shapes you’d like to add just comment or send me a mail.

Enjoy, Aden.

EDIT -

Sidney de Koning has done exactly what i hoped and taken this on and made some improvements. Along with some nice speed tweaks, each method now takes in a reference to a Graphics instance instead of a Sprite class, improving the performance and making it move useful.

Nice work Sid, i’ve ammended the demo below to include his class and the associated source code. His related article…

The Flash plugin is required to view this object.



Click to download free source code

Tags: , ,

Standing Wave 2 – Open source AS3 sound engine

Friday, July 10th, 2009 | Actionscript 3, Flash and Sound | No Comments

I’ve been messing around with recently released Standing wave 2 engine over at JoeberKovitz.com. He used the initial version for his online musical composition app NoteFlight which is very polished, if a little hard to get into for a non muso like me.

I’m planning on using it in a child orientated music composition game, and using standard mp3′s it’s very smooth and solves most of the problems with timing sounds in As3. You can work with standard mp3′s or synthesise your own sounds as well.

I’d also recommend having a look over at PlayWithMozart by Jean Marc Bara, he’s a top dude and has created a really interesting app with smooth sound playback.

Tags: , , , ,

AS3 Youtube player 0.2

Monday, February 2nd, 2009 | Actionscript 3, Youtube Player | 7 Comments

Get Adobe Flash player

I’ve had a little time to iterate upon my previous demo using Youtube player in AS3.  It’s still not as clean as i’d like, and i haven’t done the Documentation yet, but it’s pretty solid and provides a good example of the methodology invloved.

I’ve only added Play/Pause btn, a clickable Progress bar, and mute button. The AS3 player loads in a AS2 flash movie which wraps the Youtube player and provides an actionable API. The AS@ communicates back to the AS3 player via a call to a pre named function passing all the current properties of the Youtube Player, currentTime, duration, state etc.

Once i get some more time, and i’ve tested it in a couple of applications i’ll finish it off and provide Documentation.

Click to download free source code

Tags: ,

AS3 TextField buttonMode or useHandCursor?

Wednesday, January 28th, 2009 | Actionscript 3, Quick Tip | 27 Comments

Unfortunatly, no method exits on the TextField class in AS3 as it does not extend the Sprite class, which contains the buttonMode property.

This is most apparent with the annoying problem of having a TextField inside your Sprite/MovieClip you;re trying to use as a button, where even after setting buttonMode = true on the button, rolling over the textfield inside the button will revert the Cursor back to default.

To get round this simply use the mouseChildren = false property on your Sprite/Movieclip button.

i.e.

myTextFieldContainingSprite.buttonMode = true;

myTextFieldContainingSprite.mouseChildren = false;

myTextFieldContainingSprite.addEventListener(MouseEvent.MOUSE_DOWN …… etc

Tags: , , ,

Quick Tip: AS3 Function parameters…..

Tuesday, September 2nd, 2008 | Actionscript 3, Quick Tip | No Comments

In old AS1 / AS2 you could get away with not passing all the parameters to a function, AS3 on the other hand has none of it.

But what you can do is asssign default values for each parameter so you don’t need to pass a value it.

i.e.

function hideObject(child:DisplayObject,fadeOut:Boolean=false):void
{
   if(fadeOut)
   {
      //fadeout Tweener code
   } else {
      child.visible = false;
   };
}

hideObject(target);//would instantly hide target
hideObject(target , true);//would override default value and so fade

Tags: ,

AS3 onReleaseOutside equivalent…

Wednesday, August 27th, 2008 | Actionscript 3 | No Comments

This is quite a common question for those looking to migrate from Actionscript 2.

As with most things in AS3 it initially seems odd, but after working with it you quickly see the thought process behind it.

Like AS2 you attach your standard Button style events to your object, MOUSE_DOWN, MOUSE_UP, MOUSE_OVER, MOUSE_OUT. But you attach the onReleaseOutside equivalent to the Stage and not the object.

i.e. -  stage.addEventListener(MouseEvent.MOUSE_UP,yourButtonReleaseFunction);

The stage then dispatches this event anytime the user releases the mouse button over the flash movie. Team that up with an Event.MOUSE_LEAVE to check if the mouse leaves the flash movie and you’re good to go.

Here’s a simple AS Slider example :

Tags: ,

Search