15.10.2012 Views

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ACTIONSCRIPT 3.0 ENTWICKLERHANDBUCH<br />

Arbeiten mit nativen AIR-Fenstern<br />

package<br />

{<br />

import flash.display.Sprite;<br />

import flash.events.MouseEvent;<br />

import flash.display.NativeWindowResize;<br />

}<br />

public class NativeWindowResizeExample extends Sprite<br />

{<br />

public function NativeWindowResizeExample():void<br />

{<br />

// Fills a background area.<br />

this.graphics.beginFill(0xFFFFFF);<br />

this.graphics.drawRect(0, 0, 400, 300);<br />

this.graphics.endFill();<br />

}<br />

}<br />

// Creates a square area where a mouse down will start the resize.<br />

var resizeHandle:Sprite =<br />

createSprite(0xCCCCCC, 20, this.width - 20, this.height - 20);<br />

resizeHandle.addEventListener(MouseEvent.MOUSE_DOWN, onStartResize);<br />

// Creates a square area where a mouse down will start the move.<br />

var moveHandle:Sprite = createSprite(0xCCCCCC, 20, this.width - 20, 0);<br />

moveHandle.addEventListener(MouseEvent.MOUSE_DOWN, onStartMove);<br />

public function createSprite(color:int, size:int, x:int, y:int):Sprite<br />

{<br />

var s:Sprite = new Sprite();<br />

s.graphics.beginFill(color);<br />

s.graphics.drawRect(0, 0, size, size);<br />

s.graphics.endFill();<br />

s.x = x;<br />

s.y = y;<br />

this.addChild(s);<br />

return s;<br />

}<br />

public function onStartResize(event:MouseEvent):void<br />

{<br />

this.stage.nativeWindow.startResize(NativeWindowResize.BOTTOM_RIGHT);<br />

}<br />

public function onStartMove(event:MouseEvent):void<br />

{<br />

this.stage.nativeWindow.startMove();<br />

}<br />

Letzte Aktualisierung 27.6.2012<br />

971

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!