Журат М. - aframework

of 47 /47
Автор: Журат М.И. (для внутреннего использования в ООО «Инним») AFramework

Author: innim

Post on 18-Jan-2017

109 views

Category:

Engineering


0 download

Embed Size (px)

TRANSCRIPT

AFramework

: ..( )AFramework

AFramework MVC(S) Flex : ~2009/2010 : 0.8

; (HTTP, Sockets); ;; (Tasks);/;; . :

; - ( ) ; ; ; ; .

?

; ; ; ; ; , .

UIComponent

public function set backgroundAlpha(value:Number):void{ _backgroundAlpha = value; redraw();}public function set backgroundColor(value:uint):void{ _backgroundColor = value; redraw();}private function redraw():void{ var g:Graphics = this.graphics; g.clear(); g.beginFill(_backgroundColor, _backgroundAlpha); g.drawRect(0, 0, width, height);}

var rect:Rect = new Rect();rect.backgroundColor = 0xFF0000;rect.backgroundAlpha = 0.7;rect.cornerRadius = 15;rect.width = 150;rect.height = 400;addChild(rect);

public function set backgroundColor(value:uint):void{ _backgroundColor = value; _graphicsInvalid = true;}

public function redraw():void{ if (_graphicsInvalid) { var g:Graphics = this.graphics; g.clear(); g.beginFill(_backgroundColor, _backgroundAlpha); g.drawRect(0, 0, width, height); }}

public function set backgroundColor(value:Number):void{ _backgroundColor = value; invalidateDisplayList();}

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var g:Graphics = this.graphics; g.clear(); g.beginFill(_backgroundColor, _backgroundAlpha); g.drawRect(0, 0, width, height);}

#createChildren();#commitProperties() - #invalidateProperties();#measure() - #invalidateSize();#updateDisplayList() - #invalidateDisplayList().UIComponent

#commitProperties() - #invalidateProperties();

UIComponent

override protected function commitProperties():void { if (_sourceInvalid) { if (_untrustedContent) { removeChild(_untrustedContent); _contentLoader .poolContent(_untrustedContent); _untrustedContent = null; } if (_sourceUrl && _sourceUrl.length > 0) _contentLoader.load(_sourceUrl, onContentLoadComplete); invalidateSize(); invalidateDisplayList(); _sourceInvalid = false; }}

#measure() - #invalidateSize();

UIComponent

UIComponent#width/height#minWidth/#minHeight#maxWidth/#maxHeight#explicitWidth/#explicitHeight#measuredWidth/#measuredHeight#setActualSize#contentWidth/#contentHeight

override protected function measure():void{ if (iconDisplay) { var iconWidth:int = iconDisplay.width; var iconHeight:int = iconDisplay.height; }

if (labelDisplay) { var labelWidth:int = labelDisplay.width; var labelHeight:int = labelDisplay.height; }

_measuredWidth = Math.max(_background.width, iconWidth + labelWidth); _measuredHeight = Math.max(_background.height, iconHeight, labelDisplay.height);}

#updateDisplayList() - #invalidateDisplayList();

UIComponent

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var g:Graphics = this.graphics; g.clear(); DrawUtil.drawCornerButton(g, background, 0, 0, unscaledWidth);

// var ty:Number = (unscaledHeight - icon.height) * .5; DrawUtil.drawSprite(g, list, CommonWindowAsset.COIN_ICON, HPADDING - 1, ty);

// _label.y = (unscaledHeight - _label.height) * .5 - .5; _label.x = HPADDING + icon.width + HGAP;}

#currentState - #onCurrentStateChanged();

UIComponent

Up state

Over state

Down state

Disabled state

Group

(Layouts)

3D

public class AHorizontalLayout extends ALayoutBase{ override protected function measure ():void { for (var i:int = 0;i< target.numChildren;++i) { var child:DisplayObject = target.getChildAt(i); measuredWidth+= child.width; measuredHeight = Math.max( measuredHeight, child.height); } }}

override protected function updateDisplayList(w:Number, h:Number):void{ var tx:Number = 0;

for (var i:int = 0;i