<?xml version="1.0" encoding="utf-8"?>
<s:Group 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="110" height="100%" creationComplete="init()" 
          xmlns:ui="com.afi.estimator.views.ui.*">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import mx.controls.Button;
            import mx.controls.Image;
            import com.greensock.TweenMax;
            import com.greensock.easing.*;
            
            
            private var btns:Array = new Array();
            
            public function show(show:Boolean=true):void
            {
                if(show) {
                    TweenMax.to( this, .5, {autoAlpha:1, ease:Strong.easeOut});
                } else {
                    TweenMax.to( this, .5, {autoAlpha:0, ease:Strong.easeOut});
                }
            }
            
            
            private function init():void
            {
                loadShareServices();
            }
            
            private function loadShareServices():void
            {
                var ul:URLLoader = new URLLoader();
                ul.addEventListener(Event.COMPLETE, parseLoader);
                ul.load(new URLRequest('com/afi/estimator/assets/xml/sharing-en.xml'));
            }
            
            private function parseLoader(e:Event):void
            {
                var x:XML = XML(e.target.data);
                for(var i:uint=0;i<x.service.length();i++) {
                    var btn:Object = new Object();
                    btn.label = String(x.service[i].name);
                    btn.icon = String(x.service[i].icon);
                    btn.link = String(x.service[i].link);
                    btns.push(btn);
                }
                rep.dataProvider = btns;
            }
        ]]>
    </fx:Script>
    <s:Rect width="100%" height="100%">
        <s:fill>
            <s:SolidColor color="0xF5F5F5" />
        </s:fill>
        <s:filters>
            <s:DropShadowFilter angle="90" color="0" alpha=".2" blurX="10" blurY="10" />
        </s:filters>
    </s:Rect>
    
    <mx:VBox paddingBottom="10" paddingRight="20" id="sharebar">
        <mx:Repeater id="rep" dataProvider="{btns}">
            <ui:SocialButton label="{rep.currentItem.label}" icon="{rep.currentItem.icon}" link="{rep.currentItem.link}" />
        </mx:Repeater>
    </mx:VBox>
    
</s:Group>