Archive for the ‘Adobe’ Category

Flex HTML ToolTip Component

October 9, 2012 Leave a comment

To enhance the normal tool tip functionality to have html style break/ font weight for a portion of string:

You need to create a action class like this:
package com.philip
import mx.containers.*;
import mx.controls.Text;
import mx.controls.ToolTip;
import mx.core.*;

public class HTMLToolTip extends ToolTip
public function HTMLToolTip()
{    super(); }

override protected function commitProperties():void{
textField.htmlText = text;

to use this set this in your main component, call this function on creationComplete:

import com.*;
private function init():void{
ToolTipManager.toolTipClass = HTMLToolTip;
myBtn.toolTip = “<font color=’#ff00ff’ >this is <b>HTML</b>Tool<strong>Tip.</font>”



The original post has strong tag but that didn’t work for me in Flex 3.5 SDK <b> worked fine


Link to the original post 

Categories: ActionScript, Adobe, Flex

Add Hand Cursor to Flex Tab Navigator

August 25, 2011 5 comments

In Flex Tab Navigator, you can’t have Hand Cursor when you mouse over the tab’s, I had to do little hack to achieve this.

Created two functions and linked them with mouse over and mouse out events.

Say your Tab Navigator’s id is “myTabNav”:

Here are the functions which would do the trick:

private function setHandCursor(event:MouseEvent):void
var classInfo:XML = describeType(;
var cn:String = classInfo.@name.toString();
if(cn == “mx.controls.tabBarClasses::Tab”)
//this will bring the hand cursor

this.myTabNav.buttonMode = true;
this.myTabNav.useHandCursor = true;
private function removeHandCursor(event:MouseEvent):void
var classInfo:XML = describeType(;
var cn:String = classInfo.@name.toString();
if(cn == “mx.controls.tabBarClasses::Tab”)
// this will remove the hand cusror

this.myTabNav.buttonMode = false;
this.myTabNav.useHandCursor = false;


you need to do as above otherwise the hand cursor will either show on complete Tab Navigator

Categories: ActionScript, Adobe, Air, Flex

Read an Image from Local using Flex app

August 4, 2011 Leave a comment

I was working on one small requirement to read an image from local machine and see how it can display if you change size of canvas on fly. I found an article on this and changed the code a bit to make it work as I wanted it to work. you need to create a Flex project to run it in Flash Player 10 or above otherwise it won’t compile.

I have removed the save option in this code but you can change it back by changing visible property of the button.

Thanks to following article Load Or Modify and save local images with flash player 10

Here is the modified code:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”; layout=”vertical” backgroundGradientColors=”[0xFFFFFF,0xFFFFFF]” backgroundColor=”0xFFFFFF”>

import mx.binding.utils.BindingUtils;
import mx.core.UIComponent;

import flash.utils.ByteArray;
// From
private var loadFileRef:FileReference;

private static const FILE_TYPES:Array = [new FileFilter(“Image Files”, “*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG”)];
private var THUMB_WIDTH:uint = 240;
private var THUMB_HEIGHT:uint = 180;

private function loadFile():void {
imageView.visible = false;
loadFileRef = new FileReference();
loadFileRef.addEventListener(Event.SELECT, onFileSelect);

private function saveFile():void {
var bitmapData:BitmapData = new BitmapData(THUMB_WIDTH, THUMB_HEIGHT);

var encoder:JPEGEncoder = new JPEGEncoder();
var rawBytes:ByteArray = encoder.encode(bitmapData);

var saveFileRef:FileReference = new FileReference();;

private function onFileSelect(e:Event):void {
loadFileRef.addEventListener(Event.COMPLETE, onFileLoadComplete);

private function onFileLoadComplete(e:Event):void {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onDataLoadComplete);

loadFileRef = null;

private function onDataLoadComplete(e:Event):void {
var bitmapData:BitmapData = Bitmap(;
imageView.height = Number(heightTxt.text);
imageView.width = Number(widthTxt.text);
var matrix:Matrix = new Matrix();
matrix.scale(Number(widthTxt.text)/bitmapData.width, Number(heightTxt.text)/bitmapData.height);;, matrix, false);, 0, Number(widthTxt.text), Number(heightTxt.text));;
imageView.visible = true;
if (saveButton.visible) saveButton.enabled = true;

<mx:Panel title=”Read image” paddingBottom=”5″ paddingLeft=”5″ paddingRight=”5″ paddingTop=”5″>
<mx:HBox paddingTop=”5″ borderThickness=”1″>
<mx:Label text=”Height” width=”42″/><mx:Label text=”Width” width=”50″/>
<mx:HBox paddingTop=”5″ borderThickness=”1″>
<mx:TextInput id=”heightTxt” width=”40″ text=”180″ restrict=”0-9″ /><mx:TextInput id=”widthTxt” text=”240″ width=”40″ restrict=”0-9″ />
<mx:Button label=”Load image” click=”loadFile()”/>
<mx:Button label=”Save image” visible=”false” click=”saveFile()” id=”saveButton” enabled=”false”/>
<mx:Canvas id=”imageView” width=”240″ height=”180″ visible=”false” borderThickness=”1″ borderColor=”#CCCCCC” borderStyle=”solid”/>

Categories: ActionScript, Adobe, Flex

Flex- TitleWindow Close Button Hand Cursor

March 7, 2011 Leave a comment

I had requirement to bring the hand pointer on title window (Flex) close button when I am using an image to show the close button and here is the code (function) you need to write and call it on creationComplete Event.

private function init():void

mx_internal::closeButton.buttonMode = true;

Categories: ActionScript, Adobe, Flex

Flash Builder4 – Helpful links

August 21, 2010 Leave a comment

Flash Builder 4 – Helpful Links (Good articles)

Installing subversion plug-in (Link)

Difference between Flex 3 and Flex 4 By Joan Lafferty (Link)

Whats new in Flex 4 By Deepa Subramaniam (Link)

Whats new in Flash Builder 4 by Andrew Shorten (Link)

Categories: Adobe, Flex

Web multimedia: 6 reasons why Flash isn’t going away

August 19, 2010 Leave a comment

I was reading an article on Computer world and I was very impressed with the content and wanted to share this in here: Its a 4 page article

Article 6 reasons Flash / HTML5 on Computer World

Here are few points I liked most in the post:

Page 1:

“Quite frankly, Flash is a great animation tool, and it’s used for a lot of interactivity. Those kind of interactive elements are difficult to do in HTML 5,” Barberich says.

Page 2:

Although YouTube (which is owned by Google) is experimenting with HTML 5, content protection is one of the reasons why the site still needs Flash, said John Harding, a software engineer for YouTube

Page 3:

Perhaps the most widely reported of these efforts is the open-source Smokescreen project. Developed by RevShock, a mobile ad start-up, Smokescreen shows promise in its initial form, but its performance doesn’t match what users get with Flash content that runs natively. “Smokescreen exemplifies the immaturity of HTML 5,” says Rubin.

Page 4:

Largely lost in all the HTML 5 vs. Flash rhetoric is the possibility that the two technologies might simply work side by side. “I’m never really sure why HTML 5 and Flash can’t co-exist,” says Cote, “why it’s a zero-sum game.”

Rubin of NPD predicts that “within the next few years, we will likely see sites support both technologies. They will be able to achieve much of what they’ve traditionally done with Flash with HTML 5, but there’s no doubt that Flash will also continue to evolve and offer incentives to maintain its developer support.”

It is worth reading the article if you are in web development.

Categories: Adobe, Apple/ MAC, HTML5, iPhone

Extending CFC – DAO

August 17, 2010 2 comments

I came across very strange behaviour of extending CFC to another CFC for my DTO’s, which I was using to send data back to my Flex application using AMF.

My Main parent CFC had 3 properties.
I created new CFC and extended to the above CFC and added 3 more properties.
It works fine with in ColdFusion, but when I used it to return to my Flex application with type binding to my ActionScript DTO.
This wasn’t sending the parents properties to my Flex application.
To fix this I had to add all properties in my extended CFC (Child one).

Has any one come across the similar scenario?