I have this code in my custom component that contains a slider and
when my slider is set to a scale of 1.75 (yes things are scaled very
large in my app) my custom components on the stage disappear? What I
mean by disappear is that my components scale as they should but when
it hits 1..75 scale everything in my component disappears except for
the any textfields.

I can't seem to find any issues. Not sure if this a bug or my code. 
Here is the code.

<?xml version="1.0" encoding="utf-8"?>

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; 
        click="stopProp(event)" 
        creationComplete="init()"
        horizontalAlign="center"
        width="35">

        <mx:Script>
                <![CDATA[
                        import 
com.spiceworks.networkmap.ui.components.SliderTrack;
                        import 
com.spiceworks.networkmap.ui.components.CSpSliderThumb;
                        import com.spiceworks.networkmap.ui.views.SubNode;
                        
                        private function init():void {
                                
                        }
                        
                        
                        public static const ZOOM_MIN:Number = 25;
                        public static const ZOOM_MAX:Number = 525;
                        public static const ZOOM_MIN_PERCENT:Number = .25;
                        public static const ZOOM_MAX_PERCENT:Number = 5.25;


                ]]>
        </mx:Script>

<!--    <mx:Label
                toolTip="Use this to zoom the map."
                text="Zoom"
                fontSize="9" 
                textAlign="center"
                click="stopProp(event)"
                />-->
        <mx:Style source="assets/styles/main.css"/>
        <mx:Canvas width="99%" verticalScrollPolicy="off" height="190"
horizontalScrollPolicy="off" top="3">
                <mx:Spacer height="1" />
                <mx:VSlider
                        styleName="{getStyle('sliderStyle')}"
                        height="95%"
                        id="bzoom"
                        values="[25]"
                        maxHeight="140"
                        minimum="{ZOOM_MIN}"
                        maximum="{ZOOM_MAX}"
                        tickInterval="25"
                        tickLength="0"
                        snapInterval="25"
                        liveDragging="true"
                        change="updateVScale(event)"
                        click="stopProp(event)"
                        mouseDown="stopProp(event)"
                        sliderThumbClass="{CSpSliderThumb}"
                        thumbCount="1"
                        showDataTip="true"      
                        left="4" 
                        top="25"/>
                <mx:Button
                        id="plusZoom"
                        alpha="0"
                        icon="{EmbeddedIcons.zoominIcon}"
                        cornerRadius="2"
                        width="16"
                        height="16"
                        left="9"
                        
click="handleZoomButtonClick(ZoomSlider.ZOOM_UP);stopProp(event);"
                        top="6"/>       
                <mx:Button
                        id="minusZoom"
                        alpha="0"
                        icon="{EmbeddedIcons.zoomoutIcon}"
                        cornerRadius="2"
                        width="16"
                        height="16"
                        left="9"
                        
click="handleZoomButtonClick(ZoomSlider.ZOOM_DOWN);stopProp(event);"
                        top="{bzoom.y + bzoom.height + 3}"/>
        </mx:Canvas>

        <mx:Script>
                <![CDATA[
                        import 
org.un.cava.birdeye.ravis.utils.events.VGraphEvent;
                        import 
org.un.cava.birdeye.ravis.graphLayout.visual.VisualGraph;
                        import 
org.un.cava.birdeye.ravis.assets.icons.EmbeddedIcons;
                        import flash.events.Event;
                        
                        private var _vgraph:VisualGraph;
                        
                        public static const ZOOM_UP:String = "zoomup";
                        public static const ZOOM_DOWN:String = "zoomdown";

                        /**
                         * Provides access to the registered vgraph object.
                         * */
                        public function set vgraph(v:VisualGraph):void {
                                _vgraph = v;
                                registerListeners();
                        }

                        public function stopProp(e:MouseEvent):void {
                                //e.stopImmediatePropagation();
                        }
                        /**
                         * @private
                         * */
                        public function get vgraph():VisualGraph {
                                return _vgraph;
                        }
                        
                        public function adjustDefaultZoom(value:Number = 0) : 
void
                        {
                                _vgraph.scale = bzoom.values[0]/100;
                                
                                
                        }
                        
                        [Inspectable]
                        public function handleZoomButtonClick(str:String):void{
                                if(str == null){return};
                                var upOrDown:String = str;
                                if( upOrDown == ZOOM_UP ){
                                        bzoom.value=bzoom.value+50;
                                        manuallyUpdateVScale();
                                }else if( upOrDown == ZOOM_DOWN ){
                                        bzoom.value=bzoom.value-50;
                                        manuallyUpdateVScale();
                                }else{
                                        throw Error("No string specified so 
zoom slider doesn't know to
move up or down");
                                }
                                
                        }
                        
                        public function manuallyUpdateVScale():void {
                                if(bzoom == null) {
                                        return;
                                }
                                
                                if(_vgraph == null) {
                                        trace("BirdEyeZoom NOT changed, no 
valid vgraph!");
                                        return;
                                }
                                
                                if( bzoom.value > bzoom.maximum ){
                                        bzoom.value = bzoom.maximum; 
                                        return;
                                }
                                
                                if( bzoom.value < bzoom.minimum ){
                                        bzoom.value = bzoom.minimum; 
                                        return;
                                }
                                _vgraph.scale = bzoom.value/100;
                        }
                        
                        /* update the scale of the VGraph, thus creating a 
BirdEye zoom
effect */               
                        public function updateVScale(event:Event):void {
                                if(bzoom == null) {
                                        
                                        return;
                                }
                                
                        /*      if( bzoom.value <= bzoom.minimum || bzoom.value 
>= bzoom.maximum ){
                                        if(bzoom.value <= bzoom.minimum){
                                                bzoom.value = bzoom.minimum;
                                                _vgraph.scale = bzoom.minimum;
                                        }else if(bzoom.value <= bzoom.maximum){
                                                bzoom.value = bzoom.maximum;
                                                _vgraph.scale = bzoom.maximum;
                                        }
                                        return;
                                } */
                                
                                if(_vgraph == null) {
                                        trace("BirdEyeZoom NOT changed, no 
valid vgraph!");
                                        return;
                                }

                                _vgraph.scale = event.target.values[0]/100;
                                
                        }
                        
                        /* refresh the slider from the scaleX value */
                        public function refreshVScale(e:VGraphEvent = 
null):void {
                                if(bzoom == null) {
                                        return;
                                }
                                if(_vgraph == null) {
                                        trace("BirdEyeZoom NOT refreshed, no 
valid vgraph!");
                                        return;
                                }
                                if(e.target.document is SubNode){
                                        return;
                                }
                                        bzoom.value = _vgraph.scale;
                        }
                        
                        /**
                         * register listeners
                         * */
                        private function registerListeners():void {
                                
_vgraph.addEventListener(VGraphEvent.VGRAPH_CHANGED,refreshVScale);
                        }
                ]]>
        </mx:Script>
</mx:VBox>


Reply via email to