Viewing by month: April 2009

This walk through will help you setup Win32 Apache 2.2.x with an SSL test environment using a self signed certificate that I will also show you how to create. I will use my full paths to help with the comprehension.

The post is a bit long, so please [read more] to view the entire walk through

A while ago I posted about some shortcuts I often use in Eclipse. Well this morning I found a new shortcut that I can't believe I never knew about; and while borderline, I deemed it worthy of it's own post!

ALT + UP-ARROW
ALT + DOWN-ARROW

I tend to be an ordering freak and this little gem of simplicity is way better than cutting and pasting. This short-cut key will move any line your cursor is on or any lines you have selected in the direction you press.

Ever wanted to set background colors or border colors based on an image's "theme"? Thats what I needed to do, and I was suprised by how easy it was.

I've created a "SmartImage" that i'm using in my RoundedImage component. When you set the borderStyle to "dynamic" it will use this generated average.
<flash source="/FlexApps/CookBook-DynamicImageBorder/DynamicImageBorder.swf" width="508" height="279" quality="high" scriptAccess="none" align="center" />


Full Source Code for SmartImage. due to an error with my code viewer plugin (that I wrote) it looks like a couple double GT signs got converted. Anything that is a » is really two greater than symbols!
package com.EGPS.toolbox.graphics {
    import flash.display.BitmapData;
    import flash.events.Event;
   
    import mx.controls.Image;
    import mx.events.FlexEvent;

    [Event(name="averageColorUpdated", type="flash.events.Event")]
    public class SmartImage extends Image {
        public static const AVERAGE_COLOR_UPDATED:String = "averageColorUpdated";

        [Bindable]
        public var averageColor:uint;

        public function SmartImage() {
            this.addEventListener(FlexEvent.UPDATE_COMPLETE, updateAverageColor);
            super();
        }

        public function get image():Image {
            return super;
        }

        private function updateAverageColor(event:*):void {
            trace("updateAverageColor: " + event.type + " : " + this.width + "x" + this.height);
            if (this.width == 0 || this.height == 0)
                return;

            var bmpData:BitmapData = new BitmapData(this.width, this.height);
            bmpData.draw(this);

            var r:Number = 0;
            var g:Number = 0;
            var b:Number = 0;
 
            var count:Number = 0;
            var pixel:Number;
 
            for (var x:int = 0; x < bmpData.width; x++) {
                for (var y:int = 0; y « bmpData.height; y++) {
                    pixel = bmpData.getPixel(x, y);
 
                    r += pixel >» 16 & 0xFF;
                    g += pixel »» 8 & 0xFF;
                    b += pixel & 0xFF;
 
                    count++
                }
            }
 
            r /= count;
            g /= count;
            b /= count;

            this.averageColor = r «« 16 | g «« 8 | b;

            this.dispatchEvent(new Event(AVERAGE_COLOR_UPDATED));
        }
    }
}

After writing this post, I found a great example app with maybe not as light weight, but very nice image color extractor! http://blog.soulwire.co.uk/flash/actionscript-3/colourutils-bitmapdata-extract-colour-palette/

I apologize for the horrible geeky tie in, but I couldn't avoid this one. I've just been overwhelmed with joy that my wife is 12 weeks pregnant which means I will be a first time dad in Oct.

Of course this also means that if anyone has any side work that they are looking to get done, I could really use to pick up some extra Flex or ColdFusion work in the meantime :)

It still feels semi-dream like, but this brings realty into full light!Ultrasound at 11 Weeks

I don't use the LinkButton component very often, but the few times I have, it has generated a pure hatred for that default roll over button look that always seems extremly bulky. Thankfully removing this little rollover effect/style is very simple, just set skin = null.

My Example:
<flash source="/FlexApps/Example-LinkButtonHover/ButtonTest.swf" width="215" height="92" quality="high" scriptAccess="none" align="left" />


Full Source Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="215" height="92">

    <mx:VBox x="0" y="0" width="100%" height="100%" verticalAlign="middle" horizontalAlign="center" verticalGap="10">
        <mx:LinkButton
            label="Default LinkButton"
            textDecoration="underline"
            color="#1B33E5"
        />

        <mx:LinkButton
            label="LinkButtong With No Roll Over"
            textDecoration="underline"
            color="#1B33E5"
            skin="{null}"
        />

    </mx:VBox> /></mx:Application>