Archive for the ‘AIR’ Category

Set TextField horizontal scroll to initial position

If you want to set the position of horizontal scroll position inside TextField, you can use TextField.scrollH.
Let’s say I am typing in the input TextField and I typed beyond the width of TextField. You will see the last characters visible you typed. Now due to some other event, say user clicks on other than this [...]

Continue reading »

Built-In Context Menu Items on Flash TextField

Is there any way to hide default context menu items on Flash TextField? Some one will try to answer with ContextMenu.hideBuiltInItems() function, but this function does not really work with Flash TextField. It does not hide the built in items.
So following code does work but not as expected ::
var myContextMenu:ContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
var txt:TextField = [...]

Continue reading »

Flash Player 10 Release Candidate

On August 11, 2008, Adobe released Flash Player 10 Release Candidate. This version has only one update from last Beta update and that is NSS, i.e. Flash Player 10 for Linux now supports Mozilla’s Network Security Services(NSS) for secure network connections.
You can find more information about this on adobe labs over Flash Player 10 release [...]

Continue reading »

Flash: TextField.htmlText and Automatic Line Breaks

Problem :: When you deal with TextField.htmlText don’t append any html strings directly to htmlText property of TextField. Because the TextField appends “<br>” tag automatically before it appends any html string to htmlText property, it will set your string automatically in next line instead of the current line. This mistake is done to save memory [...]

Continue reading »

Ans: ActionScript 3.0 Object class Quiz

And here is the answer to quiz ::
undefined                                   //as property ‘prop1′ is not defined in obj2 and we pointed obj1 to obj2
Khokhaneshiya                          //now we defined ‘prop1′ in obj1 and set value ‘Khokhaneshiya’
//also obj2.prop1 will be Khokhaneshiya… You can trace out
What you were thinking?

Continue reading »

ActionScript 3.0 Object class Quiz

Check following code ::
var obj1:Object = new Object();
obj1.prop1 = “Naresh”;
obj1.prop2 = “Khokhaneshiya”;
var obj2:Object = new Object();
obj2.prop2 = “Hello world”;
obj1 = obj2;
trace(obj1.prop1); //What will be output here
obj1.prop1 = “Khokhaneshiya”;
trace(obj1.prop1); //What will be output here
Be honest, Don’t trace it out using Flash.
You will have answer in following posts !

Continue reading »

AIR and Network Detection

We can detetct the network in AIR using following code ::
Need to use ‘ServiceMonitorShim’ complied clip from AIR components in your fla file.
import air.net.URLMonitor;
import flash.net.URLRequest;
import flash.events.StatusEvent;
var monitor:URLMonitor;
monitor = new URLMonitor(new URLRequest(‘http://192.168.0.57′));
monitor.addEventListener(StatusEvent.STATUS, announceStatus);
monitor.start();
function announceStatus(e:StatusEvent):void
{
         trace(“Status change. Current status: ” + monitor.available);
}

Continue reading »

AIR and its Application directory

A program does not have right to write or modify into Application directory of AIR application. We can read content of Application directory.
You can find some more tip and tricks here :: http://blogs.adobe.com/simplicity/2008/06/dont_write_to_app_dir.html
Cheers!

Continue reading »

Email Validation in ActionScript 3.0 using RegExp

You can use following function for validation of email using ActionScript 3.0 RegExp class.
/**
* @usage    Check if the given email address string is valid or not
* @param    email:String    Email address string that is to be checked
* @return    Boolean        Returns true if valid email, false otherwise
*/
public function isValidEmail(email:String):Boolean
{
var emailExpression:RegExp = /^[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$/i;
return emailExpression.test(email);
}
Hope it would be [...]

Continue reading »

AIR – Change the size of Stage at runtime dynamically

Yesterday I came across a fact that you can resize the stage size dynamically at runtime using actionscript code. But this is limited to AIR only (either Flash or Flex) but not supported in normal Flash.
Following is the code to change the width and height of the stage at anytime (runtime) using actionscript in AIR [...]

Continue reading »