Perceptions..

September 5, 2011 Leave a comment

 

 

 

 
sent to me by @daveygdublin

 

 

 

 

Categories: Uncategorized

Saturday in San Francisco

August 14, 2011 Leave a comment

My new role as UI Enigineer @Workday has brought me to Pleasanton CA for a couple of months training with @daveygdublin so below is a guide for a few things to do on an idle Saturday afternoon in San Francisco.

If you are not staying downtown grab a BART(make sure to get a clipper card @Walgreens) to Embarcadero taking the Main st exit and have stroll around the awesome farmers market.

Once you’ve got your fill of the market head down Main st towards Union Square and grab a Peets coffee and sit out in the square taking it all in.

By now your thinking about lunch. If you want a full service American experience get lunch @Cheesecake on the top of @Macys looking over Union Square (can be a 45min wait for an outside table so book early or accept the wait and be called via an electronic vibrating beeper). Alternatively if you are not ready for one of the biggest lunches you will experience grab a pork sandwich at the farmers market from beside the ferry building(just look for the stall with the longest queues, chickens and pork on a rotisserie – you can beat the queues by opting for the chicken over the pork).

Post lunch take in the the American shopping experience and browse around your favorite shops around Union Square.

When you’ve had enough of shopping head for a relaxing beer or cocktail(all $11) @TwentyFiveLusk (this uberly cool yet totally unpretentious bar(and also resto +added to my todo list) would look perfectly at home in any of the best ski resorts the planet has to offer).

Post an afternoon drink it’s time to think about an evening meal @cafeclaude (worth booking, outside reserved for walk-ins) where I would recommend a soupe d’oignon to start or if you are into Parmesan like @nataliamcc a caesar salad (menu helpfully sorted by price). For mains it has got to be a tartare(steak(prepared at table) or tuna(awesome gloopy Balsamico) both with quail egg and only $13!!). If you’ve got any room left for desert(I didn’t) the creme brulee looked like a winner. Awesome food accompanied by a fantastic atmosphere (live music) at a very reasonable price, it’s a total winner. Wine wise you can’t go wrong with a macon villages (a bit sacrilegious with the steak tartare but we all have our failings).

Flex compiler view generated ActionScript from MXML

July 18, 2011 Leave a comment

Add the compiler argument -keep and look at the generated folder in the output directory.

Categories: Flex

Implementing IFocusManagerContainer

July 8, 2011 Leave a comment

Further to my post yesterday http://kgaffney.wordpress.com/2011/07/07/scroller-null-focusmanager-exception/ on using a component that implements a IFocusManagerContainer interface, today I went and implemented that interface in my the original Flex component I wanted to extend. After a quick google, the required code was:

private var _defaultButton:IFlexDisplayObject;

public function FocusEnabledGroupPopup(){
	super();
}
public function get defaultButton():IFlexDisplayObject{
	return _defaultButton;
}
public function set defaultButton(value:IFlexDisplayObject):void{
	_defaultButton = value;
	ContainerGlobals.focusedContainer = null;
}

Which I got from: http://sharathchandra.net/?tag=ifocusmanagercontainer

Categories: Flex, Flex 4, Spark, Uncategorized

focusManager null Exception in Scroller

July 7, 2011 1 comment

Currently working on an interesting “Top Secret” gap feature. One of the requirements we have for this feature is to be able to max and restore it. While trying to setup the max and restore  I ran into a null error in the Scroller.as class relating to the focusManger.

Attempted pop-up logic went something like this:

IVisualElementContainer(resizeComponent.parent).removeElement(resizeCo mponent);
FlexGlobals.topLevelApplication.systemManager.addChild(resizeComponent );

Which lead to an error in Scroller.as when you would attempt to focus in on the component post resize:

override protected function focusInHandler(event:FocusEvent):void
    {
        super.focusInHandler(event);
        // When we gain focus, make sure the focused element is visible
        if (viewport && ensureElementIsVisibleForSoftKeyboard)
        {
            var elt:IVisualElement = focusManager.getFocus() as IVisualElement; //null object excpetion thrown here
            lastFocusedElement = elt;
        }
    }

So the helpful Adobe forums came to my rescue without telling me to just read the documentation.

The Spark component I was attempting to popup did not implement the IFocusManagerContainer interface (hence the null..). In the end I went with SkinnableContainer as my wrapper.

Finally I should also have been using PopUpManager. So max’ing can now go something like this:

IVisualElementContainer(this.parent).removeElement(this);

PopUpManager.addPopUp(this, DisplayObject(FlexGlobals.topLevelApplication), true);

Just don’t loose that reference to the original parent!

http://forums.adobe.com/thread/874365

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/SkinnableContainer.html

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/IFocusManagerContainer.html

Categories: actionscript, Flex, Flex 4, Spark

Run-time error #2148: SWF file _ cannot access local resource

July 6, 2011 Leave a comment

Add an additional compiler argument: -use-network=false

Categories: Flex, Uncategorized

ActionScript Weak Reference & Memory Management

April 26, 2011 2 comments

When working with Flex, memory management might not be described as its strongest asset.  The memory profiler that comes bundled with Flash Builder is a useful tool to help you troubleshoot problem points. However, as always the best cure is always prevention.

One of the areas programmers can be really nice and proactive with memory management is around using event listeners.  When you add an event listener one of the parameters is the method you want to handle any subsequent results. The dispatcher now holds a reference to the method (& the class containing it).  Once the result is handled best practice is to remove the listener to remove the reference enabling collection. However, if we use a weak then the programmer no longer has to worry about removing the listener. If the reference held by the dispatcher has been set as weak and it is the only reference held, then garbage collection can still proceed.

Manual best practice:

.addEventListener("EVENT_TYPE", resultHandler, flase, 0, false); //last parameter use weak reference by default is false 
//in result method remove reference
.removeEventListener("EVENT_TYPE", resultHandler, false);

Weak reference:

.addEventListener("EVENT_TYPE", resultHandler, flase, 0, true); //set weak reference to true & therefore no remove required in resultHandler

Implementing Generics / Type Safe Collections in Flex

April 20, 2011 Leave a comment

A really useful\safe feature in Java is the ability to  specify the type of objects in a list using the Generics feature.

For example if we have a Person class and we require a list of people we can do something like this:

List<Person> = new LinkedList<Person>();

In Flex the concept is the same but the implementation a little different:

 var people:Vector.<Person> = new Vector.<Person>();

Most of the documentation I have read focuses on using the Array and ArrayCollection ActionScript classes. However, using Vector with its type definition is a much better implementation, as in my view compile type errors are much better then user encountered runtime ones.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Vector.html

Implementing a Singleton Design Pattern in ActionScript

April 19, 2011 7 comments

One of the differences between ActionScript and Java is that in ActionScript you cannot have a private constructor.  A private constructor is a really useful utility when implementing a singleton in Java.  So how can we implmenent a singleton in ActionScript?

The trick is to define an internal class within the same file as your public singleton class (Note: ActionScript does not allow private classes or nested classes – see comments in SingletonImpl.as for more detail)

Example: http://www.redbrick.dcu.ie/~napalm/blog/Singleton/bin-release/Singleton.html (view source enabled)

Flex Data Binding

April 16, 2011 Leave a comment

Having recently been asked, what does the [Bindable]  meta tag in Flex actually do, I thought I would do a post on binding in general in Flex.

1.What is binding?

Binding is a feature in ActionScript that allows one item to listen to the value of another.

2. What is the principal?

Binding is built around the concept of a source and a destination.

3. Is everything bindable?

By default Flex does not assume everything is bindable. Flex needs to be explicitly instructed as to what is bindable.

4. How do I make something bindable?

Four examples:  http://www.redbrick.dcu.ie/~napalm/blog/BindableExample.html (view source enabled)

5. What is actually happening behind the scenes?

Flex is based around the concept of events. Binding is carried out using the event system. When a variable is bound a dedicated listener is established that picks up change events issued from the variable or object to which it is bound. Flex can take care of the boiler plating.

Binding is a core concept in Flex, is something you will use everyday and is something that requires a good understanding.

Follow

Get every new post delivered to your Inbox.