Friday, April 17, 2009

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 TextField, focus is changed to some other object than this TextField, you may want to reset the scroll position of TextField to starting characters in it.
You will use :
TextField.scrollH = 0;

This will set the horizontal scroll of TextField to 0 and hence showing the starting characters in TextField.

Loading image using Loader.loadBytes()

Loader class can load image from ByteArray. I used this method before a year ago to set a part of a screen for Screen Sharing application. Right now I was having a case where I need to create an image from Base64 encoded string. I am using following code to do this ::

var str:String = ""; //It won't be an empty string :) because it will a base64 encoded string of image.

var byteArr:ByteArray = Base64.converToByteArray(str); //Here you can use any ready made library to decode and convert the String into ByteArray. I used ready made library from here.

var loader:Loader = new Loader();

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);

loader.loadBytes(byteArr);

function onImageLoaded(e:Event):void{

addChild(loader);

trace(loader.width + " : " + loader.height);

}


That's it. This can be useful where you can not load the image from server because you don't have the image but it's data as string. May this can be useful to some one :)

Wednesday, April 8, 2009

Default ContextMenu 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 = new TextField();
txt.contextMenu = myContextMenu;
addChild(txt);

Now if you right click on TextField then you will see that you can see all the built in item. Any one knows why?

Saturday, March 28, 2009

After Looonnnng Time back to blog...

Hello Friends,
I am now back to my blog after long time...
Now onwards there will be more blogging :)

Thursday, January 8, 2009

What if Google stops working some how?

Very simple,

People will search on Yahoo! :) :)

Friday, July 4, 2008

Flash Player 10 - ASTRO Update Beta 2 available now

Flash Player 10 beta 2 was released on 7/2/2008 and includes new features and bug fixes.

New features on Flash Player 10 - ASTRO beta 2 ::

More details can be found on adobe labs flash player technology.

You can find the new version of flash player 10 beta on adobe labs download center.

Regards,

Naresh Khokhaneshiya

Google and Yahoo! can search Flash SWF content now!

This is really good news. :)

Here are links for more details ::
Regards,

Naresh Khokhaneshiya