How to correctly resize a component after loading using SWFLoader

In an app, I load SWFs into an AIR app, which manages them.
The AIR app loads the SWF, then creates a 'master' component, which
manages the loaded SWF. 'manages' means resize, move or provide
persisted preference values.
My own test Flex SWFs work OK, while another SWF does not.
Here's a screenhot:
http://www.flexolero.com/demos/Portal/shot.png
Note, that only some part of the loaded Clock resized
correctly.
The actual resize is done like this:
quote:
public function resize( newW:int, newH:int ):void {
var loadedSM:SystemManager = SystemManager( ( _inner as
SWFLoader ).content );
if ( ( null != _inner )
&& ( null != loadedSM )
&& ( null != loadedSM.application )
// BindingUtils.bindProperty( lblFromRemote, "text",
loadedSM.application, '_outChannel' );
// loadedSM.application[ 'inChannel' ] = 'New';
loadedSM.application[ 'width' ] = newW-20;
loadedSM.application[ 'height' ] = newH-20;
this.width = newW;
this.height = newH;
_inner.invalidateSize();
drawHandles();
If the Air app finishes loading the SWF, the master component
attaches a method to the managed SWF:
(_inner as UIComponent).addEventListener( Event.RENDER,
fixSizes );
Actually, Clock sample does not resize as expected at the
first time it appears.
Once the Clock is on stage, and I resize it using the mouse,
it resized as expected.
Could someone provide a hint?

maybe you need to calculate scaleX, scaleY instead?
"justria" <[email protected]> wrote in
message
news:g8fbml$e7c$[email protected]..
> In an app, I load SWFs into an AIR app, which manages
them. The AIR app
> loads
> the SWF, then creates a 'master' component, which
manages the loaded SWF.
> 'manages' means resize, move or provide persisted
preference values.
>
> My own test Flex SWFs work OK, while another SWF does
not. Here's a
> screenhot:
>
>
http://www.flexolero.com/demos/Portal/shot.png
>
> Note, that only some part of the loaded Clock resized
correctly.
>
> The actual resize is done like this:
>
>
quote:
public function resize( newW:int, newH:int ):void {
>
> var loadedSM:SystemManager = SystemManager( ( _inner as
SWFLoader
> ).content );
>
> if ( ( null != _inner )
> && ( null != loadedSM )
> && ( null != loadedSM.application )
> ) {
> // BindingUtils.bindProperty( lblFromRemote, "text",
> loadedSM.application, '_outChannel' );
> // loadedSM.application[ 'inChannel' ] = 'New';
> loadedSM.application[ 'width' ] = newW-20;
> loadedSM.application[ 'height' ] = newH-20;
> this.width = newW;
> this.height = newH;
> _inner.invalidateSize();
>
> drawHandles();
> }
>
> }
>
>
> If the Air app finishes loading the SWF, the master
component attaches a
> method to the managed SWF:
>
> (_inner as UIComponent).addEventListener( Event.RENDER,
fixSizes );
>
> Actually, Clock sample does not resize as expected at
the first time it
> appears.
>
> Once the Clock is on stage, and I resize it using the
mouse, it resized as
> expected.
>
> Could someone provide a hint?
>
>
>
>
>
>
>

Similar Messages

  • I have Adobe Photoshop 9.  I am a novice.  How can I resize photos in my files using batch resize?

    I have Adobe Photoshop 9.  I am a novice.  How can I resize photos in my files using batch resize?

    In the Editor, use File...Process Multiple Files.  See the Help for more info.
    Ken

  • How to add Oracle Partition Component after the RDBMS Installation

    Hi,
    I have been installed Oracle 11g R2 in Suse Linux 10 (64 bit), while in installation i deselect the Partition option. Now i need to bring the Oracle Partition option to my Oracle RDBMS.
    Please help me how to bring the Partition Option once again into my Oracle Server.
    Thanks in Advance,
    Baalaji V

    Same senario i have here, But i want to know how to install the Partition option after the RDBMS installation.
    Since i have been installed the Oracle 11g R2 Ent Edition without Partition option, Now i need to install the same.
    Thanks.

  • How to correctly sync from Itunes after Ipod touch

    Hi,
    I just got a new Iphone 3G, after having used an Ipod touch. I synced the Iphone from Itunes, and all my existing apps and settings have synced OK, but all the apps are empty and none of my photos, videos etc. have synced - even though I went through every tab on the device in Itunes and pressed Sync. What do I need to do to get my Iphone just like my Touch?
    Thanks,
    Richard

    Disable auto sync when an ipod/iphone is connected under preferences in itunes. Make sure you have at least one contact in the contacts list on your phone. Connect your touch, do not sync, rather right click the touch in the device pane and select "backup". Once complete, un-mount your touch, connect your phone, DO NOT SYNC, right click the phone in the device pane & select "reset warnings". Once done, right click again and select "restore from backup". Select the backup you just made. Once the restore is complete, this must be followed by a sync to put your itunes content back on your phone. You should get a popup regarding your contacts, to merge or replace, select merge. All you should have to add to your phone are wifi & email passwords, as these are not copied over for security reasons. Your phone should now look exactly like your touch.

  • How to tell if an Image is loaded using Toolkit.getImage()

    If I use Toolkit.getImage(url) it always returns an Image object, no matter if the image located at that url is a correct image or not.
    The w/h is always -1, -1 right after loading (since it hasn't been loaded completely of course).
    Anyone know how I can tell if a correct image is loaded or not, without adding a MediaTracker?

    Why don't you want to use a MediaTracker? It is by far the most convenient way to do what you want to do.
    Huw

  • How does I resize a pdf file page using Acrobat Pro?

    In Acrobat Pro, how can one resize a pdf file page (21.38'' x 26.75'') into one measuring 6'' x 9'', to be submitted as the trim size? Is there a feature that allows this to be done? How does one set all print options from the Application print dialog box to enable one to adjust the dimensions of any customized file page?

    I want to scale the 21.4'' by 26.8'' content down to one that can be fitted inside a 6'' by 9'' book.
    I have this pdf that was created from the InkFlow app, and I'm using Acrobat Pro to merge three files into one (about 300MB), which I needed to submit to Amazon's CreateSpace, but they needed the trim size of 6'' by 9'', while the pdf is 21.4''' by 26.8'', and I can't amend the source file size of the InkFlow files.
    I tried fiddling with the Crop and Print options, but I'm unable to resize the pdf to match the trim size. The problem on my side isn't so much on printing but to resize the pdf file page to 6'' by 9'' to satisfy Amazon's requirement for their trim size. Could this be done with Acrobat Pro? The message that appears is: Full print options of Acrobat Pro, set all print options from the Application print dialog box. Thank for the help.

  • How to find length of string after encryption using DBMS_CRYPTO package

    Hi,
    I am planning do data encryption using DBMS_CRYPTO package. I want to find how much will be string length after encryption.
    e.g When I try to encrypt string of length between 1-15 characters it gives me encrypted string of 32 characters. When I try with 16 charcters encrypted string is of 64 characters.
    Is ther any formula to calculate length of encrypted string?
    Thanks
    Pravin

    The length change is dependent upon the algorithm you are using which can be a combination of cipher block, padding, and chaining.
    The best solution is determine the method you are going to use and apply it to the l ongest possible strings you are going to proces, then add some safety margin. There iis no penalty for defining your column as VARCHAR2(4000).

  • How to delete a jar file after loading image files from it

    Hi,
    How can I delete a jar file after some image files have been loaded? For example, say, I have "a.jar" which contains an image "a.gif" in the root directory of the c drive. I would like to get the image size and then delete the jar file. Here is the code snippet:
        URL url = new URL("jar:file:/C:\\a.jar!/a.gif");
        Icon icon = new ImageIcon(url);
        System.out.println("icon size ? " + icon.getIconHeight());
        File file = new File("c:\\a.jar");
        while(file.exists())
            file.delete();
            try
                Thread.sleep(100);
            catch (InterruptedException ignored)
        System.out.println("file deleted.");I get the image size correctly but just can not delete the jar file. Apparently the file handle is not released, but how to close it? Any hint will be appreciated.
    Justin Jan

    I am sure the URLConnection.defaultUseCaches is set before it is connected otherwise I should catch an IllegalStateException on conn.setUseCaches(false).
            try
                URL url = new URL("jar:file:/C:\\a.jar!/a.gif");           
             URLConnection conn = url.openConnection();
               conn.setDefaultUseCaches(false);
             conn.setUseCaches(false);
                Icon icon = new ImageIcon(url);
                System.out.println("icon size ? " + icon.getIconHeight());
                url.openConnection().getInputStream().close();
                System.gc();
             System.runFinalization();
                File file = new File("c:\\a.jar");
                while (file.exists())
                    file.delete();
                    try
                        Thread.sleep(10);
                    catch (InterruptedException ignored)
                System.out.println("file deleted.");
            catch (Throwable t)
                t.printStackTrace();

  • Resizing an image after loading

    Hi.
    I'm loading an image into a movieclip by loadMovie.
    After i load it i want to resize it so it fits in a specific
    place. The problem is that the resize doesn't work on it.
    The code:
    load_mc.loadMovie("image.jpg");
    load_mc._width = 160;
    load_mc._height = 90;
    I even tried to use an onEnterFrame thinking that it wasn't
    fully loaded by the time the resize started. Still doesn't work.
    The picture is displayed but at it's full size. No resize
    happens.
    Can anyone help me resize it after it's loaded?
    Thank you.

    Thanks, that's really too nice. I was doing a little digging
    on this - why
    adding the function to the class works. Check it out:
    var mcl = new MovieClipLoader();
    trace(mcl._listeners.length);
    you will get 1 - not 0. The class itself must be registered
    as a listener by
    default?
    I'm not entirely sure. I dug a little through the Flash
    classes, and while I
    didn't find exactly what I was after I did find this within
    the
    EventDispatcher class' dispatchEvent method:
    if (eventObj.target == undefined)
    eventObj.target = this;
    So, if there's no target the method would get called on the
    class, as we
    saw.
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • How to activate Master Data automatically after loading ?

    Hi all,
    When I load via infopackage master data such as 0Material( and all attributes ), I've to activate manualy the data using right click, how to perform this automatically ?
    Thx a lot,
    Erwan

    Hi,
    Use RSDMD_MD_ACTIVATE in the program and use that PG in Process chain after uploading Info package.
    With rgds,
    Anil Kumar Sharma .P

  • How to correct close database connection after report generation

    Hello
    I have problem a with alive database connection after report creation and report  closing. How to properly to close connection to database?
    Best regards
    Edited by: punkers84 on Jun 17, 2011 10:38 AM

    that's what I am doing... after viewing the report, I call the close method on the window closing event of the container window. but the connection is still open. I had a lot of other issues with my jdbc driver but after downgrading to an older version those issues are resolved.Only this one is still there! Is there any other way to close the connection (like using dbcontroller or etc.)?

  • How to correct battery drainage problem after upgrade to mountain lion

    My macbook pro battery drains very fast, just used 3% as I am entering this question. This rapid battery drain started after upgrade to mountain lion. Any advice?

    This appears to be a problem that's affecting a number of users and has been widely reported. My guess is you're going to have to wait till they do a software update.
    There's general tips for conserving battery power on my page here that might ameliorate matters in the meantime:
    http://applehelpwriter.wordpress.com/2012/04/23/how-to-make-your-battery-power-l ast-a-bit-longer/
    Be sure to report the problem to Apple directly here:
    http://www.apple.com/feedback/
    - every extra complaint helps to add a little urgency.
    (ToU Disclaimer: this link to my site contains other links which promote my services as a technical writer)
    Message was edited by: softwater

  • How can i resize my image after image trace?

    Hello all!
    I'm just now getting into using illustrator (currently on trial for illustrator cc) and I've taken a couple of my illustrations and attempted to use the image trace. The only way I can seem to get the image trace to actually produce an accurate trace is if I use a very large file size. So I take my scanned image (600 dpi 2000x 1891) and load it into illustrator, and here's where the problem comes in. Illustrator will not show my entire image on the screen. I zoom out as far as I can go and it's still cutting off the bottom and top of the image. When I try to scale the image it won't let me scale it down to even 90%.
    So my question, is there anyway I can load my full size image into illustrator, image trace it, and then scale it down so I can see the whole image on my screen? It's very hard to paint and work around the image when it's getting cut off.
    The first picture is what the whole picture looks like, but it's such a small file size it's blurry and won't image trace correctly.
    The 2nd image is what happens when I load my full image size in, I'm scrolled as high as the page will go and the top is still cut off.

    Hope this helps Trevor.
    There are other ways of doing this, but try this one.
    Menu - ‘Select all’
    Object - ‘transform’ - ‘scale’
    Dialogue box - click ‘uniform’ add number 1% to 100%, your choice
    Options - tick ‘scale stroke & effects’
    tick ‘preview’ to see results

  • How can I reinstall Bluetooth drivers after loading windows 7 64 bit version on my 2010 iMac?

    I have just uninstalled windows 7 32 bit version which I have been using for ages and upgraded to the 64 bit version. I did this from the windows partition in my bootcamp divided hard drive. I then reinstalled the drivers using the application DVD which came with my machine but the Bluetooth driver is missing. One thought I have is whether I would be able to use the driver DVD which came with my 2011 MacBook Air (which has been running fine on windows 64bit version since I bought it)
    Would this work or any other ideas?

    moirl wrote:
    5.  I can not get anything off the Blackberry (photos etc.).
    As was stated above:
    1. Go to Options >> Media Card (or Memory)
    (some themes or BlackBerrys may call this "Settings >> Media Card")
    2. Check the following settings (if they are not listed this way, then change to reflect the following:
    a) Media Card Support: On
    b) Mass Storage Mode Support: On
    c) Auto Enable Mass Storage: Yes
    3. Save the settings and exit
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to set default value and after that , use it as control

    Hello,
    Currently i am making motor driver from labview, and i am facing one problem.
    When i connect to my board via labview, it will relay last position to global variable. After that, i have to go to loop, where i can send back  modified position to my motor control board
    In short, i have to control number, but that number default value should be writtem by another function when i start vi.
    any ideas how to do it ?
    Solved!
    Go to Solution.

    Let me know if any clarification is needed
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet
    Attachments:
    VI.vi ‏13 KB

Maybe you are looking for