Don’t use width or height properties of Loader with AVM Captivate SWFs

 

Found a bug? Or just a limitation? Either way, if you try loading Captivate-generated movies into a Loader instance, like this:

var myLoader:Loader = new Loader();
myLoader.load(new URLRequest(”myCaptivate.swf”);
myLoader.width = 400;
myLoader.height = 300;
addChild(myLoader);

The result will be that the Captivate gets loaded but you won’t see it. You can hear it so long as you have sound in it. But you won’t see it. It doesn’t get rendered.

But if you have the same exact code as above, but without modifying the width/height properties of the Loader instance, then it renders fine.

This entry was posted in Captivate, Flash and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

 

3 Comments

  1. RaiulBaztepo
    Posted March 28, 2009 at 6:42 pm | Permalink

    Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language ;)
    See you!
    Your, Raiul Baztepo

  2. ji
    Posted July 1, 2009 at 2:52 am | Permalink

    I also meet such a problem …. in Flash AVM3

  3. ji
    Posted July 1, 2009 at 3:27 am | Permalink

    After search a lot, I found the reason.
    There are two ways to deal with such problem.
    1: set the scaleX/Y property of the Loader.
    2: We all do wrong using about the “Loader” Object to directly set the height and width of it.
    You can not set the hight and width before the loading process finishing.

    import flash.display.Loader;
    import flash.net.URLLoader;
    import flash.events.*;
    var _loader:Loader=new Loader();
    _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoadingComplete);
    _loader.load(new URLRequest(”http://www.thesquashracket.com/wallpapers/nature/165858ducks.jpg”));
    addChild(_loader);
    function onLoadingComplete(evt:Event) {
    trace(["before resize",evt.target.content.height,evt.target.content.width]);
    evt.target.content.height=100;
    evt.target.content.width=100;
    trace(["After resize",evt.target.content.height,evt.target.content.width]);
    }

    reference: http://www.actionscript.org/forums/archive/index.php3/t-150974.html

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Subscribe without commenting