Created
December 23, 2010 14:40
-
-
Save odoe/753061 to your computer and use it in GitHub Desktop.
TitleWindow that holds MagnifyWindow.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.lacsd.sf.view.components { | |
import spark.components.TitleWindow; | |
import spark.events.TitleWindowBoundsEvent; | |
public class MagnifyPopUpWindow extends TitleWindow { | |
public function MagnifyPopUpWindow() { | |
super(); | |
this.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVING, onWindowMove_handler, false, 0, true); | |
this.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVE_END, onWindowMove_handler, false, 0, true); | |
} | |
protected var magnifyWindow:MagnifyWindow; | |
private function centerMagnifyWindow():void { | |
var stageCenterX:Number = this.x + (this.width/2); | |
var stageCenterY:Number = this.y + (this.height/2); | |
magnifyWindow.parentContainerCenterPosition(stageCenterX, stageCenterY); | |
} | |
private function onWindowMove_handler(event:TitleWindowBoundsEvent):void { | |
if (!magnifyWindow) { | |
logger.debug("set magnify window to temporary value"); | |
var i:int = this.numElements; | |
var j:int = 0; | |
for (j = 0; j < i; j++) { | |
if (this.getElementAt(j) is MagnifyWindow) { | |
magnifyWindow = MagnifyWindow(this.getElementAt(j)); | |
break; | |
} | |
} | |
} | |
centerMagnifyWindow(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment