BitmapData issue

I am trying to cut up a displayObject into bitmapdata chuncks and then shove those chuncks into List with an ItemRenderer, but I seem to having an issue.  Here is my stack dump.
ArgumentError: Error #2015: Invalid BitmapData.
    at flash.display::BitmapData/get width()
    at spark.primitives::BitmapImage/measure()[E:\dev\gumbo_beta2\frameworks\projects\spark\src\ spark\primitives\BitmapImage.as:339]
    at spark.primitives.supportClasses::GraphicElement/measureSizes()[E:\dev\gumbo_beta2\framewo rks\projects\spark\src\spark\primitives\supportClasses\GraphicElement.as:3563]
    at spark.primitives.supportClasses::GraphicElement/validateSize()[E:\dev\gumbo_beta2\framewo rks\projects\spark\src\spark\primitives\supportClasses\GraphicElement.as:3525]
    at spark.components::Group/validateSize()[E:\dev\gumbo_beta2\frameworks\projects\spark\src\s park\components\Group.as:791]
    at mx.managers::LayoutManager/validateClient()[E:\dev\gumbo_beta2\frameworks\projects\framew ork\src\mx\managers\LayoutManager.as:888]
    at mx.core::UIComponent/validateNow()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\m x\core\UIComponent.as:7249]
    at spark.components::DataGroup/initializeTypicalItem()[E:\dev\gumbo_beta2\frameworks\project s\spark\src\spark\components\DataGroup.as:247]
    at spark.components::DataGroup/ensureTypicalLayoutElement()[E:\dev\gumbo_beta2\frameworks\pr ojects\spark\src\spark\components\DataGroup.as:266]
    at spark.components::DataGroup/updateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\sp ark\src\spark\components\DataGroup.as:1056]
    at mx.core::UIComponent/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8065]
    at mx.managers::LayoutManager/validateClient()[E:\dev\gumbo_beta2\frameworks\projects\framew ork\src\mx\managers\LayoutManager.as:931]
    at mx.core::UIComponent/validateNow()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\m x\core\UIComponent.as:7249]
    at mx.managers::PopUpManagerImpl/centerPopUp()[E:\dev\gumbo_beta2\frameworks\projects\framew ork\src\mx\managers\PopUpManagerImpl.as:472]
    at mx.managers::PopUpManager$/centerPopUp()[E:\dev\gumbo_beta2\frameworks\projects\framework \src\mx\managers\PopUpManager.as:204]
    at com.utils::PopManager$/openPopUpWindow()[/Users/work/src/com/utils/PopManager.as:34]
    at com.controller::HandlePopCommand/execute()[/Users//controller/HandlePopCommand.as:316]
    at org.puremvc.as3.core::Controller/executeCommand()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\core\Controller.as:115]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at org.puremvc.as3.patterns.observer::Observer/notifyObserver()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\observer\Observer.as:100]
    at org.puremvc.as3.core::View/notifyObservers()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\core\View.as:126]
    at org.puremvc.as3.patterns.facade::Facade/notifyObservers()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\facade\Facade.as:404]
    at org.puremvc.as3.patterns.facade::Facade/sendNotification()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\facade\Facade.as:387]
    at org.puremvc.as3.patterns.observer::Notifier/sendNotification()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\observer\Notifier.as:49]
    at com.view::StageMediator/onPrintClicked()[/Users/work/src/com/view/StageMediator.as:178]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\gumbo_beta2\frameworks\projects\framework\src \mx\core\UIComponent.as:11749]
    at com.view.components::CustomGreyNavControlBar/sendEvent()[/User/work/src/com/view/componen ts/CustomGreyNavControlBar.mxml:356]
    at com.view.components::CustomGreyNavControlBar/handlePrintClick()[/Users/work/src/com/view/ components/CustomGreyNavControlBar.mxml:267]
    at com.view.components::CustomGreyNavControlBar/__printButton_click()[/Users/work/src/com/vi ew/components/CustomGreyNavControlBar.mxml:538]

Got it. I was calling .dispose and I guess the bitmapdata reference was being
disposed before it was being shoved in the List. So commeted out .dispose and all works.
J

Similar Messages

  • Security issue with NetStream.appendBytes() and BitmapData.draw()

    Iuse appendBytes to continuously and seamlessly stream video data into a netStream. since we're NOT playing the video files directly from a web domain, there is no meaning to the checkPolicyFile property of our netStream object and therefore - we cannot BitmapData.draw() our Video instance with the netStream attached.
    Is there any possibility to get images from the netStream in order to manipulate them on-the-fly?

    I ran into the same problem.  Have you managed to find a solution to get around the security violation?

  • Uploading bitmapData using FileReference class ?

    Hi gurus ;)
    Question nr 1.
    Is it possibly to upload bitmapData to server using
    FileReference class ? How should i approach this issue, is there
    any ready classes available for this purpose. I'm generating
    bitmaps inside my Flash/Flex App and need to store them under users
    profile in server.
    Question nr 2.
    Can i upload files from remote server to another using
    FileReference class
    e.g Somehow like :
    uploadURL = new URLRequest();
    uploadURL.url = "
    http://www.[yourDomain
    fileURL.url = "
    http://www.myLocation.com/myfile.JPG";
    file = new FileReference(fileURL.url);
    file.upload(uploadURL);
    This is just an idea, sure not working ;)
    Any ideas are helpful
    Thx
    iquaaani

    I did a small application that uploads a file to the server
    every hour. If the server response that a login is required to
    upload the file, it goes to a login page to do the login and
    retried to upload the file.
    I got the server response in order to know if the file did
    upload correctly or not (I have to send more form data than just
    the file). I didn't try the mime type since it's not relevant for
    my application and usualy this information is not very trust worthy
    anyways.
    I'm not sure what you mean with exceptions, if you are
    referring to HTTP errors, I think there is an event for that, but I
    used the IOError event for this, and it seems to work good
    also.

  • Issue with Dragging a 3D Layer

    There seem to at least three ways to get an external 3D model into a document:
    1. Open the model file itself.
    2. New Layer from 3D File.
    3. Drag a 3D layer from another document.
    The third way has a problem associated with it that doesn't seem to be documented:  Unlike the first two, when you do this one, the results depend on where you release the mouse cursor.  The worst part is that unless you happened to drop it at the center of the document, you can get some very non-intuitive behavior:
    When you zoom the camera in the Camera Tool (N), the center of the image does not stay fixed as it does with a real camera.  This leads to real problems in positioning the camera to get the view you want.
    The orthogonal camera views (Left, Top, etc.) normally adjust to show the image centered in the view.  They do not in this case.  The Top view, for example, shows the red and green axes as crossing somewhere besides the center and perhaps even not inside the view.  The model is not centered.
    For a given camera elevation and azimuth, you should be able to calculate where to place the camera and how to rotate it so that it points at, say, the origin.  If you do this correctly, it will work in the first two cases, but not the third.
    It can be a gotcha.  The documentation Combine 3D objects (Photoshop Extended) has explict directions for the steps you should take but does not mention this effect.  The effect is especially apparent and non-intuitive when the camera is near or in the model, and as it would turn out, that was the situation in my first real project with Photoshop 3D.  It took me a long time (weeks) to figure out what was happening, and I still have some remaining lack of understanding.
    In case you don't want to read further, let me say that you can avoid this problem by using Shift-drag or Layer | Duplicate Layer.  Both of these center the 3D object in the layer, and the camera works as you would expect a 3D camera to work.  (The documentation should say this rather than what it does say.)
    It doesn't seem to be a bug, and the implementation is probably logical, but it needs to be documented.  I am not sure of the best way to help this happen.  Perhaps someone can suggest the most effective way to go about it.
    This is what I have learned the hard way.
    It works just the same as dropping an image on a layer.  You can use the Move Tool (V) to move the image around and can use Free Transform (Ctrl-T or Command-T) to move, resize, or distort it.  In addition, Free Transform will show you the numeric values of where the image is located, how it is sized, etc.  This is true of other Photoshop objects in a layer as well, not just images.
    It is, in fact, apparently using the same mechanism as it does for all objects.  The problem is that this is a 2D concept and doesn't play well with the 3D object.  For a 3D object by itself, what you see is determined by the camera and model positions.
    These, in fact, stay with the 3D object in the layer as you move it around.  However, the camera is aimed relative to the 3D object whereas what you see is a combination of this and the location of the 3D object in the 2D layer of the document.  For example if your 3D object is moved to the lower right of the document, then all of the Top, Left, Front, etc. views will show it in the lower right.  This is probably not what you would expect, at first anyway.
    The numeric values of the location of  an object in a layer are given in pixels.  The locations of things in the model inside the 3D object are in terms of its dimensions (inches, meters, etc.) even though the units are not necessarily known).
    I do not yet know what algorithm Photoshop uses to determine the end result of what you see.  They don't even document their 3D coordinate system, much less this.  I have been able to determine fairly well what the coordinate system must be, but I haven't figured out how it gets mixed in with the location in the 2D layer.
    I also have not yet figured out how to get the numeric values for where the object is located in the layer.  The free transform values always indicate it is the same size as the layer and centered.  It will always render to fill the document window, in any event.  If someone knows how to get the numeric values, I would appreciate the information.  It is necessary if you want to do accurate placement as for an engineering or architectural model.
    An upside is that this can be a powerful feature if you learn to control it.  I am reasonably sure you can get views of your model that are not possible using the 3D camera and object tools alone.  I think this because I spent a lot of time trying to position an object in a tutorial so it looked like the example given.  I was not able to do this with the camera controls alone and was only successful after moving the layer, once I learned the above.
    Thanks in advance for any further insight into this issue.

    I ran into this to...it has to do with the way the player
    handles the 3D transform. The workaround I used was to take a
    snapshot of the object you are rotating using BitmapData, make your
    actual object invisible, rotate the temp bitmap, and then at the
    end of the rotation remove the temp object and make your actual
    object visible again.

  • Issue with allowedHTMLdomains.txt in Live App

    Hi,
    My Purpose is to record live streams on server side and play recorded files later.
    What i have done is -
    1. Copied All files of applications/live in some safe location.
    2. Copied all files from samples/applications/live to applications/live folder. (Deleted main.far from live folder)
    3. Restricted SWF and HTML to mydomain in these files - allowedHTMLdomains.txt and allowedSWFdomains.txt
    4. In main.asc i added these line in the end
    var mystream;
    var intervalID;
    application.onConnect = function(clientobj)
      return true;
    application.onPublish = function(clientObj,streamObj){
    trace("In app pub:");
    mystream = Stream.get(streamObj.name);
    mystream.onStatus = function(info)
         trace("mystream onstatus:"+ info.code);
    mystream.record();
    trace("Got it via FMLE = " + streamObj.name);
    application.onUnpublish = function(clientObj,streamObj){
    mystream.record(false);
    5. Then i restarted FMS and tried streaming using FLash Media Encoder. I was able to live stream and then i stopped it.
    6. A FLV File was recorded in application/live folder with the stream name that i used in encoder.
    Now the issues i have, i am able to view live video on my domain as well as some other domain, that means allowedHTMLdomains.txt and allowedSWFdomains.txt did not worked. Another issue is that i am not able to view recorded video after i stopped encoder but i was able see live video before stopping. i am using jwplayer to view the video and using flashvars streamer(rtmp://xx.xx.xx.xxx/live) and file(abc) to view the live and recorded video.

    I am getting another issue now.
    i was able to record with this app when i changed fms.ini
    i added this line in fms.ini
    LIVE2_DIR = /opt/adobe/fms/applications/webroot/live_recorded
    also changed Application.xml in new app and changed this line <Streams>/;${LIVE2_DIR}</Streams>
    After this i was able to record files using my previously mentioned code. But i want to record live videos in same app in streams/intancename/ folder or streams/_definst_ folder 
    i also created streams/_definst_ folder in inside myapp folder with 777 permissions
    after this i changed fms.ini again and changed LIVE2_DIR = /opt/adobe/fms/applications/webroot/live_recorded to LIVE2_DIR = /opt/adobe/fms/applications/myapp
    But now there is no recording. Please help me what i am doing wrong.
    Again i am pasting my code of main.asc here with was a copy of samples/appplications/live folder-
    * application.onAppStart:
    *                    is called when application load. It contains Live (out of the box)
    * application specific initializations.
    application.onAppStart = function()
        // Logging
        trace("Starting Live Service...");
        //  Turning on the Authentication by default
        this.HTMLDomainsAuth =    true;
        this.SWFDomainsAuth =    true;
        // Populating the list of domains which are allowed to host HTML file
        // which in turn may embed a SWF that connects to this application
        this.allowedHTMLDomains = this.readValidDomains("allowedHTMLdomains.txt","HTMLDomains");
        // Populating the list of domains which are allowed to host a SWF file
        // which may connect to this application
        this.allowedSWFDomains = this.readValidDomains("allowedSWFdomains.txt","SWFDomains");
        // Logging
        if(this.HTMLDomainsAuth){
            trace("Authentication of HTML page URL domains is enabled");
        if(this.SWFDomainsAuth){
            trace("Authentication of SWF URL domains is enabled");
        trace("...loading completed.");
    *  application.validate:
    *                 function to validate a given URL by matching through a list of
    * allowed patterns.
    * Parameters:
    *     url:        contains the input url string.
    *     patterns:    Array; an array of permmited url patterns.
    * return value:
    *             true; when 'url domain" contains a listed domains as a suffix.
    *              false; otherwise.
    application.validate = function( url, patterns )
        // Convert to lower case
        url = url.toLowerCase();
        var domainStartPos = 0; // domain start position in the URL
        var domainEndPos = 0; // domain end position in the URL
        switch (url.indexOf( "://" ))
            case 4:
                if(url.indexOf( "http://" ) ==0)
                    domainStartPos = 7;
                break;
            case 5:
                if(url.indexOf( "https://" ) ==0)
                    domainStartPos = 8;
                break;
        if(domainStartPos == 0)
            // URL must be HTTP or HTTPS protocol based
            return false;
        domainEndPos = url.indexOf("/", domainStartPos);
        if(domainEndPos>0)
            colonPos = url.indexOf(":", domainStartPos);
            if( (colonPos>0) && (domainEndPos > colonPos))
                // probably URL contains a port number
                domainEndPos = colonPos; // truncate the port number in the URL
        for ( var i = 0; i < patterns.length; i++ )
            var pos = url.lastIndexOf( patterns[i]);
            if ( (pos > 0) && (pos  < domainEndPos) && (domainEndPos == (pos + patterns[i].length)) )
                return true;
        return false;
    *     application.onConnect:
    *                 Implementation of the onConnect interface function (optional).
    *  it is invoked whenever a client connection request connection. Live app uses this
    *  function to authenticate the domain of connection and authorizes only
    *  for a subscriber request.
    application.onConnect = function( p_client, p_autoSenseBW )
        // Check if pageUrl is from a domain we know.   
        // Check pageurl
        // A request from Flash Media Encoder is not checked for authentication
        if( (p_client.agent.indexOf("FME")==-1) && (p_client.agent.indexOf("FMLE")==-1))
            // Authenticating HTML file's domain for the request :
            // Don't call validate() when the request is from localhost
            // or HTML Domains Authentication is off.
            if ((p_client.ip != "127.0.0.1") && application.HTMLDomainsAuth
                    &&  !this.validate( p_client.pageUrl, this.allowedHTMLDomains ) )
                trace("Authentication failed for pageurl: " + p_client.pageUrl + ", rejecting connection from "+p_client.ip);
                return false;
            // Authenticating the SWF file's domain for the request :
            // Don't call validate() when the request is from localhost
            // or SWF Domains Authentication is off.
            if ((p_client.ip != "127.0.0.1") && application.SWFDomainsAuth
                    &&  !this.validate( p_client.referrer, this.allowedSWFDomains ) )
                trace("Authentication failed for referrer: " + p_client.referrer + ", rejecting connection from "+p_client.ip);
                return false;
                // Logging
            trace("Accepted a connection from IP:"+ p_client.ip
                            + ", referrer: "+ p_client.referrer
                            + ", pageurl: "+ p_client.pageUrl);
        }else{
            // Logging
            trace("Adobe Flash Media Encoder connected from "+p_client.ip);
        // As default, all clients are disabled to access raw audio and video and data bytes in a stream
        // through the use of BitmapData.draw() and SoundMixer.computeSpectrum()., Please refer
        // Stream Data Access doccumentations to know flash player version requirement to support this restriction
        // Access permissions can be allowed for all by uncommenting the following statements
        //p_client.audioSampleAccess = "/";
         //p_client.videoSampleAccess = "/";  
        this.acceptConnection(p_client);
        // A connection from Flash 8 & 9 FLV Playback component based client
        // requires the following code.
        if (p_autoSenseBW)
            p_client.checkBandwidth();
        else
            p_client.call("onBWDone");
        p_client.setBandwidthLimit(74000, 74000);
            application.acceptConnection(p_client);
    * Client.prototype.getPageUrl
    *                 Public API to return URL of the HTML page.               
    Client.prototype.getPageUrl = function() {
        return this.pageUrl;
    * Client.prototype.getReferrer
    *                 Public API to return Domain URL of the client SWF file.               
    Client.prototype.getReferrer = function() {
        return this.referrer;
    * FCPublish :
    * FME calls FCPublish with the name of the stream whenever a new stream
    * is published. This notification can be used by server-side action script
    * to maintain list of all streams or also to force FME to stop publishing.
    * To stop publishing, call "onFCPublish" with an info object with status
    * code set to "NetStream.Publish.BadName".
    Client.prototype.FCPublish = function( streamname )
        // setup your stream and check if you want to allow this stream to be published
        if ( true) // do some validation here
        {      // this is optional.
            this.call("onFCPublish", null, {code:"NetStream.Publish.Start", description:streamname});
        else
            this.call("onFCPublish", null, {code:"NetStream.Publish.BadName", description:streamname});
    * FCUnpublish :
    * FME notifies server script when a stream is unpublished.
    Client.prototype.FCUnpublish = function( streamname )
        // perform your clean  up
        this.call("onFCUnpublish", null, {code:"NetStream.Unpublish.Success", description:streamname});
    * releaseStream :
    * When FME connection to FMS drops during a publishing session it will
    * try and republish the stream when connection is restored. On certain
    * occasions FMS will reject the new stream because server is still
    * unaware of the connection drop, sometimes this can take a few minutes.
    * FME calls "releaseStream" method with the stream name and this can be
    * used to forcibly clear the stream.
    Client.prototype.releaseStream = function(streamname)
         s = Stream.get(streamname);
         s.play(false);
    * application.readValidDomains
    *             Function to read Allowed domain file
    * Parameters:
    *         fileName:
    *             name of the file in the application directory
    * which contains one valid domain name per line. This file can contain
    * comments followed by a '#' as the very first charector in that line.
    * a non-comment entry with a space is considered as an error case.
    * returns
    *         an array in which each entry contains a domain name
    * listed in the file.
    application.readValidDomains = function( fileName , domainsType )
        var domainFile = new File(fileName);
        var domainsArray = new Array();
        var index = 0;
        var lineCount = 0;
        var tempLine;
        domainFile.open("text", "read");
        // Read the file line-by-line and fill the domainsArray
        // with valid entries
        while (domainFile.isOpen && ! domainFile.eof() )
            tempLine = domainFile.readln();
            lineCount++;
            if( !tempLine  || tempLine.indexOf("#") == 0)
                continue;
            tempLine = tempLine.trim();
            if(tempLine.indexOf(" ")!=-1)
                trace("undesired <space>, domain entry ignored. "+fileName+":"+(lineCount+1));
            else
                domainsArray[index] =  tempLine.toLowerCase();
                index++;
                if(tempLine == "*")
                    switch (domainsType){
                        case "HTMLDomains":
                            trace ("Found wildcard (*) entry: disabling authentication for HTML file domains ")    ;
                            application.HTMLDomainsAuth =    false;       
                            break;
                        case "SWFDomains":
                            trace ("Found wildcard (*) entry: disabling authentication for SWF file domains ")    ;
                            this.SWFDomainsAuth =    false;       
                            break;
                        default:
                            // Do nothing
                            break;   
        } // End while
        // Something is wrong! the domains file must be accessible.
        if( !domainFile.isOpen){
            trace("Error: could not open '"+fileName+"', rejecting all clients except localhost. ");
        else
            domainFile.close();
        return domainsArray;
    * String.prototype.trim:
    *             Function to trim spaces in start an end of an input string.
    * returns:
    *         a trimmed string without any leading & ending spaces.
    String.prototype.trim = function () {
        return this.replace(/^\s*/, "").replace(/\s*$/, "");
    var mystream;
    application.onPublish = function(clientObj,streamObj){
    mystream = Stream.get("mp4:"+streamObj.name+".f4v");
        if (mystream)
                    mystream.record("record",600);
                    mystream.play(streamObj.name,-2,-1);
    application.onUnpublish = function(clientObj,streamObj){
    mystream.record(false);

  • Adobe AIR for Android - GPU Mode - Bitmap Auto-Smoothing Issue

    Hi everyone
    I'm having a bit of an issue with the AS3 bitmap object. I'm currently developing an 8-bit style pixel game for AIR for Android.
    This game is being developed at a very low resolution and is being scaled up to maintain the charm of an old retro game.
    One of the methods I'm using is drawing pixels directly to bitmap objects and scaling the object up to create the old look.
    When testing on a mobile device, this works beautifully when you set the rendering method to Direct but when you change
    the render method to GPU the visuals go all blurry and anti-aliased (it's as if the bitmap is being smoothed out). The mini map
    for example is rendered using the setPixel method and then scaled up 9 times. Looks great on my PC but once I export it to my phone
    it looks absolutely awful! This is no good as I want to keep the clean, solid pixel look to maintain the the old 8-bit feel and obviously
    I'd like to stick to GPU mode due to it's speed.
    Like I said, this only happens once you test on a mobile device in GPU mode - it doesn't do it on my main desktop machine or
    in Direct mode. I already have the stage quality set to low and I've tried setting the bitmap's smoothing property to false but
    it does nothing.
    Does anyone have any suggestions as to how I can get around this?

    How about first blit your image to a small bitmapData, then draw it on a large bitmapData (9X larger)?
    Like,
    var small_bmd:BitmapData = new BitmapData(SMALL_WIDTH, SMALL_HEIGHT, false);
    var large_bmd:BitmapData = new BitmapData(SMALL_WIDTH * 9, SMALL_HEIGHT * 9, false);
    var bm:Bitmap = new Bitmap(large_bmd, PixelSnapping.NEVER, false);
    var blitRect:Rectangle = new Rectangle(0, 0, 9, 9);
    var i:uint, j:uint, blitColor:uint;
    small_bmd.draw(SOURCE_IMAGE);
    large_bmd.lock();
    for(j = 0; j < SMALL_HEIGHT; j++){
         for(i = 0; i < SMALL_WIDTH; i++){
              blitColor = small_bmd.getPixel(i, j);
              blitRect.x = i * 9;
              blitRect.y = j * 9;
              large_bmd.fillRect(blitRect, blitColor);
    large_bmd.unlock();
    Not sure if the code works or not, but hopefully this helps.

  • Streaming Video and Bitmap Draw issues.

    Hello all,
    In the current application I'm developing, I have a custom
    video console. While watching a video, certain points in the
    timeline will pop up a dialog box that gives the user the ability
    to switch to a related video. If the user clicks the button to view
    the related video, a 3D effect flips the current "main" console to
    a secondary "branching" console - much like the flip effect the
    iPhone uses. The videos are streaming from FMS 3, the client
    application was developed in Flex, and we are using Alex Uhlmann's
    Distortion Effects to achieve the 3D flip effect.
    When I first started developing the application, I ran in to
    the infamous "Security sandbox violation: BitmapData.draw" error
    whenever I would try the flip. After some investigation on the web,
    I found that I needed to set the Client.videoSampleAccess property
    in my FMS application's main.asc to allow bitmap snapshot access. I
    did so, and that seemed to do the trick. After playing with the
    application a bit more, however, I found that the error would still
    come about if I did the following:
    1. Pause the video (stream)
    2. Perform a seek while paused.
    3. Attempt the flip effect.
    When I did the above, the error came back. If I paused,
    performed a seek, and then unpaused the video, everything worked
    fine. If I pause and then immediately do the flip without a seek,
    everything works fine.
    It seems as though when you pause and then perform a seek,
    the player forgets that it has permission to do a frame grab until
    you restart playback.
    Has anyone else had this issue, or anything similar? If so,
    how did you solve it?
    Thanks,
    --G
    (For reference, here is the actual Error that is getting
    thrown)
    SecurityError: Error #2123: Security sandbox violation:
    BitmapData.draw:
    http://localhost/Bison/trunk/BisonClient/bin/BisonClient-debug.swf
    cannot access rtmp://localhost/digitaltutors. No policy files
    granted access.
    at flash.display::BitmapData/draw()
    at
    sandy.util::DistortImage/renderVector()[C:\workspaces\flex2.0.1\AlexFlexLibrary\sandy\uti l\DistortImage.as:190]
    at
    sandy.util::DistortImage/initialize()[C:\workspaces\flex2.0.1\AlexFlexLibrary\sandy\util\ DistortImage.as:107]
    at
    com.adobe.ac.mxeffects::SimpleDistortion/initDistortImage()[C:\workspaces\flex2.0.1\AlexF lexLibrary\com\adobe\ac\mxeffects\SimpleDistortion.as:501]
    at
    com.adobe.ac.mxeffects::SimpleDistortion/renderSides()[C:\workspaces\flex2.0.1\AlexFlexLi brary\com\adobe\ac\mxeffects\SimpleDistortion.as:357]
    at
    com.adobe.ac.mxeffects::SimpleDistortion/flipFront()[C:\workspaces\flex2.0.1\AlexFlexLibr ary\com\adobe\ac\mxeffects\SimpleDistortion.as:98]
    at
    com.adobe.ac.mxeffects.effectClasses::FlipInstance/updateFront()[C:\workspaces\flex2.0.1\ AlexFlexLibrary\com\adobe\ac\mxeffects\effectClasses\FlipInstance.as:46]
    at mx.effects::Tween/
    http://www.adobe.com/2006/flex/mx/internal::doInterval()[C:\dev\flex_201_gmc\sdk\framework s\mx\effects\Tween.as:567
    at
    mx.effects::Tween$/timerHandler()[C:\dev\flex_201_gmc\sdk\frameworks\mx\effects\Tween.as: 177]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

    Hi,
    I've been searching all over for someone having the same
    problem that I am.
    I'm seeing nearly the same thing that you are. I have
    SWFVerification turned on and the swf copied over to the correct
    directory. If I stream an FLV and attempt to capture grab the
    bitmap data it works fine. Always.
    If I try the same thing with a .mov or .mp4 file it mostly
    works, but sometimes (after doing basically the same thing you've
    described in your message), I get the SecurityError. If I try again
    after a delay of a few seconds, sometimes it works. When that
    doesn't work, if I seek a 1/10th of a second ahead in the video
    then try again, it almost always works. But sometimes that, too,
    fails.
    Have you found a reliable solution to your problem? Has
    anyone else seen this issue? I would file a bug for FMS, but it
    looks like the bug-tracking system for FMS is not public. It would
    be nice for it to be public.
    regards,
    david

  • Help with Video Performance Issues using Flash

    Asking on behalf of a customer who has been unable to get any answers so far - are you able to help?
    Background:
    We have a port of our Game Development Kit which allows us to recompile all our games using Crossbridge (http://adobe-flash.github.io/crossbridge/) into SWF without any code modifications.
    Overview:
    Our framework is using OpenGL for rendering and we have successfully ported it along with the audio and video to run in Flash.
    We are experiencing performance issues using Video. We cannot use image sequence as some of the video animations are too long and would increase the download to an unacceptable size.  Assets vary between 256x256 - 1024x1024 videos.

    Here's the rest of the story.  Let me know if you can see any resolution, and I will connect him to the forums.  Thank you.
    Current Video Solution:
    We create an instance of NetConnection, NetStream, and Video according to most samples out there, and invoke draw to rasterize the Video DisplayObject into a BitmapData instance.
    The BitmapData instance has a fixed color component layout which is not compatible with Stage3D texture and is therefore has to be reformatted before uploaded to Stage3D Texture (See Code Listing below).
    Our Problems:
    Performance issues with RGBA conversion (either using copyChannel or manually reformatting is not fast enough) natively in as3; this required for stage3d texture.Copying each channel individual using bitmapdata.Copychannel seems faster, but not significantly faster.
    Cannot detect when video frame has been updated, therefore we may copy pixels that are not needed in enterframe (processpixel).
    Looping video, our current solution uses the NET_STATUS event Buffer empty; Is there a better way to loop videos than checking buffer and seeking to 0.
    Stepping video, loading FLV or MP4 side by side assets from HTTP or embedded does not support stepping? Is there another way?
    ActionScript Code Listing:
    video_nc = new NetConnection();
    video_nc.addEventListener(NetStatusEvent.NET_STATUS , onConnect);
    video_nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR , trace);
    video_nc.connect(null);
    // OnConnect Event:
    this.ns = new NetStream(e.target as NetConnection);
    eventclient = new Object();
    eventclient.onMetaData = onMetaData;
    this.ns.client = eventclient;
    ns.play(flvfile);
    ns.pause();
    //onMetaData event:
    this.width = infoObject.width;
    this.height = infoObject.height;
    this.textureWidth = NextPowerOfTwo(this.width);
    this.textureHeight = NextPowerOfTwo(this.height);
    cliprect = new Rectangle(0, 0, this.width ,this.height);
    cliprect.x = 0;
    cliprect.y = 0;
    cliprect.width = this.textureWidth;
    cliprect.height = this.textureHeight;
    totalFrames = infoObject.duration * infoObject.fps;
    this.hasAlpha = true;
    if(infoObject.videocodecid == 5)
    this.hasAlpha = true;
    this.bitmapData = new BitmapData(this.textureWidth, this.textureHeight, hasAlpha, 0xff000000);
    this.video = new Video(this.width, this.height);
    this.video.attachNetStream(ns);
    this.video.addEventListener(Event.ENTER_FRAME, processPixels);
    // processPixel method:
    BitmapData.draw(video);
    GLAPI.instance.glBindTexture(GLAPI.GL_TEXTURE_2D,this.textureId);
    var fmt:uint = GLAPI.GL_ARGB;
    // converting pixels using copychannel or loop through pixels
    GLAPI.instance.glBindTexture(GLAPI.GL_TEXTURE_2D,this.textureId);
    GLAPI.instance.glTexImage2D(GLAPI.GL_TEXTURE_2D, 0, fmt, this.textureWidth, this.textureHeight, 0,fmt, GLAPI.GL_UNSIGNED_BYTE, 0, convBitmapData.getPixels(cliprect));

  • Image Transperancy in bitmapData

    Folloing are the excerpts of my code in AS2:
    I have image1 as and image2 on my stage. The image2 is a
    transparent GIF and works good transparantly when moved, roatated
    etc. this image2 is merged over image1 on a button click instance.
    Problem with the source is that as soon as the image is
    merged it (image2) looses its transparancy and converted to opaque
    again. How to resolve this issue?

    thanks roth! u people are really great, how and where from do
    u learn all this?
    One more problem,
    JPG is loaded in my MC, I resized it on rollover to fit on my
    required diameter, but when i merge this resized MC/JPG using
    BitmapData, the MC does not change but the jpg takes back its
    original size which caused trimmed graphic to display on merged
    image. I know i am doing something wrong but what and where i dont
    know. pl help

  • 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.

  • Can't use memory allocated in C to write then read BitmapData in AS

    Hi all,
    I've been attempting to use Alchemy to allocate a chunk of memory in C, and then write a bitmap to the memory (via getPixels) which is I would then be able to modify using my super fast C image processing functions.  I've been following the "Memory allocation in C with direct access in Actionscript (FAST!!)" section from here.
    The problem is that when I allocate the memory in C, then try to display the image using setImage, all I see is a black box on the screen.  The code below shows how I use getPixels to fill the C memory region with my bitmap data, then use setPixels to fill the BitmapData object which is displayed on the screen.  Does anyone know what I'm doing wrong here?  I've been really stuck on this
    ActionScript variables, and event function which runs after my Bitmap is loaded
            private var _dataPosition:uint;
            private var displayedImage:Image;
            private var bmp:Bitmap;
    public function loaded(e:Event):void {
                bmp = e.target.content as Bitmap;
                // A setImage at the beggining of this function properly displays my image
                displayedImage.setImage(bmp.bitmapData);
                var loader:CLibInit = new CLibInit();
                var lib:Object = loader.init();
                var ns:Namespace = new Namespace("cmodule.alchemyrgr");
                var byteArray:ByteArray = (ns::gstate).ds; //point to memory
                var tmpByteArray:ByteArray = new ByteArray();
                var imgSize:int = bmp.width * bmp.height * 4;
                _dataPosition = lib.initByteArray(imgSize); //This is the position of the data in memory           
                var bounds:Rectangle = new Rectangle(0, 0, bmp.width, bmp.height);
                tmpByteArray = bmp.bitmapData.getPixels(bounds);
                byteArray.readBytes(tmpByteArray, 0, imgSize);
                byteArray.position = _dataPosition;
                bmp.bitmapData.setPixels(bounds, byteArray);
                displayedImage.setImage(bmp.bitmapData);
                //lib.clearByteArray(); //Free the bytearray
    C memory allocation function
    static AS3_Val initByteArray(void* self, AS3_Val args)
        AS3_ArrayValue(args, "IntType", &bufferSize);
        //Allocate buffer of size "bufferSize"
        buffer = (unsigned char*)malloc(bufferSize*sizeof(char));
        //return pointer to the location in memory
        return AS3_Int((int)buffer);
    Thanks in advance!
    Mark

    Hi Mark,
    I too attempted to use a method similar to yours to no avail. I posted my solution for passing bytearray data to/from alchemy here:
    http://forums.adobe.com/thread/773517?tstart=0
    There is full flash code and C++ code so you should be able to answer all your questions just by reading my post. However, one thing I see about how you're passing your pointer back to flash is:
        //return pointer to the location in memory
        return AS3_Int((int)buffer);
    I think should be:
        //return pointer to the location in memory
        return AS3_Ptr(buffer);
    You shouldn't be casting your char array as an int and returning it, just use AS3_Ptr(buffer) and that will return the actual memory address as an int to flash. I'm not 100% sure but I think this could be an issue. I use this method also in my code you can find in the link above so you can see the full implementation there. Hope that helps.

  • Inline functions in C, gcc optimization and floating point arithmetic issues

    For several days I really have become a fan of Alchemy. But after intensive testing I have found several issues which I'd like to solve but I can't without any help.
    So...I'm porting an old game console emulator written by me in ANSI C. The code is working on both gcc and VisualStudio without any modification or crosscompile macros. The only platform code is the audio and video output which is out of scope, because I have ported audio and video witin AS3.
    Here are the issues:
    1. Inline functions - Having only a single inline function makes the code working incorrectly (although not crashing) even if any optimization is enabled or not (-O0 or O3). My current workarround is converting the inline functions to macros which achieves the same effect. Any ideas why inline functions break the code?
    2. Compiler optimizations - well, my project consists of many C files one of which is called flash.c and it contains the main and exported functions. I build the project as follows:
    gcc -c flash.c -O0 -o flash.o     //Please note the -O0 option!!!
    gcc -c file1.c -O3 -o file1.o
    gcc -c file2.c -O3 -o file2.o
    ... and so on
    gcc *.o -swc -O0 -o emu.swc   //Please note the -O0 option again!!!
    mxmlc.exe -library-path+=emu.swc --target-player=10.0.0 Emu.as
    or file in $( ls *.o ) //Removes the obj files
        do
            rm $file
        done
    If I define any option different from -O0 in gcc -c flash.c -O0 -o flash.o the program stops working correctly exactly as in the inline funtions code (but still does not crash or prints any errors in debug). flash has 4 static functions to be exported to AS3 and the main function. Do you know why?
    If I define any option different from -O0 in gcc *.o -swc -O0 -o emu.swc  the program stops working correctly exactly as above, but if I specify -O1, -O2 or O3 the SWC file gets smaller up to 2x for O3. Why? Is there a method to optimize all the obj files except flash.o because I suspect a similar issue as when compilling it?
    3. Flating point issues - this is the worst one. My code is mainly based on integer arithmetic but on 1-2 places it requires flating point arithmetic. One of them is the conversion of 16-bit 44.1 Khz sound buffer to a float buffer with same sample rate but with samples in the range from -1.0 to 1.0.
    My code:
    void audio_prepare_as()
        uint32 i;
        for(i=0;i<audioSamples;i+=2)
            audiobuffer[i] = (float)snd.buffer[i]/32768;
            audiobuffer[i+1] = (float)snd.buffer[i+1]/32768;
    My audio playback is working perfectly. But not if using the above conversion and I have inspected the float numbers - all incorrect and invalid. I tried other code with simple floats - same story. As if alchemy refuses to work with floats. What is wrong? I have another lace whre I must resize the framebuffer and there I have a float involved - same crap. Please help me?
    Found the floating point problem: audiobuffer is written to a ByteArray and then used in AS. But C floats are obviously not the same as those in AS3. Now the floating point is resolved.
    The optimization issues remain! I really need to speed up my code.
    Thank you in advice!

    Dear Bernd,
    I am still unable to run the optimizations and turn on the inline functions. None of the inline functions contain any stdli function just pure asignments, reads, simple arithmetic and bitwise operations.
    In fact, the file containing the main function and those functions for export in AS3 did have memset and memcpy. I tried your suggestion and put the code above the functions calling memset and memcpy. It did not work soe I put the code in a header which is included topmost in each C file. The only system header I use is malloc.h and it is included topmost. In other C file I use pow, sin and log10 from math.h but I removed it and made the same thing:
    //shared.h
    #ifndef _SHARED_H_
    #define _SHARED_H_
    #include <malloc.h>
    static void * custom_memmove( void * destination, const void * source, unsigned int num ) {
      void *result; 
      __asm__("%0 memmove(%1, %2, %3)\n" : "=r"(result) : "r"(destination), "r"(source), "r"(num)); 
      return result; 
    static void * custom_memcpy ( void * destination, const void * source, unsigned int num ) { 
      void *result; 
      __asm__("%0 memcpy(%1, %2, %3)\n" : "=r"(result) : "r"(destination), "r"(source), "r"(num)); 
      return result; 
    static void * custom_memset ( void * ptr, int value, unsigned int num ) { 
      void *result; 
      __asm__("%0 memset(%1, %2, %3)\n" : "=r"(result) : "r"(ptr), "r"(value), "r"(num)); 
      return result; 
    static float custom_pow(float x, int y) {
        float result;
      __asm__("%0 pow(%1, %2)\n" : "=r"(result) : "r"(x), "r"(y));
      return result;
    static double custom_sin(double x) {
        double result;
      __asm__("%0 sin(%1)\n" : "=r"(result) : "r"(x));
      return result;
    static double custom_log10(double x) {
        double result;
      __asm__("%0 log10(%1)\n" : "=r"(result) : "r"(x));
      return result;
    #define memmove custom_memmove
    #define memcpy custom_memcpy
    #define memset custom_memset
    #define pow custom_pow
    #define sin custom_sin
    #define log10 custom_log10 
    #include "types.h"
    #include "macros.h"
    #include "m68k.h"
    #include "z80.h"
    #include "genesis.h"
    #include "vdp.h"
    #include "render.h"
    #include "mem68k.h"
    #include "memz80.h"
    #include "membnk.h"
    #include "memvdp.h"
    #include "system.h"
    #include "loadrom.h"
    #include "input.h"
    #include "io.h"
    #include "sound.h"
    #include "fm.h"
    #include "sn76496.h" 
    #endif /* _SHARED_H_ */ 
    It still behave the same way as if nothing was changed (works incorrectly - displays jerk which does not move, whereby the image is supposed to move)
    As I am porting an emulator (Sega Mega Drive) I use manu arrays of function pointers for implementing the opcodes of the CPU's. Could this be an issue?
    I did a workaround for the floating point problem but processing is very slow so I hear only bzzt bzzt but this is for now out of scope. The emulator compiled with gcc runs at 300 fps on a 1.3 GHz machine, whereby my non optimized AVM2 code compiled by alchemy produces 14 fps. The pure rendering is super fast and the problem lies in the computational power of AVM. The frame buffer and the enulation are generated in the C code and only the pixels are copied to AS3, where they are plotted in a BitmapData. On 2.0 GHz Dual core I achieved only 21 fps. Goal is 60 fps to have smooth audio and video. But this is offtopic. After all everything works (slow) without optimization, and I would somehow turn it on. Suggestions?
    Here is the file with the main function:
    #include "shared.h"
    #include "AS3.h"
    #define FRAMEBUFFER_LENGTH    (320*240*4)
    static uint8* framebuffer;
    static uint32  audioSamples;
    AS3_Val sega_rom(void* self, AS3_Val args)
        int size, offset, i;
        uint8 hardware;
        uint8 country;
        uint8 header[0x200];
        uint8 *ptr;
        AS3_Val length;
        AS3_Val ba;
        AS3_ArrayValue(args, "AS3ValType", &ba);
        country = 0;
        offset = 0;
        length = AS3_GetS(ba, "length");
        size = AS3_IntValue(length);
        ptr = (uint8*)malloc(size);
        AS3_SetS(ba, "position", AS3_Int(0));
        AS3_ByteArray_readBytes(ptr, ba, size);
        //FILE* f = fopen("boris_dump.bin", "wb");
        //fwrite(ptr, size, 1, f);
        //fclose(f);
        if((size / 512) & 1)
            size -= 512;
            offset += 512;
            memcpy(header, ptr, 512);
            for(i = 0; i < (size / 0x4000); i += 1)
                deinterleave_block(ptr + offset + (i * 0x4000));
        memset(cart_rom, 0, 0x400000);
        if(size > 0x400000) size = 0x400000;
        memcpy(cart_rom, ptr + offset, size);
        /* Free allocated file data */
        free(ptr);
        hardware = 0;
        for (i = 0x1f0; i < 0x1ff; i++)
            switch (cart_rom[i]) {
         case 'U':
             hardware |= 4;
             break;
         case 'J':
             hardware |= 1;
             break;
         case 'E':
             hardware |= 8;
             break;
        if (cart_rom[0x1f0] >= '1' && cart_rom[0x1f0] <= '9') {
            hardware = cart_rom[0x1f0] - '0';
        } else if (cart_rom[0x1f0] >= 'A' && cart_rom[0x1f0] <= 'F') {
            hardware = cart_rom[0x1f0] - 'A' + 10;
        if (country) hardware=country; //simple autodetect override
        //From PicoDrive
        if (hardware&8)        
            hw=0xc0; vdp_pal=1;
        } // Europe
        else if (hardware&4)    
            hw=0x80; vdp_pal=0;
        } // USA
        else if (hardware&2)    
            hw=0x40; vdp_pal=1;
        } // Japan PAL
        else if (hardware&1)      
            hw=0x00; vdp_pal=0;
        } // Japan NTSC
        else
            hw=0x80; // USA
        if (vdp_pal) {
            vdp_rate = 50;
            lines_per_frame = 312;
        } else {
            vdp_rate = 60;
            lines_per_frame = 262;
        /*SRAM*/   
        if(cart_rom[0x1b1] == 'A' && cart_rom[0x1b0] == 'R')
            save_start = cart_rom[0x1b4] << 24 | cart_rom[0x1b5] << 16 |
                cart_rom[0x1b6] << 8  | cart_rom[0x1b7] << 0;
            save_len = cart_rom[0x1b8] << 24 | cart_rom[0x1b9] << 16 |
                cart_rom[0x1ba] << 8  | cart_rom[0x1bb] << 0;
            // Make sure start is even, end is odd, for alignment
            // A ROM that I came across had the start and end bytes of
            // the save ram the same and wouldn't work.  Fix this as seen
            // fit, I know it could probably use some work. [PKH]
            if(save_start != save_len)
                if(save_start & 1) --save_start;
                if(!(save_len & 1)) ++save_len;
                save_len -= (save_start - 1);
                saveram = (unsigned char*)malloc(save_len);
                // If save RAM does not overlap main ROM, set it active by default since
                // a few games can't manage to properly switch it on/off.
                if(save_start >= (unsigned)size)
                    save_active = 1;
            else
                save_start = save_len = 0;
                saveram = NULL;
        else
            save_start = save_len = 0;
            saveram = NULL;
        return AS3_Int(0);
    AS3_Val sega_init(void* self, AS3_Val args)
        system_init();
        audioSamples = (44100 / vdp_rate)*2;
        framebuffer = (uint8*)malloc(FRAMEBUFFER_LENGTH);
        return AS3_Int(vdp_rate);
    AS3_Val sega_reset(void* self, AS3_Val args)
        system_reset();
        return AS3_Int(0);
    AS3_Val sega_frame(void* self, AS3_Val args)
        uint32 width;
        uint32 height;
        uint32 x, y;
        uint32 di, si, r;
        uint16 p;
        AS3_Val fb_ba;
        AS3_ArrayValue(args, "AS3ValType", &fb_ba);
        system_frame(0);
        AS3_SetS(fb_ba, "position", AS3_Int(0));
        width = (reg[12] & 1) ? 320 : 256;
        height = (reg[1] & 8) ? 240 : 224;
        for(y=0;y<240;y++)
            for(x=0;x<320;x++)
                di = 1280*y + x<<2;
                si = (y << 10) + ((x + bitmap.viewport.x) << 1);
                p = *((uint16*)(bitmap.data + si));
                framebuffer[di + 3] = (uint8)((p & 0x1f) << 3);
                framebuffer[di + 2] = (uint8)(((p >> 5) & 0x1f) << 3);
                framebuffer[di + 1] = (uint8)(((p >> 10) & 0x1f) << 3);
        AS3_ByteArray_writeBytes(fb_ba, framebuffer, FRAMEBUFFER_LENGTH);
        AS3_SetS(fb_ba, "position", AS3_Int(0));
        r = (width << 16) | height;
        return AS3_Int(r);
    AS3_Val sega_audio(void* self, AS3_Val args)
        AS3_Val ab_ba;
        AS3_ArrayValue(args, "AS3ValType", &ab_ba);
        AS3_SetS(ab_ba, "position", AS3_Int(0));
        AS3_ByteArray_writeBytes(ab_ba, snd.buffer, audioSamples*sizeof(int16));
        AS3_SetS(ab_ba, "position", AS3_Int(0));
        return AS3_Int(0);
    int main()
        AS3_Val romMethod = AS3_Function(NULL, sega_rom);
        AS3_Val initMethod = AS3_Function(NULL, sega_init);
        AS3_Val resetMethod = AS3_Function(NULL, sega_reset);
        AS3_Val frameMethod = AS3_Function(NULL, sega_frame);
        AS3_Val audioMethod = AS3_Function(NULL, sega_audio);
        // construct an object that holds references to the functions
        AS3_Val result = AS3_Object("sega_rom: AS3ValType, sega_init: AS3ValType, sega_reset: AS3ValType, sega_frame: AS3ValType, sega_audio: AS3ValType",
            romMethod, initMethod, resetMethod, frameMethod, audioMethod);
        // Release
        AS3_Release(romMethod);
        AS3_Release(initMethod);
        AS3_Release(resetMethod);
        AS3_Release(frameMethod);
        AS3_Release(audioMethod);
        // notify that we initialized -- THIS DOES NOT RETURN!
        AS3_LibInit(result);
        // should never get here!
        return 0;

  • PNG transparency lost using event.target.loader.content.bitmapData

    I load a png 24 (tripple checked alpha is ok)
    override public function loadData():void
         var request:URLRequest = new URLRequest(url);
         var loader = new Loader();
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageloadedSuccess);
         loader.load(request);
    public function imageloadedSuccess(e:Event):void
         showPNG(e.target.loader.content.bitmapData);
    in Air 1.5 png (e.target.loader.content.bitmapData) has no transparency
    same code using Flash 10 export transparency is there.
    both of course loading same png file.
    Is this a known issue?
    I haven't tried yet using 2.0
    is there a workarround to load external png and keep the transparency?
    thx by advance
    Fabrice

    for each loader created, create a movieclip and add your loader to the movieclip.  assign all the properties you want to retrieve later to the movieclip and assign your event listeners to the movieclip.

  • Cross domain policy file and BitmapData

    Hey guys and gals, I'm having an issue with a Security error
    when trying to access photos from an external site. I have a client
    who is at siteA.com, who wants to load in photos from siteB.com,
    siteC.com, and probably 100 other sites. He has permission to do so
    from the other sites, but doesn't want to go through all the
    trouble of asking each site to post a cross-domain policy file.
    Please correct me if I'm wrong, but the way I understand it is, if
    you want to simply load an image into a Loader object within a swf,
    you're ok, but if you want to access the BitmapData, you will then
    get a security error? My snippet of code that I believe is causing
    the security error is
    public function imageLoaded(e:Event):void {
    var image:Bitmap = Bitmap(e.target.loader.content);
    image.smoothing = true;
    imageContainer.addChild(e.target.loader);
    As you can tell, the reason why I want to access the Bitmap
    itself is to apply smoothing. That is my main concern, I want to be
    able to apply smooth transitions to these pictures that are loaded
    in from external sites. My main goal is to load images externally,
    then apply smooth transitions, so if you know of a way to get
    around the security violations, that would be great. The only
    work-around we have for this is to write a script that will load
    all the images from the external sites onto the local server, as
    this will be less work than getting the cross-domain policy file on
    each server (if that's what it takes). Thanks in advance for
    anybody who can shed some light on the subject.

    If I understand you correctly, a 'helper' swf would be on the
    site where the images are held, much like a cross-domain policy
    file? I don't understand how that would be much different than
    getting the external sites to add a cross-domain policy file on
    their server. It sounds easier to just throw the cross-domain
    policy file on the external site's server with '*' for the path of
    allowed directories to load images from. I'm pretty new to the
    cross-domain security issue, so I'm not sure. I don't understand
    why it's a security risk to access the pixels of an image either...
    anybody know about that? Just trying to figure out where to go from
    here on this project. Thanks for the reply GWD, still looking for
    some more feedback.

  • UIComponent - Remove All BitmapData

    Hey,
    I'm using a cool flex component developed by Ely Greenfield called DisplayShelf. The compnent is used to display images in a fashion similar to the iTunes coverflow component - http://www.quietlyscheming.com/blog/components/tutorial-displayshelf-component/. This DisplayShelf component extends UIComponent.
    When I load more and more images into the DisplayShelf the performance begins to suffer, which I believe is due to the number of bitmap objects which are drawn as each image is added.
    My question is:
    Is there a way to completely remove all bitmap data from a UIComponent using the standard bitmapData.dispose() method or failing that is it possible to simply delete all UIComponent children from memory i.e. not to use removeAllChildren which still keeps them in memory?
    Thanks
    Adam
    Flexchief

    Hi Alexander,
    Thanks a lot for your reply.
    I've found that by setting up a small loop to remove any children from the UIComponent and then loading additional images thereafter, I can improve the performance of the component hugely. Could this be because GC is grabbing the unreferenced children once they have been removed?
    In relation to your two suggestions: - Yep I've got all the related objects weak referenced as you mentioned but to be honest I was unsure about forcing GC invocation manually, partly because I really wasn't all that sure on how to do it, and because I had read some place that this was not really very good practice and could possibly cause some unwanted CPU processing issues?

Maybe you are looking for

  • Quantity is not coming in output delivery docuemnt VL71

    Hi Gurus, We have created delivery docuemnt VL01n in that batch split exist indicator is there for the line item. When I print the delivery document quantity of the items shows 0 Kindly suggest why this quantity is not coming in VL71 docuemnt Thanks

  • IllegalArgumentException error while exporting report in PDF format

    Hi all, we are using Crystal Report 2008, Java 1.5.22 and JRC 11.8.4.1094 to export reports in pdf format within java. It is working fine for all reports except for a specific report where it gives IllegalArgumentException while exporting the PDF. Be

  • Various questions on SAP XI usage

    Hi XI Experts, I have few questions on SAP XI usage : Q1-Does SAP XI is unique - client like BW ? If multi - clients is possible is there any particular usage recommandations when in design, configuration and production deploiement on PRD SAP XI Syst

  • How do I Apply a Gradient to an Existing Mask?

    I  have a levels layer created from a selection.  Photoshop  uses a mask to protect/exclude the unselected area on the adjustment layer.  Now I need to add a gradient to that same mask.  But, when I try to add the gradient it throws away the original

  • How to use jquery plugin jResponsive, please help!!

    Hello, Can someone show me how to integrate JResponsive plugin into Edge Animate with an example? Here is the link to Jresponsive website: Jresponsive Thank you.