Sharp Mind

one more blog for people who like to work in flex

Best way to learn Flex

July 3, 2009 Posted by Kanu Wadhwa | Flex | | No Comments Yet

Blueprint – really cool plugin for Flex Builder

Blueprint is a plugin forĀ  Flex Builder3 and Flash Builder4 that allows users to query for Adobe Flex and Adobe Flash code examples found on the Web directly inside of the development environment.No need of switching between IDE and web browser.

June 24, 2009 Posted by Kanu Wadhwa | AIR, Flex | | No Comments Yet

Anonymous Feedback

Many times we see some of our colleagues not doing things the right way.
At that time we feel like giving some constructive feedback, but refrain ourselves from doing so fearing reactions.

I have developed a tool which allows you to give anonymous feedback to anyone. This will help the person, who is receiving feedback, know his growth areas without worrying about anything.

Feedback widget is available at - http://aolfeedback.blogspot.com/

Feel free to drop in your feedback either directly by adding comment or anonymously ;-)

June 11, 2009 Posted by Kanu Wadhwa | others | | No Comments Yet

Flex Tip of the Day #20: Reduce SWF Dimensions in HTML

Problem: Reduce dimensions of swf in HTML
Solution:

<div style="width:300px;height:250px;border:1px solid gray;float:left;overflow:hidden;">
	<object id='heatmap' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'
width='750'  height='550'>
		<param name='AllowScriptAccess' value='always'/>
		<param name='src' value='test.swf'/>
		<param name="quality" value="high" />
		<param name="menu" value="false" />
		<param name="scale" value="noborder">
		<param name="wmode" value="transparent">
		<param name="play" value="true">
		<param name="loop" value="true">
		<param name="flashvars" value="xmlData=test.xml"/>
		<embed
			play="true"
			loop="true"
			quality="high"
			scale="noborder"
			pluginspage="http://www.adobe.com/go/getflashplayer"
			src="test.swf"
			width="750"
			height="550"
			type="application/x-shockwave-flash"
			allowscriptaccess="always"
			wmode="transparent"
			flashvars="xmlData=test.xml" >
		</embed>
	</object>
</div>

Overflow property, which specifies what should happen when an element’s content is too big to fit in a specified area, can be used as an alternative.
Read more at: http://www.w3schools.com/htmldom/prop_style_overflow.asp

April 21, 2009 Posted by Kanu Wadhwa | Flash, HTML | | No Comments Yet

Flex Tip of the Day #19: ExternalInterface with HTML

Problem: ExternalInterface does not load at all in IE
Solution:

<object id='heatmap' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'
width='750' height='550'>
	<param name='AllowScriptAccess' value='always'/> 
	<param name='src' value='test.swf'/>
	<param name="quality" value="high" />
	<param name="menu" value="false" />
	<param name="scale" value="noborder">
	<param name="wmode" value="transparent">
	<param name="play" value="true">
	<param name="loop" value="true">
	<param name="flashvars"
	value="xmlData=test.xml"/>
	<embed
		play="true"
		loop="true"
		quality="high"
		scale="noborder"
		pluginspage="http://www.adobe.com/go/getflashplayer"
		src="test.swf"
		width="750"
		height="550"
		type="application/x-shockwave-flash"
		allowscriptaccess="always"  
		wmode="transparent"
		flashvars="xmlData=test.xml">
	</embed>
</object>

Using AllowScriptAccess to control outbound scripting from SWF.

AllowScriptAccess can have two possible values: “always” &“never”:

  • When AllowScriptAccess is “never”, outbound scripting will always fail.
  • When AllowScriptAccess is “always”, outbound scripting will always succeed.
  • If AllowScriptAccess is not specified by an HTML page, it defaults to “always”.

April 21, 2009 Posted by Kanu Wadhwa | ExternalInterface, Flash, Flex, HTML | | No Comments Yet

Flex Tip of the Day #18: Add swf in html

<embed
	play="true"
	loop="true"
	quality="high"
	scale="noborder"
	pluginspage="http://www.adobe.com/go/getflashplayer"
	src="test.swf"
	width="750"
	height="550"
	type="application/x-shockwave-flash"
	allowscriptaccess="always"
	wmode="transparent"
	flashvars="xmlData=test.xml">
</embed>

If you are adding only embed code in your html page for loading swf, then it won’t work for IE because IE takes the attribute values from param tag, and not the embed tag

<object id='heatmap' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'
width='650' height='650'>
	<param name='AllowScriptAccess' value='always'/>
	<param name='src' value='test.swf'/>
	<param name="quality" value="high" />
	<param name="menu" value="false" />
	<param name="scale" value="noborder">
	<param name="wmode" value="transparent">
	<param name="play" value="true">
	<param name="loop" value="true">
	<param name="flashvars"
	value="xmlData=test.xml"/>
	<embed
		play="true"
		loop="true"
		quality="high"
		scale="noborder"
		pluginspage="http://www.adobe.com/go/getflashplayer"
		src="test.swf"
		width="750"
		height="550"
		type="application/x-shockwave-flash"
		allowscriptaccess="always"
		wmode="transparent"
		flashvars="xmlData=test.xml">
	</embed>
</object>

April 21, 2009 Posted by Kanu Wadhwa | Actionscript, Flash, Flex, HTML | | No Comments Yet

What is the best way to find the minimum or maximum value in that Array?

arrayMinMax.as
var myArray:Array = [2,3,3,4,2,2,5,6,7,2];
myArray.sort(Array.NUMERIC);
var minValue:int = myArray[0];
var maxValue:int = myArray[myArray.length-1]
trace("Minimum value from Array is: "+minValue+" and Maximum value from Array is: "+maxValue)
//Output is: "Minimum value from Array is: 2 and Maximum value from Array is: 7"

April 15, 2009 Posted by Kanu Wadhwa | Actionscript, Flash, Flex | | No Comments Yet

Hiding Default Menu Items

Right click menu before adding code
menu1
Actionscript Code to add in an application
import flash.ui.ContextMenu;
var my_menu:ContextMenu = new ContextMenu();
my_menu.hideBuiltInItems();
contextMenu = my_menu;
Right click menu after adding code
menu2

Read more ways of removing it at:

http://blog.another-d-mention.ro/programming/right-click-and-custom-context-menu-in-flash-flex/

April 15, 2009 Posted by Kanu Wadhwa | Actionscript, Context Menu, Flash, Flex | | No Comments Yet

Flex Tip of the day #17: Style in CSS not in MXML

Store as much style as possible in CSS, not in MXML

Its much harder to store every style in CSS than in HTML such as height & width, x & y simply can not go in to Flex CSS. Degrafa can help you here.

You can even use CSS for effects:

roll-over-effect: ClassReference("com.mycompany.ModeButtonGlowIn");

April 12, 2009 Posted by Kanu Wadhwa | Flex Tips | | No Comments Yet

Flex Tip of the day #16: States in MXML

Don’t use states in your MXML

Try to avoid States in your application and use ViewStack instead. You can keep your design clean by creating custom components, and adding them as children of the ViewStack.

April 12, 2009 Posted by Kanu Wadhwa | Flex Tips, states | | No Comments Yet