I'm an RIA Developer who owns a motorcycle custom paint shop, who loves to race anything with wheels. I also enjoy woodworking, cooking, fine wines, liqueurs and dark beers. So if nothing else my blog should be eclectic.  

Binding On A Class' Read Only Property

Development , Adobe Flex , ActionScript No Comments »
  • Do you have a class with read only properties?
  • Need to bind to those properties?
  • Getting: warning: unable to bind to property 'propertyName' on class 'com.example.package::ClassName'?

Add the Bindable metatag to your function and specify an event to be associated with it's update.

package com.example.package {
    import flash.events.Event;
    import flash.events.EventDispatcher;
   
    import mx.collections.ArrayCollection;

    public class ClassNameextends EventDispatcher {
        private var _myExposedVar:ArrayCollection;

        public function ClassName() { }

        public function set resultsObject(value:Object):void {
            /* Do Stuff with resultsObject and update _myExposedVar */
            this.dispatchEvent(new Event("ResultsUpdated") );
        }

        [Bindable(event="ResultsUpdated")]
        public function get myExposedVar ():ArrayCollection {
            return this._myExposedVar;
        }

    }
}

Problem solved.

Sorry, a ColdSpring BeanFactory named serviceFactory was not found in application scope

Server Config , ColdFusion , Development , Adobe Flex , ColdSpring No Comments »

I was trying to access an ColdSpring generated remote facad from Flex this morning when I got this error. It worked just fine by calling CFINVOKE and by calling the CFC directly in the browser. From my flash/flex app it however did not work. I hit my head for several minutes before finding the utmost simple solution.

I have multiple CF instances and it turns out that I did not fully setup the current instance to my liking. So if you see this error, check to make sure that your use-mappings settings is set to true in your services-config.xml file. Flipping this switch resolved my issue.

<use-mappings>true</use-mappings>

Setting Up Win32 Apache 2.2.x SSL/HTTPS

Server Config , Development , SSL No Comments »

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

Read more...

Eclipse IDE Shortcut: Move Code Up/Down

Development , Eclipse 1 Comment »

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.

Flex Toolbox: Get Average Color Of an Image

Development , Adobe Flex , ActionScript 5 Comments »

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.


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/

<mx:AddChild> I'm going to be a dad!

Friends / Family 5 Comments »

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

Disable mx:LinkButton Rollover Style

Development , Adobe Flex , ActionScript 3 Comments »

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:


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>

Regular Expression Tester For Eclipse

Debugging , Development No Comments »

I use regex a lot, it's extremly powerful when used correctly. That said, sometimes I get tired of refreshing my page multiple times before I get something to work right... Enter "Eclipse Regular Expression Tester"; I've been running this for a couple days now and I've been pretty happy with it. So in case you never thought of getting something like this like me, I wanted to put this out there as a recomendation.

Usage was very simple, paste your multi-line content in the bottom box and type your expression into the top box. What ever your regex expression would select ends up getting highlighted down below... Pretty slick and super simple. No need for frills here.

Eclipse Regular Expression Tester

Swiz From Source: Project Compile Gatchya (RTFM)

Swiz , Adobe Flex 2 Comments »

Actually I'm not sure if this is in the manual, but last week I briefly tried to use the latest version of Chris Scott's Swiz framework for flex from SVN. When I couldn't get it to work I went back to the latest SWC release that I had. Last night I randomly stumbled on an introduction to Swiz that Chris did mentioning build arguments required.

So in short, if your building Swiz from source (or plan on it) don't forget to add the following line of code to the Swiz project compiler:

-keep-as3-metadata+=Autowire,Mediate,Event

Mango Blog Plugin: Code Coloring (bug fix)

Development , Mango Blog No Comments »

A small bug was brought to my attention this morning regarding my code colorer and long posts. I did have a math error that has now been fixed; the bug could cause long posts to be truncated if using a non-classed <code>.

If your one of the many who is already using this plug-in I would recommend an update. If you haven't tried it yet, of course I encourage you to do so!

Download The Latest Version of Mango Code Color by EGPS Here

Best Font Choice For Your Programming IDE

Development 7 Comments »

Font choice can make a huge difference in ease of programming. Easily knowing the differences betweens "1"s and "I"s, "0"s and "o"s can help lesson both mistakes and eye strain. Sometimes my choice is based on monitor. I use to love the Anonyomous font; however with my current screen, it looks strained somehow. I'm currently test driving Consolas Regular.

There is no perfect choice, but there are some general rules that I think should be tested for every font used to develop with.

  1. Clear easy to read & not too compressed
  2. Differentiated characters, ie: 1,I & 0,O
  3. Monospaced / fixed widths (not everyone agrees with this)

Some of my recomendations:

There are multiple multiple options for fonts, so if you've got something... I'm always looking for something better. If you've never tried to change your IDE font, you should. You might find your headachs to be a little bit less at the end of the day!

Flex Builder: Process terminated

Debugging , Development , Adobe Air 1 Comment »
  1. Is your Flex builder throwing the error "Process terminated without establishing connection to debugger" when your try to launch your Air Application?
  2. Did you recently upgrade your SDK or the entire Flex Builder application, maybe to SDK 1.3?
  3. Are you working with a pre-existing project?

Open up your projects "projectName-app.xml" file in your source root. The second line will most likely be:
<application xmlns="http://ns.adobe.com/air/application/1.1">

Change it to:
<application xmlns="http://ns.adobe.com/air/application/1.5">

Your project should run just fine on recompile

Flex ToolBox: PlayButton

Development , Adobe Flex , ActionScript No Comments »

I needed a few different size play buttons to show up over an image and using transparent GIF images resulted in uglyness. So to throw another component in my tool box I wrote "PlayButton". If you need a play button to show up on a mouse over this could be a a nice clean component to throw in there. Configurbility includes background color & alpha, play button color & alpha as well as fadein/fadeout effect settings. The "background" and play button are configured seperatly so you can have a small play button in the center of a very large masked area if you desire.

private function getPlayButton(target:DisplayObject, buttonWidth:int):PlayButton {
    var btn:PlayButton = new PlayButton(true, 0xFFFFFF, 0.45, 0xFF0000, 0.85);
    btn.width = target.width;
    btn.height = target.height;
    btn.playButtonWidth = buttonWidth;
    return btn;
}

In my example above I only set the playButtonWidth and not the height because the button by default will scale upon the setting of either width or height. You can turn this off with a simple "btn.scaleButtonOnResize = false".

Download the latest version of PlayButton (source code & example)
Read the full post to see the example app on screen

Read more...

Flex ToolBox: AdvancedImage

Development , Adobe Flex , ActionScript No Comments »

My new AdvancedImage component takes a few seperate and common needs for an image and rolls it into one nice package. AdvancedImage will allow you to easily define rounded corners (seperatly), pass in a rollover DisplayObject and will even handle cross-dissolves. I needed to provide this component to someone newer to Flex so I tried to makes it's use as simple as possible.

<graphics:AdvancedImage
    id="myExample"
    width="150"
    height="170"
    topRightCornerRadius="8"
    bottomRightCornerRadius="8"
    source="assets/waterfall.jpg"
    crossOverEffect="{createCOE()}"
    mouseOverObject="{getMouseOverMask()}"
/>

  • crossOverEffect is the effect you wish to use when changing images. when you update myExample.source, if an effect has been defined it will use that method to display the new image on top of the old one. Otherwise myExample.source = "newImage.jpg" will work just like a regular Image component.
  • mouseOverObject is just that. If you pass in a displayObject, on mouse over, that object will be enlarges to the same size as the image and displayed. In my code example I'm just using a simple white canvas with alpha set to 0.46. This is a simpler than expected example of a mouseOverObject.
  • The corner radiuses are applied via a top level Canvas, AdvancedImage actualy extends Canvas, not Image. So any images or mouse overs you pass in will be masked.

Download the latest version of AdvancedImage
Read the full post to see the example app on screen

Read more...

ColdFusion to Confluence Gateway/API (updated)

ColdFusion , Confluence , Development 2 Comments »

Almost a year ago I first released my ColdFusion to Confluence Gateway (read about Confluence here). Since then my use of the API spread into several applications. Not only have my requirements grown, but I found several ways to do things better. Notably from my last public version, connection state management/knowledge is significanly better.

Some new hooks include: exportSpace, getPagesOrdered (by space), getDescendents, searchSpace

Download The Latest Version Of The Coldfusion to Confluence Gateway

Powered by Mango Blog. Design and Icons by N.Design Studio & EmpireGP Services