5 Replies Latest reply on Oct 30, 2009 10:41 AM by commadelimited

    Type coercion error in JS AIR app; what's the JS version of iBitmapDrawable?

    commadelimited Level 2

      I'm trying to research using existing AS3 classes to a larger degree in JS AIR apps. The first experiment I'm working on is being able to capture a screenshot of the app and save it as a bitmap. Sounds simple enough right? I think it would be except that my code is choking on the bitmapdata.draw method. I can't figure out what the JS version of iBitmapDrawable would be. I've tried passing in "this", "window", "nativeWindow", DOM nodes, and more. Each time I get the following error:


      TypeError: Error #1034: Type Coercion failed: cannot convert __HTMLScriptObject@5f42f11 to flash.display.IBitmapDrawable.


      I'm attaching my code for perusal. I've also attached a link to my Aptana project. I'd appreciate some insight please.


      var fileStream = new air.FileStream();

      var bitmapData = new window.runtime.flash.display.BitmapData(nativeWindow.width,nativeWindow.height, false);

      bitmapData.draw(this);//, new window.runtime.flash.geom.Matrix());