Skip to content

Instantly share code, notes, and snippets.

@lynndylanhurley
Created December 9, 2010 17:13
Show Gist options
  • Save lynndylanhurley/734993 to your computer and use it in GitHub Desktop.
Save lynndylanhurley/734993 to your computer and use it in GitHub Desktop.
// TODO: this code is too fragile. assets should be added to Patchifyer component at startup, and
// this command should only show or hide their visibility. consider breaking DisplayHelpCommand
// out into a macro with 'ShowHelpPageCommand', 'ShowHelpNav', 'ShowHelpHeader' as subcommands.
showAsset("helpBackgroundBlank",0,0,0);
showAsset("helpTextTitle",187,50);
showCloseButton();
showNavigation(canvas.index);
}
private function showAsset(image:String, offsetX:Number=0, offsetY:Number=0, setIndex:int=-1):void {
var img:Bitmap = proxy.helpBulkLoader.getBitmap( image );
var index:int = setIndex == -1 ? mediator.patchifyer.numChildren-1 : setIndex;
if (img.parent != mediator.patchifyer) {
img.alpha = 0;
img.x = Patchifyer.CANVAS_POINT.x + offsetX;
img.y = Patchifyer.CANVAS_POINT.y + offsetY;
}
mediator.patchifyer.addChildAt(img, index);
TweenLite.to(img, Patchifyer.TWEEN_DURATION, {alpha:1, overwrite:true});
}
private function showCloseButton():void {
if (proxy.helpCloseButton.parent != mediator.patchifyer) {
proxy.helpCloseButton.alpha = 0;
proxy.helpCloseButton.x = Patchifyer.CANVAS_POINT.x + 625;
proxy.helpCloseButton.y = Patchifyer.CANVAS_POINT.y + 8;
}
mediator.patchifyer.addChild(proxy.helpCloseButton);
TweenLite.to(proxy.helpCloseButton, Patchifyer.TWEEN_DURATION, {alpha:1, overwrite:true});
}
private function showNavigation(index:Number):void {
if (proxy.helpNav.parent != mediator.patchifyer) {
proxy.helpNav.alpha = 0;
proxy.helpNav.x = Patchifyer.CANVAS_POINT.x;
proxy.helpNav.y = Patchifyer.CANVAS_POINT.y;
}
mediator.patchifyer.addChild(proxy.helpNav);
if (index != 1) {
proxy.helpNav.setSelectedButton(index);
TweenLite.to(proxy.helpNav, Patchifyer.TWEEN_DURATION, {alpha:1, overwrite:true});
} else TweenLite.to(proxy.helpNav, Patchifyer.TWEEN_DURATION, {alpha:0, overwrite:true});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment