<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" width="600" height="450" viewSourceURL="srcview/index.html">
    <mx:Style>
        Application {
            color: #ffffff;
        }
    </mx:Style>
    <mx:Script>
        <![CDATA[
            import com.derschmale.hdr.HDRContainer;
            
            private var _hdr : HDRContainer;
            
            private function init() : void
            {
                // source img needs to be child of HDRContainer, so remove it (was added for convenience - hey, it's demo-style coding! ;) )
                removeChild(sourceImg);
                // create the container and add it to the stage, sourceImg will be added as a child of _hdr
                _hdr = new HDRContainer(sourceImg, 0.17, 0.67, 19, 3, 1);
                container.addChild(_hdr);
                
                // update the hdr filter
                _hdr.render();
            }
            
            private function updateThreshold() : void
            {
                _hdr.brightnessThreshold = thresholdSlider.value;
                _hdr.render();
            }
            
            private function updateExposure() : void
            {
                _hdr.exposure = exposureSlider.value;
                _hdr.render();
            }
            
            private function updateBlur() : void
            {
                _hdr.blur = blurSlider.value;
                _hdr.render();
            }
        ]]>
    </mx:Script>
    <mx:UIComponent id="container" />
    <mx:Image source="@Embed(source='../assets/13880Blue_Sky.jpg')" id="sourceImg" />
    <mx:Label text="Threshold:" y="370" />
    <mx:Label text="Exposure:" y="390" />
    <mx:Label text="Blur:" y="410" />
    <mx:HSlider width="100" x="100" y="370" id="thresholdSlider" minimum="0.0" maximum="1.0" value="0.17" change="updateThreshold()" liveDragging="true" />
    <mx:HSlider width="100" x="100" y="390" id="exposureSlider" minimum="0.0" maximum="5.0" value="0.67" change="updateExposure()" liveDragging="true" />
    <mx:HSlider width="100" x="100" y="410" id="blurSlider" minimum="0.0" maximum="30.0" value="19" change="updateBlur()" liveDragging="true" />
</mx:Application>