Adobe Air & Adobe Flex & ActionScript & Mobile Dev & HTML5 & RIA & User Experience
桌面背景布局
DesktopBackgroundLayout
重點是在
flash.display.Graphics
beginBitmapFill(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void
在matrix和repeat的應用上。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | //... backgroundUI.graphics.clear(); if(layoutManagerStr == "stretch") { bitmap = new BitmapData(loader.width, loader.height); bitmap.draw(loader); matrix.scale((backgroundUI.width / loader.width) , (backgroundUI.height / loader.height)); backgroundUI.graphics.beginBitmapFill(bitmap, matrix, false, true); backgroundUI.graphics.drawRect(0, 0, backgroundUI.width, backgroundUI.height); } else if(layoutManagerStr == "tile") { bitmap = new BitmapData(loader.width,loader.height); bitmap.draw(loader); backgroundUI.graphics.beginBitmapFill(bitmap, null, true, true); backgroundUI.graphics.drawRect(0, 0, backgroundUI.width, backgroundUI.height); } else if(layoutManagerStr == "center") { bitmap = new BitmapData(unitW, unitH); bitmap.draw(loader); var centerX:Number = backgroundUI.width / 2 - loader.width / 2; var centerY:Number = backgroundUI.height / 2 - loader.height / 2; matrix.tx = centerX; matrix.ty = centerY; backgroundUI.graphics.beginBitmapFill(bitmap, matrix, false, true); backgroundUI.graphics.drawRect(centerX, centerY, loader.width, loader.height); } backgroundUI.graphics.endFill(); //... |
Related posts:
Leave a reply
Pingbacks & Trackbacks
點陣圖慢速平滑移動技巧 : : 9RIA.Com 天地会博客聚合
五月 20th, 2011 at 10:24 上午