Friday, March 1, 2013

Apache Flex got it's own website

Apache Flex got it's own website: http://flex.apache.org/

[May be a late news but it's better late then never.]

We can track all Flex related updates like what's going on into the Flex development by the community, new Flex SDK releases etc through this website.

Tuesday, December 13, 2011

Adobe Flex is now Apache Flex

As all of us know that Adobe is donating Flex SDK to Apache Foundation and Spoon project. Adobe says it still contributes to Flex SDK but it also want all of us who work on & use Flex to start contribute to the Flex SDK now.

Click here for the Spoon project.

Adobe is presently (at time of writing this post) conducting an flexsummit with some key partners to discuss the future of flex and explain their commitment(!!!!!) to flex technology and how they want to take Flex forward with help of community. Spoon Project is posting some live comments on the ongoing flexsummit here.

follow @SpoonProject, @iamdeepa on twitter for further latest updates.

Friday, August 5, 2011

Know File System using Flex/AIR in a Win Machnie

Below is a small code snippet to know File System info in a Windows Machine using Flex/AIR.

var ta1:TextArea = new TextArea();

protected function getFS(event:MouseEvent):void
{
try
{
ta1.text = '';
var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();

var commands:Vector. = new Vector.();
commands[0] = "fsinfo";
commands[1] = "statistics";
commands[2] = "c:";

processInfo.arguments = commands;
processInfo.executable = new File('C:/WINDOWS/system32/fsutil.exe');

process = new NativeProcess();

process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutPutProgress, false, 0, true);

process.addEventListener(NativeProcessExitEvent.EXIT, handleExit2);
process.start(processInfo);
}
catch(e:Error)
{
Alert.show(e.message,"Error");
}
}

protected function handleExit2(event:NativeProcessExitEvent):void
{
if(event.exitCode == 0)
{
var str:String = ta1.text;
str = str.split('\n')[0];
str = StringUtils.removeExtraWhitespace(str);
str = str.substr(str.lastIndexOf(' '), str.length);
Alert.show('File System of C drive: ' + str);
}
else
{
Alert.show('Unable to get File System details');
}
}


protected function onOutPutProgress(event:ProgressEvent):void
{
ta1.text += process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable);
}


fsutil (C:/WINDOWS/system32/fsutil.exe) is a utitlity/exe which gives a lot of info on file system in a windows machine. I used this only to extract some file system info but you can know more about 'fsutil' from here and explore more options yourself.

This code snippet uses some Flex AIR API's like NativeProcessStartupInfo and this code can be tested only after generating an executable (exe).

Friday, September 17, 2010

LabelTextInput in Flex 3

Looking for a Flex 3 component which acts like a TextInput and Label. The following component achieves the purpose. This component will act like a Label by default. But 'on mouse over' it will turn into a TextInput where we can enter text and 'on mover out' it will be again changed to Label.

LabelTextInput.as

package
{
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.MouseEvent;

import mx.controls.TextInput;

public class LabelTextInput extends TextInput
{
public function LabelTextInput()
{
super();
addEventListener(MouseEvent.MOUSE_OVER,onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT,onMouseOut);
addEventListener(Event.CHANGE,onChange);
addEventListener( FocusEvent.FOCUS_IN, onFocusIn );
addEventListener( FocusEvent.FOCUS_OUT, onFocusOut );

this.setStyle("borderStyle","none");
this.setStyle("backgroundAlpha",0);
}

private var _promptText:String = '';
private var _previousText:String;

public function set promptText(value:String):void
{
_promptText = value;
super.text = value;
this.setStyle("fontStyle","italic");
}

public function get promptText():String
{
return _promptText;
}

override public function set text(value:String):void
{
if(value != '')
{
this.setStyle("fontStyle","normal");
super.text = value;
}
else
{
this.setStyle("fontStyle","italic");
super.text = _promptText;
}
}

override public function get text():String
{
if(super.text == _promptText)
return "";
else
return super.text;
}

private function onMouseOver(event:MouseEvent):void
{
this.setStyle("borderStyle","outset");
if(super.text == '')
{
promptText = _promptText;
}
}

private function onMouseOut(event:MouseEvent):void
{
this.setStyle("borderStyle","none");
}

private function onChange(event:Event):void
{
if(super.text == _promptText)
{
this.setStyle("fontStyle","italic");
}
else
{
this.setStyle("fontStyle","normal");
this.setFocus();
}
}

private function onFocusIn(event:FocusEvent):void
{
if(super.text == _promptText)
{
this.setSelection(0,textField.text.length);
this.setFocus();
}
}

private function onFocusOut(event:FocusEvent):void
{
this.setStyle("borderStyle","none");
}
}
}

Feel free to leave your comments.

Sunday, August 15, 2010