BitmapData.draw() failing to draw entire MovieClip

Hi, all;
I'm trying to do some lean blitting for an object that rotates by rotating it once at startup and capturing a BitmapData snapshot of each 5 degrees.  The problem I'm having is that the draw() method of the BitmapData object is only picking up pixels in the MovieClip that are below and to the right of the registration point.  If I change the MC so that the registration point is in the top left corner, I sometimes get what looks like most of the pixels, but the entire object rotates into and out of the frame, since it's rotating around the corner and not the center.
Has anyone encountered this before, and if so is there a fix?
Thanks;
Amy Blankenship
flexdiary.blogspot.com

I think you're misunderstanding the question.  I am using a matrix to transform it, and that lower right quadrant of the MovieClip rotates perfectly as inended, but the rest of the object isn't captured as if it weren't there.
Here's the code:
package com.magnoliamultimedia.datastructures
import flash.display.BitmapData;
import flash.display.IBitmapDrawable;
import com.magnoliamultimedia.datastructures.IChain;
import com.magnoliamultimedia.datastructures.IChainable;
import flash.geom.Matrix;
import flash.geom.Rectangle;
  * RotationChain takes an IBitmapDrawable and rotates
  * it through 360 degrees, creating a BitmapDataLink
  * for each incremental rotation
  * @author Amy Blankenship
public class RotationChain implements IChain
  //private storage for the chain entry point
  private var _defaultNode:IChainable;
   * Constructor
   * @param rotatingObj object to rotate
   * @param degrees number of degrees to rotate (must divide evenly into 360)
  public function RotationChain(rotatingObj:IBitmapDrawable, degrees:int=5, size:int=200)
   //first, check if degrees divides evenly into 360
   if (360 % degrees != 0) {
    throw new Error('Degrees must divide evenly into 360');
    //set to the default, so we still have a usable chain
    degrees = 5;
   var matrix:Matrix = new Matrix();
   var bd:BitmapData;
   var bdl:BitmapDataLink;
   var lastBDL:BitmapDataLink;
   var loops:int = 360 / degrees - 1;
   for (var i:int = 0; i < loops; i++) {
    /* Take "snapshot" of rotating obj with matrix applied.
     *  On the first loop, use the identity matrix.
    bd = new BitmapData(size, size);
    bd.draw(rotatingObj, matrix);
    bdl = new BitmapDataLink(bd);
    //check for any previous links that might have been added
    if (lastBDL == null) {
     //no? this is the default
     defaultNode = bdl;
    } else {
     //set up reciprocal arrangement with last node
     bdl.previous = lastBDL;
     lastBDL.next = bdl;
    //set this link as the last link
    lastBDL = bdl;
    //rotate next snapshot
    matrix.rotate(degrees);
   //connect the last link to the first link to make a circular chain
   lastBDL.next = defaultNode;
   defaultNode.previous = lastBDL;
  /* INTERFACE com.magnoliamultimedia.datastructures.IChain */
  public function get defaultNode():IChainable
   return _defaultNode;
  public function set defaultNode(value:IChainable):void
   _defaultNode = value;
Is there anyone out there who does this kind of stuff?
Thanks;
Amy

Similar Messages

  • BitmapData.draw() and embedded MovieClip

    I can't capture the content of an embedded MovieClip, the
    following code creates a Bitmap that shows only the results of the
    changes methods of Graphics, although the clip is correctly
    embedded. Have you tackled similar problems? Thanks.
    [Embed(source="aMovieClip.swf")]
    private static var AMovieClip:Class;
    var aMovieClip:MovieClip = new AMovieClip();
    aMovieClip.graphics.lineStyle(6, 0xff0000);
    aMovieClip.graphics.lineTo(100,100); //i don't need this, but
    this is the only things that you will see, a red line
    var bitmapData:BitmapData = new BitmapData(aMovieClip.width,
    aMovieClip.height,true, 0xFFFFFF);
    bitmapData.draw(aMovieClip);

    It seems that the functions that were failing were
    getBounds() and accessing the transform.concatenatedMatrix in the
    loaded swf in the process of preparing to draw the bitmap.

  • BitmapData.draw failed on WebcamSubscriber

    Most of the times when I try to snap data from WebcamSubscriber movieclip I get the following error.
    SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: mypath.swf cannot access rtmfp://fms7.acrobat.com/cocomo/na2-sdk-bec0edb4-775b-4f16-94f7-cd43ec89ff10/test. No policy files granted access.
    in some (very few) cases it works, and I can feagure out what are the conditions require for it to work.
    Few weeks ago it was working consistently.
    Will appreciate any help.
    Best regards,
    Gadi Srebnik

    Great, bitmapdata.draw works good !
    however, it didnt happened when I removed the protocol decleration on my previous room/application. When I tried that it tried to connect to fms8 and only when I started a new application/room and removed the protocol declaration it changed to fms4 and it works fine now.
    Does it have anything to do with the specific server node?
    how can I be sure that user connection will allways run on the server that will enable this feature?
    btw, the subscribe from dev panel also work now all the time
    Best Regards,
    Gadi Srebnik

  • BitmapData.draw fails to capture webcam

    I am trying take a snapshot from a webcam. I'm using
    BitmapData.draw(video). This works fine on my desktop but when I
    try to do it in the browser it fails. Apparently this is some kind
    of security restriction. Is there a way to get around it?

    Hello jspoon27,
    I am working on a locally run flash application that is very
    similar to your post about wanting to save a snapshot of a local
    webcam. Could you share your code for doing that or explain your
    steps? I would like to have a webcam running then take a snapshot
    of the webcam with a button and then email the saved snapshot. My
    main interest is how you created the snapshot and button for it.
    Thank you,
    LeverLock2

  • BitmapData draw method doesn't work when the project is published as the .swf file of the web applic

    Hi,
            I am totally confused by this strange error. When I tried using the draw method of BitmapData to draw a movieclip symbol of my project, it seems to work fine locally. However, as I uploaded the published .swf file to my web server and launched it as the plugin of my web application, it failed. The source codes as follows,
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    message3 didn't show at all. Instead, the browser console shows "Uncaught Error: Error calling method on NPObject.". My understanding of this error message is that the .swf is calling something crashing, and I believe that bd.draw(stage)is the crashng method call.
    Also, here is my html embed tag:
        <embed src="/tests/videoplayer.swf" id="flash" quality="high" height="510" width="990" scale="exactfit" name="squambido" align="middle" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" style="margin: 0px auto;clear:both;position:relative;"/>
    Can someone help me?

    Thank you for your reply.
    I tried stageWidth and stageHeight, but it still doesn't work.
    The draw() methid is triggered when I clicked a screenshot button in my application as follows,
    ExternalInterface.addCallback("printscreenClicked", printscreenClicked);
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    Would you please give me an example of "waiting for Event.RESIZE is good, or just at least Event.ENTER_FRAME"?
    My real purpose in this application is to capture a snapshot of a streaming video. The video is contained in a movieclip object. I tried stage first since BirmapData.draw() doesn't work when drawing the movieclip on the web site. Do you have any suggestion for this situation? Also, is there any good method to find out what happened if the browser have "Uncaught Error: Error calling method on NPObject."?

  • SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: cannot access

    When we try to print the Google Map API for Flash component, it is throwing the Security Sandbox Violation
          SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://ps6143:8080/aa/XYZ/Main.swf/[[DYNAMIC]]/1 cannot access  http://mt1.google.com/vt/lyrs=m@171000000&hl=en&src=api&x=1&y=1&z=1&s=Gali&flc=x3t. No policy files granted access.
    at flash.display::BitmapData/draw()
    To avoid this error we tried to use the alternate API provided by library. But that also causing cross domain issue as it loading some 3d library internally which is not able to access our application.
    SecurityError: Error #2121: Security sandbox violation: BitmapData.draw: http://maps.googleapis.com/mapfiles/lib/map_1_20_10_3d.swf cannot access http://ps6143.persistent.co.in:8080/dv/SiteOptimizer/SiteOptimizer.swf/%5b%5bDYNAMIC%5d%5d /1http://ps6143:8080/aa/XYZ/Main.swf/[[DYNAMIC]]/1. This may be worked around by calling Security.allowDomain.
    at flash.display::BitmapData/draw()
    Please help us in resolving this issue.
    Thanks & Regrds,
    Ravi Darji

    There is no redirect... Charles is a web proxy so it will look completely legitimate to the browser.
    According to the help, it's getting the access request from the SWF itself and not the crossdomain.xml file:
    In the case of a source object other than a loaded bitmap, the source object and (in the case of a Sprite or MovieClip object) all of its child objects must come from the same domain as the object calling the draw() method, or they must be in a SWF file that is accessible to the caller by having called the Security.allowDomain()method.
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7d1b.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7c4a
    So the default state accessing a SWF on a different domain is protected, unless that SWF allows some or all domains to access it via the Security.allowDomain() method.

  • Draw inside movieclip/graphic with Actionscript

    Hi.
    How I can draw inside movieclip/graphic element with Actionscript?
    If i have example movieclip-element in my project and want to draw a single dot in its coordinate (10,10), how I can do that?
    ty m8s!

    The easiest way to draw inside a movieClip is the graphics class.
    You could do something like:
    this.graphics.lineStyle(1, 0x000000);
    this.graphics.moveTo(10, 10);
    this.graphics.lineTo(11, 11);
    This isn't perfect when drawing pixels, however - it only has methods for lines and shapes(circles, rectangles etc).
    If its important for you to draw a single pixel and accuracy is more important you may want to consider converting your Movieclip to a BitmapData class, which has methods for setting Pixels. Realistically though, if you didn't know about the graphics class, then that'll probably be what you're after.

  • BitmapData.draw problem due to security

    As another thread has posted, there seems to be a problem for BitmapData.draw on the Stratus server.
    After connecting to the Stratus server, drawing any part of the UIComponents will be stopped by a security alert.
    Event after disconnecting to Stratus, the problem still exist.  The only time when BitmapData.draw worked is when
    the application just lunched and havn't connect to Stratus yet.
    I've found another thread in the LCCS forum discussing the same problem, and it seems that over there they found a solution.
    Just wondering of Stratus will apply the same fix or do we have to wait until the new edition of FMS to have this fixed.
    Thanks in advance
    The LCCS forum thread discussing this problem:
    http://forums.adobe.com/message/2803074#2803074

    Hi,
    If you haven't already, I suggest opening a ticket with customer support.
    Jennie

  • HTTP Streaming and BitmapData.draw

    Hi OSMF Experts,
    I've tried to duplicate segments of a Video with BitmapData.draw.
    It's working with RTMP (set videoSampleAccess server side).
    Progressive is also working (crossdomain.xml is ok).
    BitmapData.draw doesn't work with HTTP Streaming! (Using *.f4m). What's the way to get this working? Following Error is thrown:
    SecurityError: Error #2123: Verletzung der Sicherheits-Sandbox: BitmapData.draw: file:///C|/players/myVideoTestHTTP.swf kann nicht auf null zugreifen. Es haben keine Richtliniendateien Zugriff gewährt.
    I've used OSMF 2.0 for the Tests. And I've testet with the sample.mp4/manifest.f4m example.
    Thanks for your answers.
    Greets
    Martin

    Have you seen bug CSCdx31582- Macintosh wont play WMT from CE (ecdn). Guess this is similar to the issue that you have.

  • Getting Security Error when trying to use bitmapdata.draw method on youtube videos

    Hi All ,
    I am playing youtube videos in UIComponet of flex, but when I trying to capture the image using bitmapdata.draw() method it gives me an secutity error on server  , It works well locally in flex editor.
    Is any one knows how to resolve this bug??
    Thanks in advance
    sujit Rai

    Try nesting the clips and then adding the warp stabiliser to the nest.

  • BitmapData.draw Security Sandbox and LocalTrusted not working?

    Hello there, wondering if anyone else is having the same
    problem -- I have a LocalTrusted security sandboxType -- and when i
    try to access a BitmapData.draw method on a progressive flv, i get
    the error message:
    SecurityError: Error #2135: Security sandbox violation:
    BitmapData.draw: file://file.swf may not access null. RTMP content
    cannot be accessed using this API.
    I've rechecked my sandbox type a zillion times, as well as
    tried putting allow="*" in the crossdomain policy file ....
    is this an error in my security settings -- or is
    bitmapdata.draw on video objects now "gone"?

    Could you try this - Open and swf, rightClick - Goto
    settings, then click Advanced. On the webPage click on "Global
    Security settings panel".
    If you don't find your local directory in there, add it and
    see if things work?
    If not, it would be good if you could post the chunk of code
    which is creating problems.

  • BitmapData.draw() with crossdomain

    Hi,
    I am trying to capture an FLV Frame with the
    bitmapdata.draw() function.
    I works fine with same domain but don't with cross domain
    even with crossdomain.xml
    I got a Security SandBox Violation
    Here is the sample demo :
    http://www.raprace.nl/forums/MMBBSevotest/Snapshot1.html
    It should be considering the file
    http://loloviolo.com/crossdomain.xml
    Here is the source
    Thanks for your help.
    LoLoVioLo

    works for me using an flvplayer without a cross domain
    policy.

  • Security sandbox violation: BitmapData.draw

    Hello,
    I got this error:
    SecurityError: Error #2122: Security sandbox violation: BitmapData.draw: A policy file is required, but the checkPolicyFile flag was not set when this media was loaded. 
    when I try to draw a frame of a movie that is downloading from another server. Crossdomain.xml is set. Another Jpgs are correctly drawn but only a movie causes an error.
    I need to checkPolicyFile but where should I do this? I have no direct access  to Loader to set up LoaderContext(true) ...
    Thanks,
    Michal

    I too would love to know how we can pass in our own LoaderContext to set the security domain. I'm receiving the same error after snapshotting a loaded SWFElement bug/watermark.
    e.g.
    var bug:MediaElement = new SWFElement(new URLResource(url));
    var bugTrait:LoadTrait = bug.getTrait(MediaTraitType.LOAD) as LoadTrait;
    bugTrait.load();

  • BitmapData.draw Security error

    I am drawing to bitmap from MediaContainer:
    var mediaContainer:MediaContainer = new MediaContainer();
    bitmapData.draw(mediaContainer);
    This works, but when I switch video, an error occurs:
    SecurityError: Error #2123: Security sandbox violation: BitmapData.draw
    cannot access unknown URL. No policy files granted access.
    Any ideas?

    Here you go:
    http://flashboard.info/files/DrawTest.fxp
    It has both HTTP and RTMP ways.
    I've tried launching from http:// and file:// - both work fine for me.
    Links inside app are to our production servers.
    Regards!

  • LOCAL_WITH_NETWORK sandbox and SecurityError: Error #2121: BitmapData.draw

    We have an application we run in a localWithNetwork security sandbox.  This application loads many assets from an off-site web server.  In spite of a very permissive crossdomain.xml, swfs downloaded from site give a 2121 error when we convert them to bitmaps at runtime.
      <?xml version="1.0" ?>
      <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
      <cross-domain-policy>
        <allow-access-from domain="*" />
        <site-control permitted-cross-domain-policies="all"/>
      </cross-domain-policy>
    Now, I understand why this restriction with BitmapData.Draw exists in general, and from what I've read in other discussion threads the general solution is to allow less restrictive access via crossdomain.xml.  This is the most permissive I know how to make it, although the documentation on the subject is not the most concise.  Are there details I'm missing here?
    For the moment we're just running this as LOCAL_TRUSTED, but this requires folks to be setup with the debug plugin which is a maintenance problem.
    Thanks in advance for any guidance.
    jv

    Crossdomain isn’t used in localWithNetwork because there is no “domain” for the request.
    I didn’t think you needed a debug plugin for LOCAL_TRUSTED, I thought any trust file would work.  Did you try creating an AIR app instead?  It might have different security rules.

Maybe you are looking for

  • Problem In Case Statement

    HI ALL, in the program,i need to display description based on condition type. so we used CASE statement as below in LOOP. ITS not working . could anyone please suggest if anything wrong in the following code. LOOP AT gt_mat.        MOVE gt_mat-type 

  • After updating to latest OS X Lion 10.7.5 my display is very fuzzy and flickering

    My monitor is hooked up to the mac with hdmi cable and to pc with vga cable.  After upgrading the OS X over the weekend my mac display is a mess.  Very blurry and flickering.  Checked all cables, rebooted, etc.  When I switch over to my pc, display i

  • ORA-17125: "Improper statement type returned by explicit cache"

    I have been using SQLJ to some extent in the current java project but just now I'm getting this error on a particular piece of code which was converted using SQLJ pre-compiler: // #sql [xtrConnectionContext] { CALL // XTR_CFNG_DBAPI.pRemoveXTRLotsLog

  • Problem in excuting select statement

    Hi, I have created simple report and in start-of-selection i have writen select statement with bukrs and lifnr as parameters. But i am unable to execute the query. find the code start-of-selection.   select bukrs          lifnr          name1        

  • Exporting the Lightroom Web Flash Gallery

    I have a website that includes an HTML slideshow.  I would like to update the HTML slideshow to a web Flash slideshow through the Lightroom 3 web Flash gallery module.  So far as I can tell, however, one can export the Lightroom Flash module only as