Archive for July, 2011

[AS3] How to create one line editable TextFlow of Text Layout Framework

Monday, July 25th, 2011

I want to create one line editable TextFlow, not multiple line, with Text Layout Framework(TLF).

First, you need to create a subclass of EditManager.
This class can change the behavior when keyboard is pressed.

package
{
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	
	import flashx.textLayout.edit.EditManager;
	import flashx.undo.IUndoManager;
	
	public class CustomEditManagner extends EditManager
	{
		public function CustomEditManagner(undoManager:IUndoManager=null)
		{
			super(undoManager);
		}
		
		override public function keyDownHandler(event:KeyboardEvent):void
		{
			if(event.keyCode != Keyboard.ENTER){
				super.keyDownHandler(event);
			}		
		}
	}
}

Second, you create the TextFlow, and assign above custom class to its interactionManager.

package
{
	import flash.display.Sprite;
	import flashx.textLayout.formats.LineBreak;
	
	import flashx.textLayout.container.ContainerController;
	import flashx.textLayout.conversion.TextConverter;
	import flashx.textLayout.edit.EditManager;
	import flashx.textLayout.elements.TextFlow;
	
	[SWF(width="450", height="450", frameRate="30")]
	public class OneLineEditableTLF extends Sprite
	{
		public function OneLineEditableTLF()
		{
			createTextLine();
		}
		
		private function createTextLine():void
		{
			var sp:Sprite = new Sprite();
			addChild(sp);
			sp.x = 100;
			sp.y = 50;
			
			var markup:XML = 

Hello, World

; var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); var containerController:ContainerController = new ContainerController(sp, 200, 16); textFlow.flowComposer.addController(containerController); var editManager:EditManager = new CustomEditManagner(); textFlow.interactionManager = editManager; textFlow.fontSize = 16; textFlow.lineBreak = LineBreak.EXPLICIT; textFlow.flowComposer.updateAllControllers(); } } }

[Dialy] New MacBook Air is the best laptop

Saturday, July 23rd, 2011

I bought a new MacBook Air 13-inch.

I bought the new laptop, though I have already had a MacBook Pro 15-inch.
Because I want to have a smaller and cooler laptop than MacBook Pro.

Of course, MacBook Pro is good machine.
But its palm rest is very hot while I am typing.
And, it is a bit large when I use it on the train.
I have to use laptop on the train to attend a meeting in Tokyo.
It takes about 2 hours, because I live in a suburb of Tokyo.

MacBook Air’s palm rest is very cool.
And its size fits my working style well.

That’s why I bought MacBook Air.

I love it so much!

[C] C beginning in terminal

Saturday, July 16th, 2011

Make a text file that is named “hello.c “.

The contents is this.

#include 

main(){
  printf("Hello world !\n");
}

Then, launch terminal and type command

gcc hello.c -o hello

If you execute hello

./hello

Output is this.

Hello world !

If you do these process in terminal, it is simpler environment than XCode.

[iOS] Think Tactic and Animate

Wednesday, July 13th, 2011

An iPad app that I took in charge of the program has been released.

>> Here is iTunes preview

Below movie is sample of animation. It animates with 2D or 3D.

>> Here is support page.

What is this app?

It tries to do that you think sport’s tactic with pieces on a board.

If you want to grab the image, you watch the sample movie.
The tactic which you made, can take out from iPad.
And you can exchange the tactic with friends.

Please check a website.

[Android] How to access to external sd card in Galaxy Tab from browser

Tuesday, July 12th, 2011

Input browser this path.

file:///sdcard/external_sd/

And you need add the content path.
For example, if there is your sd card’s content on root.

file:///sdcard/external_sd/index.html

If there is a folder,

file:///sdcard/external_sd/myfolder/index.html