theDeSilva.com Andrew de Silva

Restart A Flex Web Application

May 14th, 2009 · No Comments · Flex

Here’s a quick way of restarting your Flex Application without reinitializing everything through a function

navigateToURL(new URLRequest(Application.application.url), ‘_self’);
Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Technorati
  • Facebook
  • Google
  • LinkedIn

→ No CommentsTags:

Creating Hand Cursor for Flex Component

April 6th, 2009 · No Comments · Flex

In order to change the mouse cursor to a hand cursor when a mouse over a particular component in Flex Component you will need to set useHandCursor = true , however if you set this to true you will not be able to get the hand cursor unless you set another two properties on the Flex component , buttonMode = true and mouseChildren = false.

Here’s an example

1
2
3
4
var label:Label = new Label();
label.buttonMode = true;
label.useHandCursor = true;
label.mouseChildren = false;

Once you set all three property of the component you will have the hand cursor when the mouse moves over the flex component.

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Technorati
  • Facebook
  • Google
  • LinkedIn

→ No CommentsTags:···

MouseEvent.DOUBLE_CLICK Not Firing

March 6th, 2009 · No Comments · Flash, Flex

Recently I was working on a project that I was using MouseEvent.DOUBLE_CLICK and the darn thing wasn’t firing no matter how many times that I’ve clicked on it. After awhile I remember that most  Flex component actually have a doubleClickEnable property . Guess what was the result of the trace when I did

1
trace(image.doubleClickEnabled) // this will return false

The simple solution for getting MouseEvent.DOUBLE_CLICK to work is to ensure that you set the property of doubleClickEnable to true

1
2
image.doubleClickEnabled = true;
image.addEventListener(MouseEvent.DOUBLE_CLICK, double_click);
Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Technorati
  • Facebook
  • Google
  • LinkedIn

→ No CommentsTags:·

Flex Warning: Unable to bind to property ‘XXX’ on class ‘XXX’

February 4th, 2009 · No Comments · Flex

While working on a new project using Flex and Webservices, I got this annoying message when I’m trying to use dataprovider and custom ItemRenderer

warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher)
warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher)

This is happening because binding fails when using complex objects  , the compiler doesn’t know what kind of datatype that is being looped in the Repeater class and spits out a warning. Depending on what you are trying to do , sometimes it wont even spit out the data. The quick solution is to extend your class to Object and to make it bindable.

Here’s an example

package com.thedesilva
{
import mx.rpc.soap.types.*;
/**
* Wrapper class for a operation required type
*/
[Bindable]
public class Magazine extends Object
{
/**
* Constructor, initializes the type class
*/
public function Magazine() {}
 
public var id:String;
public var imagename:String;
public var name:String;
}
}
Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Technorati
  • Facebook
  • Google
  • LinkedIn

→ No CommentsTags: