Archive for October, 2009

CoolIris type thing in 30 lines

package { // Piclens type thing in 30 lines (FP10+) Liam O'Donnell - spikything.com
    import flash.display.Sprite;
    import flash.events.Event;
    public class Main extends Sprite {
        private var container :Sprite;
        private var imageGrid :Sprite;
        private var images :Array = [];
        public function Main():void {
            container = addChild(new Sprite()) as Sprite;
            imageGrid = container.addChild(new Sprite()) as Sprite;
            for (var i:uint = 0; i <200; i++) images.push(getItem(i));
            images.sortOn("z", Array.NUMERIC | Array.DESCENDING);
            for each (var item:Sprite in images) imageGrid.addChild(item);
            addEventListener(Event.ENTER_FRAME, update);
        }
        private function getItem(index:uint):Sprite {
            var item:Sprite = new Sprite();
            item.x = -(200 / 3) * 210 / 2 + (index / 3) * 210;
            item.y = (index % 3) * 160 - 40;
            item.z = 100 + Math.random() * 2000;
            item.graphics.beginFill(Math.random() * 0xffffff);
            item.graphics.drawRect(0, 0, 200, 150);
            return item;
        }
        private function update(e:Event):void {
            imageGrid.x += ((stage.stageWidth / 2) - mouseX) * .2;
            container.rotationY = ((stage.stageWidth / 2) - mouseX) * .2;
        }
    }
}

Local playback security in FlashDevelop and Flash CS3 / CS4

I've seen a few people get into a pickle over this one. When you're developing and testing locally, you need to set the 'Local Playback Security' setting (sometimes referred to as the 'use network services' option) depending on whether you wish to access local external files (e.g. XML files, or images) or some other server (e.g. your dev backend server). You can't access both from a locally running SWF anymore, since it's a security risk. So here's how to set that option in Flash CS3 / CS4 or from within FlashDevelop.

Turkey

Whirling dervishes in TurkeyI recently went to Turkey and travelled around the entire Western half of the country. The highlight was hot air ballooning over Cappadoccia, but I just found this long exposure photo of some whirling dervishes I took and thought it was worth posting.