How to resize a StageWebView

Hello,
I'm searching for some assistance with StageWebView on
Android. The code used to load the page is
below.
The code works everytime on my Android device and on
the desktop emulator.
I want to resize a View where is the StageWebView control, but however the StageOrientationEvent is passed correctly, strangely viewport width and viewport height aren't never changed :
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.StageOrientationEvent;
import flash.geom.Rectangle;
import flash.media.StageWebView;
import spark.components.View;
public class AfficherSimpleStageWebView extends Sprite
     private var _webView:StageWebView;
     private var strMyURL:String;
     protected var myView:View;
     public function DisplaySimpleStageWebView(view:View)
          myView = new View();
          myView = view;
          strMyURL = myURL;
          this.addEventListener(Event.ADDED_TO_STAGE,init);
          this.addEventListener(Event.REMOVED,close);
     private function init(e:Event):void
          _webView = new StageWebView();
          stage.align = StageAlign.TOP_LEFT;
          stage.scaleMode = StageScaleMode.NO_SCALE;
          stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChange);
          _webView.stage = this.parent.stage;
          _webView.loadURL("web.page.url");
          onOrientationChange();
     protected function onOrientationChange(event:StageOrientationEvent=null):void
          if(event!=null && (event.afterOrientation == "rotatedLeft" || event.afterOrientation == "rotatedRight")){ // "portrait" mode
               var horizontalBounds:int = (myView.height*0.83);
               _webView.viewPort.width = horizontalBounds;
               _webView.viewPort.height = myView.width-30;
          else{ // "landscape" mode
               var verticalBounds:int = (myView.height*0.83);
               _webView.viewPort.width = myView.width-30;
               _webView.viewPort.height = verticalBounds;
          if(textAreaDebug!=null)
               textAreaDebug.appendText(" AffichaerSimpleStageView -> onAdapterTailleSSWV : _webView.viewPort.width ="+(Number(stage.width)-15)+" - _webView.viewPort.height ="+verticalBounds);
How I reference the class :
protected var mySSWV:DisplaySimpleStageWebView;
How I use the object in the "initialize" event :
mySSWV = new AfficherSimpleStageWebView(this);
Did I forget anything important in this code ?

I've understood the source of my problem, it can be useful for somebody :
I wanted to use StageOrientationEvent ! But it works really good by using the event Resize. I linked this one to myView, the MXML View object which have a mapping in the class. On init() I added that :
myView.addEventListener(Event.RESIZE,onStageResized);
Also I had to modify the size of Rectangle, the primitive object. After have detect that I add this one and it works good... I used that :
protected function onStageResized(event:Event):void
    _webView.viewPort = null;
    var verticalBounds:int = myView.height;
    _webView.viewPort = new Rectangle(0, 30 , View.width, verticalBounds);
Simply but useful ;-)

Similar Messages

  • I can't figure out how to resize my picture for my home or lock screens.

    I can't figure out how to resize my picture for my home or lock screens. It shouldn't be his difficult. Any suggestions? I'm running the latest software. Thanks.

    whichever app store you are connecting to, hyou need a credit card with an address in that country. Also, itunes gift cards must be in local currency too.
    If you are in japan, you need to use the japan app store

  • How to resize a jpg/gif file to a fix size using jimi ?

    I have search from the web and didn't find any example on doing this.
    Can any one give example on how to resize a jpg image. let say 120x240
    to a fixed size 40x40 ?
    thank you

    Hi.
    When you got that image in form of a file, just load it and invoke the image's getScaledInstance(...)-method.
    Here's how it could work:
    import java.awt.*;
    public class Test {
    public static void main(String[] argv) {
      // define where the image comes from:
      URL toImage = new URL("file:/C:/test.jpg");  // or the like
      // get the image:
      Image image = Toolkit.getDefaultToolkit().createImage(toImage);
      // scale the image to target size (40x40 here):
      Image smallImage = image.getScaledInstance(40, 40, Image.SCALE_DEFAULT);
      // you might want to do other things like displaying it afterwards
    }HTH & cheers,
    kelysar

  • How to resize a table in Pages 5?

    How to resize a table in Pages 5? It can be resized vertically but not horizontally.

    stuart13 wrote:
    How to resize a table in Pages 5? It can be resized vertically but not horizontally.
    The controls are in the Format panel, Arrange Tab.
    Jerry

  • How to resize a photo from CameraUI?

    Hi there,
    i really need som help here. I cant seem understand how to resize an still image taken with the camera. Here are the code so far(also with the upload part). I just need a thumbnail to be uploaded to the server, not the HQ-image. Any ideas?
              Simple AIR for iOS Package for selecting a cameraroll photo or taking a photo and processing it.
              Copyright 2012 FIZIX Digital Agency
              http://www.fizixstudios.com
              For more information see the tutorial at:
              http://www.fizixstudios.com/labs/do/view/id/air-ios-camera-and-uploading-photos
              Notes:
              This is a barebones script and is as generic as possible. The upload process is very basic,
              the tutorial linked above gives information on how to post the image along with data to
              your PHP script.
              The PHP script will collect as $_FILES['Filedata'];
              import flash.display.MovieClip;
              import flash.events.MouseEvent;
              import flash.events.TouchEvent;
              import flash.ui.Multitouch;
        import flash.ui.MultitouchInputMode;
              import flash.media.Camera;
              import flash.media.CameraUI;
              import flash.media.CameraRoll;
              import flash.media.MediaPromise;
        import flash.media.MediaType;
              import flash.events.MediaEvent;
              import flash.events.Event;
              import flash.events.ErrorEvent;
              import flash.utils.IDataInput;
              import flash.events.IEventDispatcher;
              import flash.events.IOErrorEvent;
              import flash.utils.ByteArray;
              import flash.filesystem.File;
              import flash.filesystem.FileMode;
              import flash.filesystem.FileStream;
              import flash.errors.EOFError;
              import flash.net.URLRequest;
              import flash.net.URLVariables;
              import flash.net.URLRequestMethod;
                        // Define properties
                        var cameraRoll:CameraRoll = new CameraRoll();                                        // For Camera Roll
                        var cameraUI:CameraUI = new CameraUI();                                                            // For Taking a Photo
                        var dataSource:IDataInput;                                                                                          // Data Source
                        var tempDir;                                                                                                                        // Our temporary directory
                        CameraTest() ;
                        function CameraTest()
                                  Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
                                  // Start the home screen
                                  startHomeScreen();
                        // =================================================================================
                        // startHomeScreen
                        // =================================================================================
                        function startHomeScreen()
                                  trace("Main Screen Initialized");
                                  // Add main screen event listeners
                                  if(Multitouch.supportsGestureEvents)
                                            mainScreen.startCamera.addEventListener(TouchEvent.TOUCH_TAP, initCamera);
                                            mainScreen.startCameraRoll.addEventListener(TouchEvent.TOUCH_TAP, initCameraRoll);
                                  else
                                            mainScreen.startCamera.addEventListener(MouseEvent.CLICK, initCamera);
                                            mainScreen.startCameraRoll.addEventListener(MouseEvent.CLICK, initCameraRoll);
                        // =================================================================================
                        // initCamera
                        // =================================================================================
                        function initCamera(evt:Event):void
                                  trace("Starting Camera");
                                  if( CameraUI.isSupported )
                                            cameraUI.addEventListener(MediaEvent.COMPLETE, imageSelected);
                                            cameraUI.addEventListener(Event.CANCEL, browseCancelled);
                                            cameraUI.addEventListener(ErrorEvent.ERROR, mediaError);
                                            cameraUI.launch(MediaType.IMAGE);
                                  else
                                            mainScreen.feedbackText.text = "This device does not support Camera functions.";
                        // =================================================================================
                        // initCameraRoll
                        // =================================================================================
                        function initCameraRoll(evt:Event):void
                                  trace("Opening Camera Roll");
                                  if(CameraRoll.supportsBrowseForImage)
                                            mainScreen.feedbackText.text = "Opening Camera Roll.";
                                            // Add event listeners for camera roll events
                                            cameraRoll.addEventListener(MediaEvent.SELECT, imageSelected);
                                            cameraRoll.addEventListener(Event.CANCEL, browseCancelled);
                                            cameraRoll.addEventListener(ErrorEvent.ERROR, mediaError);
                                            // Open up the camera roll
                                            cameraRoll.browseForImage();
                                  else
                                            mainScreen.feedbackText.text = "This device does not support CameraRoll functions.";
                        // =================================================================================
                        // imageSelected
                        // =================================================================================
                        function imageSelected(evt:MediaEvent):void
                                  mainScreen.feedbackText.text = "Image Selected";
                                  // Create a new imagePromise
                                  var imagePromise:MediaPromise = evt.data;
                                  // Open our data source
                                  dataSource = imagePromise.open();
                                  if(imagePromise.isAsync )
                                            mainScreen.feedbackText.text += "Asynchronous Mode Media Promise.";
                                            var eventSource:IEventDispatcher = dataSource as IEventDispatcher;
                                            eventSource.addEventListener( Event.COMPLETE, onMediaLoaded );
                                  else
                                            mainScreen.feedbackText.text += "Synchronous Mode Media Promise.";
                                            readMediaData();
                        // =================================================================================
                        // browseCancelled
                        // =================================================================================
                        function browseCancelled(event:Event):void
                                  mainScreen.feedbackText.text = "Browse CameraRoll Cancelled";
                        // =================================================================================
                        // mediaError
                        // =================================================================================
                        function mediaError(event:Event):void
                                  mainScreen.feedbackText.text = "There was an error";
                        // =================================================================================
                        // onMediaLoaded
                        // =================================================================================
                        function onMediaLoaded( event:Event ):void
                                  mainScreen.feedbackText.text += "Image Loaded.";
                                  readMediaData();
                        // =================================================================================
                        // readMediaData
                        // =================================================================================
                        function readMediaData():void
                                  mainScreen.feedbackText.text += "Reading Image Data.";
                                  var imageBytes:ByteArray = new ByteArray();
                                  dataSource.readBytes( imageBytes );
                                  tempDir = File.createTempDirectory();
                                  // Set the userURL
                                  var serverURL:String = "http://www.hidden_in_this_example.com/upload.php";
                                  // Get the date and create an image name
                                  var now:Date = new Date();
                                  var filename:String = "IMG" + now.fullYear + now.month + now.day + now.hours + now.minutes + now.seconds;
                                  // Create the temp file
                                  var temp:File = tempDir.resolvePath(filename);
                                  // Create a new FileStream
                                  var stream:FileStream = new FileStream();
                                  stream.open(temp, FileMode.WRITE);
                                  stream.writeBytes(imageBytes);
                                  stream.close();
                                  // Add event listeners for progress
                                  temp.addEventListener(Event.COMPLETE, uploadComplete);
                                  temp.addEventListener(IOErrorEvent.IO_ERROR, ioError);
                                  // Try to upload the file
                                  try
                                            mainScreen.feedbackText.text += "Uploading File";
                                            //temp.upload(new URLRequest(serverURL), "Filedata");
                                            // We need to use URLVariables
                                            var params:URLVariables = new URLVariables();
                                            // Set the parameters that we will be posting alongside the image
                                            params.userid = "1234567";
                                            // Create a new URLRequest
                                            var request:URLRequest = new URLRequest(serverURL);
                                            // Set the request method to POST (as opposed to GET)
                                            request.method = URLRequestMethod.POST;
                                            // Put our parameters into request.data
                                            request.data = params;
                                            // Perform the upload
                                            temp.upload(request, "Filedata");
                                  catch( e:Error )
                                            trace(e);
                                            mainScreen.feedbackText.text += "Error Uploading File: " + e;
                                            removeTempDir();
                        // =================================================================================
                        // removeTempDir
                        // =================================================================================
                        function removeTempDir():void
                                  tempDir.deleteDirectory(true);
                                  tempDir = null;
                        // ==================================================================================
                        // uploadComplete()
                        // ==================================================================================
                        function uploadComplete(event:Event):void
                                  mainScreen.feedbackText.text += "Upload Complete";
                        // ==================================================================================
                        // ioError()
                        // ==================================================================================
                        function ioError(event:Event):void
                                  mainScreen.feedbackText.text += "Unable to process photo";

    1. Create a BitmapData of the correct size of the full image
    2. Use BitmapData.setPixels to create pixel data from your byteArray
    3. Make a new Bitmap, Bitmap.bitmapData = BitmapData
    4. Create a matrix with the correct scaling factors for your thumbnail
    5. Create a new BitmapData the size of your thumb
    6. Use BitmapData.draw to draw your image data from the Bitmap to the new BitmapData with the scaling matrix
    7. Use BitmapData.getPixels to create a bytearray from your thumb BitmapData
    8. save it
    You'll have to look up the AS3 reference to see how all these methods work.

  • How to resize my monitor resolution in OS X 10.5.8

    Hello I have a question I am new to mac and I was trying to resize my desktop resolution. I'm using a 720i TV utilizing the HDMI and using the convertor to make it DVI and for some reason when I use the 720 resolution its all off center and it won't let me resize it like it does in Windows but it works when i have it at 1280 x 960 problem is I don't want that resolution it doesn't look as good on my TV. I have tried everything and can't find any software that will allow me to do this. And I use the same monitor for my Windows machine and it works perfect PLEASE HELP

    Yeah..... I know that I want to know how to resize a resolution the 1280 x 720 doesn't show up right it's making everything go off the sides so I can't see everything on my desktop in windows my nvidia control panel would allow me to resize my monitor to fit any resolution i want to know how to do that on a mac

  • How to resize all pages -Acrobat 9 Pro Extended ? ?

    I came across a pre-existing pdf file of an old book of genealogy.  According to the front pages, it was 'Digitized by Microsoft', so I know nothing on how it was generated.  Total pages are in excess of 1,100.
    In viewing the pages, they are reflected as 2 pages to a view; not the book opened with the spine in the middle, but images side by side ... in numerical order ... and they appear as a normal sized 2 page for that view.  When I print out a page, by number, it also prints out in a normal size on an 8x11 inch sheet of paper.
    However, rather than print page by page on individual sheets of paper, I want to print out multiple pages, 2 to a sheet of paper.  In doing this, the images of the pages come up as 3x5 inch; thus not readable if printed without the usage of magnifier.
    Not that familiar with the program, but tried to do a resize process by setting some adjustments and then to a new pdf file.  It did not change that much ... and increased the file size dramatically.
    I am a novice to these processes.  Can someone advise how to resize the whole file, with images of pages side by side, so that when multiple print is used for 2 pages the size comes up closer to something like 5x7 inch each?
    Thanks

    Let me try it this way.....
    1.  The pdf file, when initially opened up, in the opening view shows 2 simotaneous pages side by side ... with hardly a divider between them.  This at this point has nothing to do with the print mode.
    2.  The book in question was 'Digitized by Microsoft' ... don't know if that makes any difference, but thought it would help to under stand that it was not created by the normal Adobe Acrobat method.
    3.  Now, when I go to the Print mode, from where I just viewed the 2-side-by-side pages, the initial view there, for 'page', is just 1 page ... not the 2 page view I just came from ... and it will print out this view in a full sheet version.
    4.  But, not wanting to print out 1130 pages, want to print multi-page as allowed under Acrobat options.
    5.  So choose multi-page and 2 pages and "Print to printable area"..
    6.  When this option appears in the print viewing window, the 'images' (presuming that to be the correct reference) are small, over the normal (roughly) 5 x 7 inch (each) for a 2-page print option.
    7.  With the 2-page print option, the images are only 3.5 x 5.25 inches ... rather than something like 5 x 7 inch ... which is difficult to read without a magnifier.  [Note:  This 3.5 x 5.25 is as indicated in Properties that the original 'Digitizing' did.
    8.  So, in essence, how can one change the default individual image size from 3.5 x 5.25 inch size, to something closer to 5 x 7 inch size ... so that each image fills in more of it's half of the 8.5 x 11 inch page being printed ... rather than the small size reflected in the attached jpg ?
    I've attached a jpg of the print screen, and one of the 2 page side-by-side 'default' view in Acrobat.
    Thanks

  • How to resize multiple images?

    I am newbie to RH and would like to know if there is a method /shortcut by which I can resize multiple images?
    Specifically to my project: I have close to 50 tables containing various images and their descriptions. When I insert these images into RH, the original image size is inserted and these images are of various sizes.
    I know how to resize multiple images in Word but not in RH and hence, reaching to higher powers
    I am using RH 9
    Appreciate all your help!

    Hi There, Well the best option is to resize each image individually but if you feel that you can select all images together and the  resize them all at once I am sure that you would like to give a read to this post from forums which talks about this job
    http://forums.adobe.com/thread/466933

  • How to resize photos in iPhoto?

    Hi
    I can seem to figure out how to resize my photos so I can send them via email or just make them smaller in general. Any suggestions?

    What is your email client? If you use Mail, Eudora, Entourage or AOL then just select the photo you want to email and click on the Mail button. You'll be presented with a menu to choose the size of the file to attach to the email.
    If you are using a web based email you'll have to export the files to the Desktop via the File->Export->File Export menu option where you'll be able to set the file size and quality level of the files.
    See TD's treatis on file access on ways to access the photos for use outside of iPhoto.
    Do you Twango?

  • How to resize mountain lion os boot partition

    how to resize mountain lion os x ver.10.8.5 boot volume partition.
    how to install ms-office application on partition that is not boot volume partition.

    Disk Utility > Internal Disk Drive > Partition > Click the "+" symbol to add a partition > Apply

  • How to resize image using java imageio

    Hello ,
    I want to know how to resize image using java imageio.
    I dont want to use java awt because i am writing a web application.
    help is very much needed
    thank you.

    Just use an AffineTransform !
    Its much easier

  • How to resize image on my mac?

    How to resize image on my mac?

    What version of Mac OS X do you have? In Preview under 10.9 Mavericks (I believe 10.8 too), this is what I see:
    The padlock is next to the unit (pixels, etc) selection box.
    Matt

  • How to resize image in JSP using JAI ??!!

    Please help me how to resize an JPEG image from my JSP, could I use JAI lib ? how ?

    Hello,
    I had the same problem few months ago ( in that case i used Jimi instead of JAI).
    The answer to your question is: use the java class called "Image".
    Infact you can use JAI just for load or save to disk your image that you have to resize and then use the following code to resize the image :
    Image imgResized = img.getScaledInstance(100,1,Image.SCALE_AREA_AVERAGING);
    The object "img" is the image to resize and the object "imgResized" is the image resized with width equals to 100 and with a right height.
    I used Jimi just to save my image and i think that with JAI there is a method to do this.
    You can use JAI to load in memory your image too so you can avoid problem with MediaTraker class.
    I hope that this can help you.
    Cheers.
    Stefano

  • How to resize image in flash

    Hi guys any tips or advise on how to resize an image i know
    there are various tools but is there a tool in Adobe flash
    professional and how can I do it
    cheers

    In what way do you want to resize the image? Are you
    importing graphics that you want to resize when you import them at
    runtime? Do you want to resize the images to a specific size or
    relative to one imported image? Or do you want to resize one or
    more images for a specific purpose at runtime based on some user
    input? Or is it something else?

  • How to resize to fit paper size? I have Envy 7640 printer.

    I accidentally was able to resize a photo the other day to fit the paper.  Now when I want to do it, I can't figure out how to do it.    I have a Mac.  Thank you in advance.

    Hi , Welcome to the HP Forums! I understand that you are wondering how to resize to fit paper size, with your HP Envy 7640 on a Mac. I am happy to help! What version of the Mac Operating System are you using? If you do not know the Operating System you are using, please visit this website. Whatsmyos. What is the name of the program you are printing from? In the meantime, please see this article, OS X Mountain Lion: Scale a document to fit your printer’s paper, as I am sure the settings are universal between Mac OS X Operating Systems. Hope this works!  “Please click the Thumbs up icon below to thank me for responding.”

Maybe you are looking for

  • Why can I not open numbers?

    Hi! I can not open Numbers 3.0.1 the message: "when you last opened numbers it quit unexpectedly while trying to open documenst (windows) that had previously been open. Do you want to try to reopen them again?" whether I press Dont open again or pres

  • Fraudulent e-mails asking for account details

    Sent from my iPad On 8 Jul 2014, at 13:49, Apple <[email protected]> wrote:  Dear iTunes Customer, This is an automatic message by the system to let you know that you have to confirm your account information within 48 hours. Your itunes account has b

  • Need to reinstall itunes

    I had a virus and need to reinstall itunes. Do I used the disk that came with my ipod or DL from the site.. which is a later version. Also how do I get my musci from the my music folder back into itunes?

  • Control the transition

    There is a button to control the title to show/hide. If the button clicked frequently the effects will go to crazy. I add the code " anyToHide.effect.stop(); " but it doesn't work. How can I control the effects ? <mx:Transition id="anyToHide" fromSta

  • E-commerce site and security

    I am likely to begin working on a large e-commerce site soon and would like to get everything straight before I begin. I have a reseller account on a virtual dedicated server at the hosting provider everyone loves to hate. Generally my modus operandi