0 Replies Latest reply on Feb 8, 2011 3:57 AM by Mohit Verma1234

    object handle 2.0 image resize problem ?

    Mohit Verma1234

      Hi guys

       

       

         I stuck in a problem in object handle 2.0 .

       

         i am using rogue object 2.0 . The problem is that when i resize the object handle x position and whwn x goes to negative then image just disaaperin object handle. here is the code :

       

        //         Note :objImgContainer inherits the canvas class

       

              objImgContainer = new ObjectContainer();
              objImgContainer.width     = 200;
              objImgContainer.height = 200;
              objImgContainer.ID = '_id'+ new Date().time;
              objImgContainer.TYPE = "image";
             
              setImageInContainer(objImgContainer, url);
              
                  
              whtBoard.currentObj.registerComponent( objImgContainer, objImgContainer, HandleDefinitions.NO_ROTATE_DEFINITION );
              whtBoard.currentObj.addEventListener( ObjectChangedEvent.OBJECT_RESIZED, imgResize );
              objImgContainer.addEventListener( KeyboardEvent.KEY_UP, whtBoard.deleteObject );
              objImgContainer.addEventListener( MouseEvent.MOUSE_DOWN, clickHandler );

       

       

      public function setImageInContainer(objImgContainer:ObjectContainer, url:String):void{
             
              var image:Image         = new Image();
              image.width                    = 200;
              image.height                = 200;
              image.percentHeight          = 100;
              image.percentWidth             = 100;
              image.maintainAspectRatio     = false;
              image.scaleContent             = true;
              image.setStyle( "horizontalAlign", "center" );
              image.setStyle( "verticalAlign", "middle" );
              image.source = url;
             
              objImgContainer.imageRef = image;
             
              var txtField:TextArea = new TextArea();
              txtField.width = objImgContainer.width;
              txtField.setStyle( "textAlign",     "center" );
              txtField.text = 'Loading..';
              txtField.selectable = false;
              txtField.editable = false;
              txtField.setStyle( "borderStyle",     "none" );
              txtField.setStyle( "fontWeight",     "bold" );
              txtField.setStyle( "fontSize",         "16" );
              txtField.setStyle( "fontWeight",     "bold" );
              txtField.setStyle( "backgroundAlpha", 0 );
              txtField.y = objImgContainer.height/2 - txtField.height;
             
              objImgContainer.addChild(txtField);
              objImgContainer.addChild(image);
             
              image.addEventListener( Event.COMPLETE, function ():void{ txtField.visible = false; } );
              image.addEventListener( ProgressEvent.PROGRESS,
                  function (evt:ProgressEvent):void{ txtField.text = "Loading " + Math.round(evt.bytesLoaded/evt.bytesTotal*100) + "%"; } );
              image.addEventListener( IOErrorEvent.IO_ERROR, function ():void{ txtField.visible = false; } );
          }

       

       

      I dont know what is happening wrong.

       

      Please help guys guidance needed

       

      Thanks and Regards

          Mohit