It is an exciting news for linux Air developer that Adobe AIR for Linux has been released!
If you are tired of dull desktop and want to have relaxation in busing worktime, why not you try the following example? It is a Air desktop application with ActionScrip, A ladybird crawling chaos everywhere. If you have interesting, reference the following example you could built a cool Air desktop application by yourself.
Here download the application setup: Air App
Here download the source code: Source
Full code after the jump.
- import flash.display.Sprite;
- import flash.display.NativeWindow;
- import flash.display.NativeWindowDisplayState;
- import flash.events.NativeWindowDisplayStateEvent;
- stop();
- stage.scaleMode = StageScaleMode.NO_SCALE;
- var bo:Object=new Object();
- var o:Object=new Object();
- maximizeWindow(stage.nativeWindow);
- function maximizeWindow(nativeWin:NativeWindow):Boolean {
- if (nativeWin.displayState != NativeWindowDisplayState.MAXIMIZED) {
- var beforeState:String = nativeWin.displayState;
- var afterState:String = NativeWindowDisplayState.MAXIMIZED;
- var displayStateEvent:NativeWindowDisplayStateEvent =
- new NativeWindowDisplayStateEvent(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
- true,true,beforeState,afterState);
- nativeWin.dispatchEvent(displayStateEvent);
- if (!displayStateEvent.isDefaultPrevented()) {
- nativeWin.maximize();
- return true;
- } else {
- return false;
- }
- }
- return false;
- }
- function moveMc():void {
- bo.x=mc.x;
- bo.y=mc.y;
- o.x=Math.random()*stage.stageWidth-stage.stageWidth/4;
- o.y=Math.random()*stage.stageHeight-stage.stageHeight/4;
- mc.rotation=-Math.atan2(o.x-mc.x, o.y-mc.y)/(Math.PI/180)+180;
- //Math.atan(o.y-mc.y/o.x-mc.x)*180/Math.PI
- trace(mc.rotation);
- mc.addEventListener(Event.ENTER_FRAME,moveMe);
- }
- var minuteTimer:Timer = new Timer(1000,0);
- minuteTimer.addEventListener(TimerEvent.TIMER,onTick);
- minuteTimer.start();
- function onTick(event:TimerEvent):void {
- //trace("tick" + event.target.currentCount);
- moveMc();
- }
- function moveMe(event:Event):void {
- if(Math.abs(mc.x-o.x)<4&&Math.abs(mc.y-o.y)<4) {
- mc.x=o.x;
- mc.y=o.y;
- mc.removeEventListener(Event.ENTER_FRAME,moveMe);
- } else {
- mc.x+=(o.x-mc.x)/2;
- mc.y+=(o.y-mc.y)/2;
- }
- }
- mc.addEventListener(MouseEvent.MOUSE_OVER,mcEvent);
- mc.addEventListener(MouseEvent.MOUSE_OUT,mcEvent);
- function mcEvent(event:MouseEvent):void {
- switch(event.type) {
- case "mouseOver":
- minuteTimer.stop();
- moveMc();
- break;
- case "mouseOut":
- minuteTimer.start();
- break;
- }
- }

April 13th, 2008
Ntt.cc 








Posted in
Tags: 
RSS Feed
Email Feed
[...] reference the following example you could built a cool Air desktop application by yourself. read more | digg [...]
[...] 文章連結在此AIR程式下載Fla原始檔下載 [...]
[...] Create your interesting Air desktop application using ActionScript (2) [...]
[...] more @ http://ntt.cc/2008/04/13/create-your-interesting-air-desktop-application-using-actionscript.html [...]
Works great, really helped in a demo I was doing.