Something Wrong with the System

A Flash/Actionscript blog

FadeSound AS3 – A class which fades sounds in and out automatically

Get Adobe Flash player

Recently I was working on a project that required me to fade a sound in and out dynamically. Here is the result:

FadeSound (clever name, huh?) is an AS3 class that extends Flashs built in Sound class and includes fading in and fading out (including auto-fade out on sound completion).

Here is the source:

You can probably just dive in and figure it out based on the examples, but I’ll do a write-up after the break.

Read the rest of this entry »

December 27th, 2010 by Peter Organa
Posted in AS3, Programming, Source Code | Comments Off on FadeSound AS3 – A class which fades sounds in and out automatically

Sprocket (Circa 2006)

In an effort provide further evidence that I’m still alive and that I still care about this blog I’m posting more old stuff! This time from way back in 2006.

This is a game engine I called Sprocket. Sprocket was my ‘Learn AS2’ project. The code was an absolute mess, but I’m still really proud of the game.

Be sure to check out the cars with working Suspension (jump on them!), the bullet sparks (dynamic!) and the shot gun (use your mouse wheel or the 1 and 2 keys to switch weapons).

I wasn’t the only person to work on this!

The background graphics are by Trevor Goodwin.
The Character Sprites are by Justin Chan.
The Music is by Ragozzino
The title screen is by Marcin Zajkowski

You can see the game in action here

May 29th, 2010 by Peter Organa
Posted in AS1, Gaming, Programming, Super Cool | Comments Off on Sprocket (Circa 2006)

Flash Pie Chart complete in Flash AS3 AND Flex!

Get Adobe Flash player

Before I begin I’d like to point out that you can buy this 3D Flash Pie Chart for $10 from this link.

About half a lifetime ago I posted about the Pie Chart I was working on.

I spent a hell of a lot of time turning that AS3 Pie Chart into a proper component. Adding a lot of behind the scenes functionality. Making it Flex compatible. Making sure it was 100% code based. As well as writing up a bunch of documentation.

What I was left with was a Flash Pie Chart which looks almost exactly like the one I did in September except this one has a lot of useful functionality for developers and is much more CPU efficient.

I’ve been selling the Pie Chart component on Activeden (formerly Flashden) and folks seem happy: a 5 star rating and lots of positive feedback!

Anyway if you’re in the market for an AS3 based Pie Chart you can get an awesome one written by me. It’s only $10.

Also, I’m sorry I haven’t posted in such a long time. I recently bought my first condo and haven’t had time to work on side projects! Things are starting to settle down now, and I’m already thinking of a new swarm based project.

March 11th, 2010 by Peter Organa
Posted in Flash Components, Programming, Super Cool | Comments Off on Flash Pie Chart complete in Flash AS3 AND Flex!

Real Life Swarms

I just saw this on Youtube, it’s a video of  500,000 bats flying out of a cave filmed in infrared.  It really reminds me of the Boids swarming app I wrote, especially how the bats will zig-zag as they fly. 

October 7th, 2009 by Peter Organa
Posted in Not Programming, Swarming | Comments Off on Real Life Swarms

Making AS3 components is harder than I’d imagined…

I’ve updated the Flash Pie Chart, made it more awesome and put it up for sale on ActiveDen as a Flash component and Flex Class!
Check it out! It’s pretty rad!

So as I wrote earlier I’m working on transforming my 3D Pie Chart into a proper AS3 component.  Holy crap, it’s harder than I thought!

By far the most useful resource I’ve found is this one written by Jeff Kamerer from Adobe.  The document is divided into 9 parts (it’s a small book!) and covers:

I’ve trudged my way through the first 3 parts and… GREAT SUCCESS!  I’ve got my Pie Chart publishing from a component inspector window (shown on the left).

The bit of code that caused me the most grief is the section that pertains to the dataProvider.  It seems that if I want custom parameters in my Component Inspector I need to create my own DataProvider classes.

[Collection(collectionClass="ca.organa.Data.Collect", collectionItem="ca.organa.Data.ComponentInfo", identifier="sliceLabel", name="Pie Chart Data")]
 public function set dataProvider(value:Collection):void {
 if (_dataProvider != null) {
  _dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
  _dataProvider = value;
  _dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);

Jeff covers the topic here.

I’ll post about components again once I’ve gone further into this stuff.  My next challenges are going to be getting live preview working, and getting a proper colour picker in the component inspector (is that even possible?). Read the rest of this entry »

September 8th, 2009 by Peter Organa
Posted in AS3, Flash Components, Programming, Source Code | Comments Off on Making AS3 components is harder than I’d imagined…

My AS3 3D Pie Chart

I’ve updated the Flash Pie Chart, made it more awesome and put it up for sale on ActiveDen as a Flash component and Flex Class!
Check it out! It’s pretty rad!

First an FYI, this is a showing off post.  I’m not sharing the source for this as I’d like to explore the idea of selling the Pie Chart as a Flash Component.

Recently at work I’ve been doing on a bunch of charts (mostly analytics style lines graphs).  When I was finished, I thought to myself: “Well I haven’t done a Pie Chart yet”.
Ultimately, it took me 5 times longer than I would have ever expected, but I did create a fully functional 3D Pie Chart!

  • This is a true 3D Pie Chart with rotation.
  • This is done completely with Flash’s draw API, I don’t make use of Flash10 3D features or Papervision
  • The Pie chart is resizable and all the data/colours are externally configuarable.  You can even change the view angle.

Read the rest of this entry »

September 4th, 2009 by Peter Organa

2D Game Scrolling in AS3 (my very early implementation)

Level ScrollingA few weeks ago I started work on a new game as a hobby project… unfortunately I also started playing A LOT of Company of Heroes on the PC, so progress on the programming has been slow, very, very slow.

But I did write at least one useful piece of code that I think some people might find useful:  Level Scrolling.

When I was working on my first Flash 2D platform engine Sprocket (game was never finished).  I found one of the biggest problems was having the level scroll properly.  So this time when I started writing the game engine, scrolling was the first thing  I nailed down.

In Sprocket I found that scrolling with the Character locked in the center of the screen was unsatisfactory as enemies could easily sneak up behind you.  So I developed a system where the mouse controls the user’s view.  I was inspired by the scrolling in PC games such as Abuse, and Soldat.

In my new game I’ve created a LevelDisplay class which handles all scrolling work automatically. Just tell the LevelDisplay what game sprite to focus on and it will handle the rest.

Keep in mind all of this code is very early, so please don’t just plonk this in your game.  Once I’ve built an actual game I’ll have a better idea of how successful my implementation actually is.  But for now I’ll share what I have and maybe you can get some use out of it.

Read the rest of this entry »

August 23rd, 2009 by Peter Organa

The Lander (Circa 2004)

Back in 2004 I worked on a game called ‘The Lander’ it was eventually licensed by and (for not very much money at all).

‘The Lander’ is the project that convinced me that maybe I should continue working in Flash and ActionScript.

Anyway.  For the past 5 years ‘The Lander’ was hosted by my friend Mario Tan (this is back from the time when I was too poor to afford web hosting).  Mario’s hosting has finally expired, so I’m hosting it myself.

WARNING: This game is old (written in Flash 6!) and super buggy.     It is not an indicator of my current skill set!

You can play the game here

August 3rd, 2009 by Peter Organa
Posted in AS1, Gaming, Not Programming, Programming | Comments Off on The Lander (Circa 2004)

PhotoPal (maybe PhotoViewr) ?

photoPal Sample Image

I spent some time the last week working on my dad’s website (he runs a portable Pet Photography Studio).  Specifically, I was working on a AS3, PHP+SQL application that would give his clients a preview of their photos before they order them.

I hadn’t worked on a PHP project in ages and the language was just as a I remembered it: Really ugly code that does exactly what I need it to do.

The Flash to PHP communication was handled via XML-RPC for PHP and XMPRC for Asctionscript 3.0.  XML-RPC is a set of libraries that help you ferry data from one system to another.  It took me a little while to get the knack for preparing the RPC Objects, but ultimately it was a painless process.

What I was left with is a (ugly as hell) back-end interface in PHP that outputs to an attractive (I think) Flash front-end.

The advantages here are:

  • My dad doesn’t need to know any code to get this to work, he browses his file system for images and the PHP code takes care of everything else.
  • Clients (who lack tech savvy) can’t download the JPEGs and print illicit images like they could with a pure HTML/PHP interface.
  • My dad doesn’t need to re-size his Images to fit flash as the PHP script will take care of that.
  • The PHP/SQL link up lets me save favourites and do per image click user tracking.
  • A Flash interface is just cooler!

I think my favourite part of this app is the Transition class, it transitions between any two display objects with a fade & re-size.  I’m using that class to display everything in the main window.  If anyone shows interest I’ll go ahead and clean up the class and post it here.

Anyhow.  You can see the app in action here.  Use ‘Reese‘ as a password.

If anyone is curious you can see my Dad’s Flickr page here.

Oh and if you’re wondering about the blog post title.  I have no idea what to call this application.  I’ll gladly take suggestions in the comments section!

July 23rd, 2009 by Peter Organa
Posted in AS3, Not Programming, Programming, Super Cool | Comments Off on PhotoPal (maybe PhotoViewr) ?

Bezier Curves AS3

Ok, so I’m coming down with a serious case of blog guilt. I haven’t posted in… well a while.

First my excuse:

I just finished a big freelance job.  Now that the job is done I can get on to some more exciting stuff!

To warm myself up. I’m posting something I played around with recently. I explored Flash’s fl.motion.BezierSegment class. It’s neat and surprisingly easy to use.

You can see the swf in motion after the break.  I’ve included the source code, enjoy!

Grab the source here

Read the rest of this entry »

July 6th, 2009 by Peter Organa