Screen reader accessible Flash

March 8th, 2010

Accessibility and Flash – Adobe does most of the hard work for us. There is a white paper on this issue here
What you need to remember is this:

  • All the text fields have to dynamic in order to be accessible.
  • You can bring up the accessibility panel in the Flash IDE    window > other panels > accessibility and inspect each element.
  • Any element that has no text label and needs to be interacted with should have a label assigned through the accessibility panel
  • check that your navigation components can be navigated in the correct order through the TAB key, label them if they don’t have a text element

This is so much easier then doing this in HTML..

Flex Builder no HTML wrapper

January 1st, 2010

If you create in Flex Builder 3 a new AS3 only project and choosing the Flex 4.0 SDK , Flex Builder wont generate an HTML wrapper for you and will throw an error when you try to compile “File not found: file:/C:/wamp/www/myfolder/bin-debug/ProjectName.html” .
The only thing that worked for me, is to create a project with the Flex 3.2 SDK and then change it to 4, and FP 10.
Wierd bug..

Reseting RadioButton component

December 31st, 2009

I was working on a small project at Tangent for Labour. Its a simple quiz, built with robotlegs.
But I stumbled in to funny issue. From question to question in need to reset the UI with the RadioButton selected, for the user to have a clean slate…. how? Setting myradio.selected = false
doesn’t works.
The only solution I found, is having a hidden dummy radio button, and choosing it to reset all the rest.

Pixel boom sound version

December 29th, 2009

Final version, with optimized code:

never drops under 26fps.

Here
Next I am looking in to shapes.

Pixel Boom

November 26th, 2009

I am working on this pixel manipulation using the flash player 10 sound API, the SoundMixer and some handy Vectors.
oh and papervision3D of course! This is still not 100% optimized and i would like to build a better narrative and some goodies.
But this is the general direction.
Music by my good friend Ido Tavori

boom

Braking images to pixels

November 25th, 2009

I really like the idea of braking down an image to its pixels and manipulate it. Will be playing with this further.

I’ve already been there before

Google analytics GIF and AS3

November 8th, 2009

Google analytics in Flash is nothing new, there is a library that should do the job for you just fine.
It has two modes an External Interface mode that will communicate with the tracking code in your HTML, and an AS3 mode that will do the job for you without the JS embedded.
But, what happens if you can’t spare the extra 43k that the library adds to your application, and actually, should you really stuff your application with extra 43K just to interface to a JS?

It was pointed to me by my friend and colleague Alfredo that what actually happens behind the scenes of GA tracking is just a simple GET call to a 1px GIF that resides on Google servers. All the tracking info is just a bunch of parameters, you can find more in for on the “mysterious” GIF call here. Google documents the call pretty well and goes through what each parameter is for.
I’ve implemented this call in a simple static class, that will allow you to track any page call… from an event handler or you can link it strait to SWFaddress, for a price of a couple of K.

Download GoogleAnalyticsGIF.as

Animation loop

November 7th, 2009

I find this loop code clean and pretty when it comes to executing repetitive animation, something repetitive along the off and on lines for multiple instances on a Timer or a EnterFrame events.
We create a field

private var _counter:int;

and irritate through an array of display objects using it to witch on the next item and switch off the previous one.
In this particular example we switch an array of display objects filers on and off.

(_counter != _items.length - 1) ? _counter++ : _counter = 0;
_items[_counter].filters = _filters;
var previousItem : Number = (_counter != 0 ) ?
_counter - 1 : _items.length - 1;

_items[previousItem].filters = null;

Full example code:

package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.utils.Timer;
    import flash.filters.DropShadowFilter;
    import flash.events.TimerEvent;

/**
* ...
* @author L.gn
*/
    public class Main extends Sprite
    {

         private var _timer:Timer;
         private var _items:Array = [];
         private var _filters:Array = [];
         private var _counter:int = 0;

    public function Main():void
    {

         var i:int;
         for (i = 0; i < 5; i++) {
         var shape:Sprite = new Sprite();
         shape.graphics.beginFill(0xff0000);
         shape.graphics.drawCircle(0, 0, 20);
         shape.y = 200;
         shape.x = i * shape.width + 10;
         shape.graphics.endFill();
         _items.push(shape);
         this.addChild(shape);
         }

         var shadow:DropShadowFilter = new DropShadowFilter();
         _filters.push(shadow);

         _timer = new Timer(1000);
         _timer.addEventListener(TimerEvent.TIMER, animationTickHandler);
         _timer.start();

     }

     private function animationTickHandler(event : TimerEvent) : void {
         //check if the counter reached the length
         // of the array if it did the it should be 0 if not add 1 to it
         (_counter != _items.length - 1) ? _counter++ : _counter = 0;

         //add filters to the item
         _items[_counter].filters = _filters;

         //find the previous item, if the counter not 0
         //then subtract 1 other wise counter should be the lenght of the items array
         var previousItem : Number = (_counter != 0 ) ? _counter - 1 : _items.length - 1;

         //remove filters from item.
         _items[previousItem].filters = null;
     }

  }

}

Back from share host hell

October 17th, 2009

My blog and website have been down for a week. I was caught in a midst of a religious web war.
2IP my share host who happen to be a bunch of evangelist loonies (with a very affordble hosting offer ) have been taken down by
a muslim hacker nut. He taken down their servers and every time they tried to restore the backup he has done it again.
So they had to wipe out all of their back up too… which left me without a website or a blog.
2IP have failed to meet the minimum requirements from a share host – being secure. They have closed down and moved all of their clients to gator host with a free year package. All in all I did got a year free hosting.

On another note my girfted girl friend has finished her project. Which is a collaborative tool for students to share their lecture notes through twitter and then d/l them as a PDF. Have a look http://0142am.com/twica