<?xml version="1.0" encoding="utf-8"?>
<s:Button xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx"
          width="100%"
          height="25"
          y="-25"
          implements="ptaylor.bdd.errors.ISystemErrorUI, ptaylor.bdd.screens.IScreen"
          click="hideAnimation.play(); errorAcknowledged.dispatch();">
    <fx:Script>
        <![CDATA[
            import org.osflash.signals.ISignal;
            import org.osflash.signals.Signal;
            
            import ptaylor.bdd.errors.ISystemErrorUI;
            import ptaylor.bdd.errors.events.SystemErrorEvent;
            import ptaylor.bdd.screens.events.ScreenChangedSignal;
            
            public function handleError(error:SystemErrorEvent):void
            {
                label = error.title + ' ' + error.message;
                
                if(y <= -25)
                {
                    showAnimation.play();
                }
            }
            
            private const ack:ISignal = new Signal();
            
            public function get errorAcknowledged():ISignal
            {
                return ack;
            }
            
            public function set selectedScreen(screen:IScreen):void
            {
                if(y <= -25)
                    return;
                
                hideAnimation.play();
                errorAcknowledged.dispatch();
            }
            
            private const signal:ScreenChangedSignal = new ScreenChangedSignal();
            
            public function get screenChangedSignal():ScreenChangedSignal
            {
                return signal;
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:Move id="showAnimation"
                target="{this}"
                yTo="0"/>
        <s:Move id="hideAnimation"
                target="{this}"
                yTo="{-height}"/>
    </fx:Declarations>
</s:Button>