views:

802

answers:

0

Please find the code below.When you run the example(attached file) and click on tools(top left)-> zoom in(click 2 times), you will see that the yellow color is scaled and goes beneath the blue color.

What I was expecting is the yellow color will get scroll bars and it will not cross the boundaries. I have tried for quite some time but could not make it to work the way I want.

<mx:Script>
    <![CDATA[
        import mx.controls.Spacer;
        import flash.display.Sprite;
        import mx.events.*;
        import org.MyContainer;


       private var one:Number=2;

       var sprite:Sprite=null;
       private  var m:Sprite=null;
       var secondRect:Rectangle =null;
       var num:Number = 0.1;     


       public  function loadl(){

         m= new Sprite();
         secondRect = new Rectangle(0,0,695,700);

       }

       public function menuShowInfo(event:MenuEvent){

         holder.scaleX =holder.scaleX +num;
         holder.scaleY =holder.scaleY + num;
       }




    ]]>
</mx:Script>


<mx:ApplicationControlBar width="100%"  fillAlphas="[1.0, 1.0]" fillColors="[#7D1414, #7D1414]">
  <mx:MenuBar id="myMenuBar" labelField="@label"  itemClick="menuShowInfo(event)">
    <mx:XMLList id="menuData">



        <menuitem label="Tools" >
            <menuitem label="Zoom in" />
             <menuitem label="Zoom out"/>

        </menuitem>


    </mx:XMLList>
</mx:MenuBar>
</mx:ApplicationControlBar>


<mx:HBox width="1000" height="700">

<mx:Canvas width="5%" height="100%" id="tools" backgroundColor="#6F0909">
</mx:Canvas>

<mx:Canvas width="70%" height="100%"  backgroundColor="#FAF9F9" id="wb">

  <mx:UIComponent  width="100%" height="100%"  id="holder"   >


   <mx:Script> 
            <![CDATA[
                    public function init():void {
                        sprite = new Sprite(); // replace "Sprite" (both places) with class you want to add 

                        // drawing a rectangle on the sprite to prove adding the sprite worked in this example
                        sprite.graphics. beginFill(0xfff000);
                        sprite.graphics. drawRect( 0,0,600,700) ;

                        holder.addChild( sprite); // add the sprite to any UIComponent
                    }
            ]]>
    </mx:Script>

   </mx:UIComponent>

</mx:Canvas>

<mx:Canvas width="25%" height="100%" id="vid" backgroundColor="#0A347B">
</mx:Canvas>



</mx:HBox>