views:

22

answers:

0

Description: I'm loading an image inside of a border container and when i zoom out, the scroll bars disappear as expected. Now when I resize the image to exceed the boundaries of the boarder container I receive the exception below. I believe the exception is thrown when the scroll bars are reactivating but i could be wrong. Has anyone seen this before?

Exception:

Error: Error #1502: A script has executed for longer than the default timeout period of   15 seconds.
at spark.components.supportClasses::ScrollBarBase/get viewport()
at spark.components::VScrollBar/updateMaximumAndPageSize()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\VScrollBar.as:123]
at spark.components::VScrollBar/http://www.adobe.com/2006/flex/mx/internal::viewportResizeHandler()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\VScrollBar.as:390]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:12266]
at mx.core::UIComponent/dispatchResizeEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9641]
at mx.core::UIComponent/setActualSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9172]
at spark.components::Group/setActualSize()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:891]
at mx.core::LayoutElementUIComponentUtils$/setLayoutBoundsSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\LayoutElementUIComponentUtils.as:497]
at mx.core::UIComponent/setLayoutBoundsSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:13069]
at spark.components.supportClasses::ScrollerLayout/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\ScrollerLayout.as:546]
at spark.components.supportClasses::GroupBase/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\GroupBase.as:1224]
at spark.components::Group/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:899]
at spark.skins::SparkSkin/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\skins\SparkSkin.as:191]
at mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8531]
at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:663]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:736]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()'

MXML:

 <fx:Declarations>
      <s:Resize id="resize" target="{img}"/>
      <s:Rotate id="rotate" target="{img}"/>
 </fx:Declarations>


 <fx:Script>
      <![CDATA[

           import flash.net.navigateToURL;

           import mx.controls.Alert;

           [Bindable]
           private var _imageURL:String = "images/earth-map_small.jpg";

           [Bindable]
           public var angle:Number = 0;

           [Bindable]
           private var borderHeight:Number;

           [Bindable]
           private var borderWidth:Number;

           private var effectDuration:Number = 250;
           private var defaultRotation:Number = 90;

           private var profits:Array;
           private var dragStart:Point;
           private var dragEnd:Point;
           private var zoomingEnabled:Boolean;

           public var originalHeight:Number;
           public var originalWidth:Number;

           public function init():void{
                originalHeight = img.height;
                originalWidth = img.width;
                borderHeight = borderContainer.height - 5;
                borderWidth = borderContainer.width - 5;
           }


           public function fitToWindow():void{
                resize.end();
                resize.duration = effectDuration;

                if(img.rotation == defaultRotation || img.rotation == -defaultRotation){     
                     resize.heightTo = borderWidth;
                     resize.widthTo = borderHeight;
                }
                else{
                     resize.heightTo = borderHeight;
                     resize.widthTo = borderWidth;
                }

                resize.play();
           }

           public function fitToWidth():void{
                resize.end();
                resize.duration = effectDuration;

                if(img.rotation == defaultRotation || img.rotation == -defaultRotation){
                     resize.heightTo = borderWidth;
                }
                else{
                     resize.widthTo = borderWidth;
                }

                resize.play();
           }

           public function fitToHeight():void{
                resize.end();
                resize.duration = effectDuration;

                if(img.rotation == defaultRotation || img.rotation == -defaultRotation){
                     resize.widthTo = borderHeight;
                }
                else{
                     resize.heightTo = borderHeight;
                }

                resize.play();
           }

           public function zoomIn():void{
                resize.end();
                resize.duration = effectDuration;
                resize.heightTo = img.height*2;
                resize.widthTo = img.width*2;
                resize.play();

           }

           public function zoomOut():void{
                resize.end();
                resize.duration = effectDuration;
                resize.heightTo = img.height/2;
                resize.widthTo = img.width/2;
                resize.play();
           }

           public function rotateRight():void{
                rotate.end();
                rotate.duration = effectDuration-200;
                rotate.angleFrom = angle;
                rotate.angleTo = (angle += defaultRotation);
                rotate.play();
           }

           public function rotateLeft():void{                    
                rotate.end();
                rotate.duration = effectDuration-200;
                rotate.angleFrom = angle;
                rotate.angleTo = (angle -= defaultRotation);
                rotate.play();
           }


           private function initRectangle(e:MouseEvent):void{

           }

           private function showShowRectangle(e:MouseEvent):void{

           }

           private function clearRectangle(e:MouseEvent):void{

           }


      ]]>
 </fx:Script>

 <s:Panel
      id="mainPanel"
      left="5" 
      right="5" 
      top="5" 
      bottom="5" 
      title="FileNet Flex Viewer" 
      fontWeight="bold">


      <mx:ApplicationControlBar dock="true" top="0" left="0" right="0">
           <s:Button 
                id="zoomInButton"
                toolTip="Zoom In"
                click="{zoomIn();}"
                />
           <s:Button 
                id="zoomOutButton"
                toolTip="Zoom Out"
                click="{zoomOut();}"
                />
           <s:Button 
                id="fitToWindowButton"
                toolTip="Fit To Window"
                click="{fitToWindow();}"
                />
           <s:Button 
                id="fitToWidthButton"
                toolTip="Fit To Width"
                click="{fitToWidth();}"
                />
           <s:Button 
                id="fitToHeightButton"
                toolTip="Fit To Height"
                click="{fitToHeight();}"
                />
           <s:Button 
                id="rotateRightButton"
                toolTip="Rotate Right"
                click="{rotateRight();}"
                />
           <s:Button 
                id="rotateLeftButton"
                toolTip="Rotate Left"
                click="{rotateLeft();}"
                />
           <!--<s:ToggleButton 
                id="rubberBandZoomButton"
                toolTip="Rubber Band Zoom"
                click="{}"
                />
           -->
      </mx:ApplicationControlBar>

      <s:BorderContainer 
           id="borderContainer"
           right="5" 
           left="5" 
           top="40" 
           bottom="5">

           <s:Scroller
                width="100%"
                height="100%">
                <s:Group>
                     <mx:Image 
                          id="img"
                          maintainAspectRatio="false"
                          maintainProjectionCenter="true"
                          source="@Embed('images/earth-map_small.jpg')"
                          verticalCenter="0"
                          horizontalCenter="0" 
                          horizontalAlign="center" 
                          verticalAlign="middle"/>
                </s:Group>
           </s:Scroller>
      </s:BorderContainer>
 </s:Panel>