ParallelElement, BitmapData and SecurityError

Hi all,
I've been trying to do something and I think I might be making it harder than it actually is, so I thought I'd ask.
I have a ParallelElement that loads 2 videos, this ParallelElement is about 600 * 480 pixels.
After that I add a Bitmap instance that displays one of the two videos on top of that, and it's size is about 200 * 150 pixels. I'm doing this because I want the user to be able to be able to drag and move the "Bitmap" with his mouse, I'm pretty sure I could do this with OSMF but I haven't found how and this was the workaround I used.
However, since I'm often loading videos from different domains, when I call the BitmapData.draw method to render my video in that Bitmap, I get security errors. I using a crossdomain file on the server that allows those domains, In my main app, I call
Security.allowDomain(
    "mydomain.com",
    "theirdomain.com",
    "foobar.theirdomain.com",
    "anotherdomain.org"
Security.loadPolicyFile("http://mydomain.com/crossdomain.xml");
The Security Error tells me that the checkPolicyFile hasn't been set in my code, but the thing is, no where in my code am I using a "Loader" (at least a flash.display.Loader) I'm just using a BitmapData instance that draws the 'video' in my ParallelElement to render the Bitmap ...
Thanks for your help
Julien    

Hi Brian,
Actually after searching a bit, I found that setting the NetStream.checkPolicyFile to true (in a  NetLoader subclass) fixed the issue but thanks again
Cheers,
Julien

Similar Messages

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

  • BitmapData.draw() SecurityError: Security sandbox violation

    i am loading and playing a local video file with appendBytes() and when i call a bitmapData.draw() function
    below exception comes up.
    SecurityError: Error #2123: Security sandbox violation: BitmapData.draw
    cannot access null. No policy files granted access.
    what should i do???....

    Sir i already mention in my last message i test it with both relative and absolute.
    Yes i khow relative paths works fine when i do some thing like this
    <mx:VideoDisplay x="0" y="0" width="516" height="379" source="../user_data/uploads/cd73502828457d15655bbd7a63fb0bc8/v/1345023450-Action_.flv"/>
    bitmap.draw works fine in above case but my scenario is different i am loading a complete video as bytearray before playing and play video from that bytes
    private function fileLoaderComplete(event:Event):void
         //Pass the loaded bytes to player
           player.AddVideo(urlLoader.data);
    //This is Add video Function in Player.mxml
    public function AddVideo(VideobyteArray:ByteArray):void
                    if(ns == null)
                        var nc:NetConnection = new NetConnection();
                        nc.connect(null);
                        ns = new NetStream(nc);
                       // ns.checkPolicyFile = true;
                        ns.soundTransform = new SoundTransform(0.0);
                        ns.client = this;
                        ns.addEventListener(NetStatusEvent.NET_STATUS, nsStatus);
                    videoData = VideobyteArray;
                    GetTags(videoData);
                    ns.play(null);
                    ns.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
                    ns.appendBytes(VideobyteArray);
                    video.attachNetStream(ns);
                    playBar.TogglePlay(true);
    i think its a bug in flash sdk 4.6 (Flash Player 11)
    bitmap.draw function somehow conflicts with the appendBytesAction or appendBytes
    this question is posted  on ActionScript 3.0 forum before
    http://forums.adobe.com/message/4650890#4650890
    http://flash.bigresource.com/flash-use-BitmapData-draw-with-NetStream-appendBytes--iTNz6LV JM.html
    http://stackoverflow.com/questions/5607047/how-can-i-use-bitmapdata-draw-with-netstream-ap pendbytes

  • BitmapData and Colorizing images

    I have a grasp on the bitmapData API and how it's used, but
    I'm trying to figure out how to dynamically colorize an external
    image (loaded into a MC) at run-time.
    For instance, I have an image of a white flower with the
    background removed. I'd like to be able to have it fade from white
    (the original color) to a pre-defined Red, then Green, Blue, etc.,
    and preferrably even let the user choose from a palette of colors
    (i.e. they may or may not be known at run-time).
    Any programmatic approaches to this? TIA for any advice.
    Ciao,
    -Jei.

    It is not really necessary to store them in the Gallery, you can just put them where you want and point to them using the folder icon that appears next to Image Button when you choose that type. Pointing to one out of the 3 images is sufficient, if the 3 images are in the same folder and have the correct names   xxxxx_up, xxxxx_down, xxxxx_over  (xxxx is the name of your choice, do not make it too long or you'll have issues with the width of the dropdown list).
    I'm a bit wondering about the subject line and your sentence '... one can use an image I created in PS'.... If you are using Captivate 6 another way is to use a shape that can be converted to a button and fill the shape with the image. Difference with normal buttons is that you only have two states (automatically, you do not need to create two images): up and pressed.
    Lilybiri

  • BitmapData and transparency problem

    I'm using the draw Method to "clone" a Movieclip content into
    a bitmap image with:
    mybitmap .draw(movieClipToCopy);
    This works well, however, the transparent areas of the
    movieclip turn into white pixels in the resulting bitmap image.
    ¿Is there anyway that allow me to keep transparent areas
    in the clip as transparent pixels in the new bitmap? (as PNG24,PNG8
    or GIF formats do)?
    Thanks a lot

    When you create the BitmapData, set the third parameter to
    true, for transparency.

  • ParallelElement (containing VideoElement and SerialElement) cannot seek

    Hello,
    I've built a small test player to test out ParallelElement's, and have run into a problem with VideoElement's and SerialElements.
    My SerialElement contains several DurationElement's with ImageElement's. Unfortuneately, I am unable to seek this ParallelElement. It appears that when paused, the DurationElement's current time is also reset to 0. I've noticed some other anomalies with these elements (ie. elements being skipped over in the serial element).
    I have not found a workaround for this yet, and will likely need to create a seperate video file for my secondary element (which seeks fine in a ParallelElement).
    Is there something I'm missing in regards to how the serial element should be built to allow seeking? (ie. Duration element wrapping the serial element?)
    I have attached the code, including test elements, that I have at this point. (Clicking the display will build the elements and start playing. Shift click pauses.)
    EDIT:
    There's no reason why I can't do this with cue points and a seperate proxy element, so I may go this route instead. Though, I'm still interested to know why these two elements aren't seeking (would remove some complexity in my application)

    I believe you've run into this bug:
    https://bugs.adobe.com/jira/browse/FM-329
    Can you verify?

  • Remote actionscript call and get bitmapdata result

    Hello,
    I'm using flash aplication to generate (in real time) complecated Bitmap  / BitmapData, and then I would like to give result to web user. How to  run this process without putting whole application to swf file  (which  can be decompiled) over the internet, but giving to user only result  image?
    How to make flash aplication server-side? Can it be done using only adobe technology?

    data: bdc_itab type table of bdcdata.
    set parameter id 'MAT' field '1300318301Z' .
    set parameter id 'WRK' field 'NP01'.
    set parameter id 'KRT' field 'ZPC2'.
    bdc_itab-dynpro = '300'.
    bdc_tab-dynbegin = 'X'.
    BDC_itab-progname = (give the dialog program name).
    append bdc_itab.
    call transaction 'CK86_99' using bdc_itab AND SKIP FIRST SCREEN  mode 'N'.

  • BitmapData, get/setPixel on scaled data. Real get/setPixel exist?

    Ok... I've been staring at this all day long, so the answer might be screaming at me and I just don't see it....
    Summary:  I need an Image to "show through" to the background, cutting through any other images that may be in it's way -- but not images on top of it (only below).
    [Edit: Is there an on-screen get/setPixel alternative?  As it seems BitmapData's only let's you edit the raw (un-transformed) data.  I'd like to just write the actual pixels on the screen.  There has to be something that keeps track of all the pixels when the item is scaled.  ]
    A picture is worth a thousand words, so I whipped up some examples in PS:
    Imagine this is the app that consists of four Images.  The background (skyline), and the three layers stacked on top.  The smiley is the backmost, the heart is the frontmost, and the snowman is in the middle.
    Notice how the snowman knocks out the smiley, but not the heart.  I'm achieving this by painting BitmapData with the background pixels wherever the clipart is not transparent. Also, if there was an additional layer (or any number of layers) "behind" the smiley, it would also be "knocked out" by the snowman.  This is why I'm pretty sure I have to do it this way with the BitmapData and manual get/setPixel. (Open to suggestions?)
    This method does work perfectly... as long as the snowman isn't scaled or rotated.
    Here, the snowman has been scaled up and rotated.  The problem is that the background image pixels get scaled up right along with the art. The outline of the snowman should only be visible when it knocks out the smiley, but instead you can see it clearly because the background pixels do not match, and are actually scaled/rotated along with the snowman.
    This is how it should look even with the scaling and rotating.
    Here is the code that is doing the "reverse mask":
    this == Image
    var thisWidth:uint      = this.width;
    var thisHeight:uint      = this.height;
    var targetWidth:uint      = this.x + thisWidth;
    var targetHeight:uint      = this.y + thisHeight;
    var data:BitmapData = Bitmap(backgroundImage.content).bitmapData;
    var newdata:BitmapData = new BitmapData(thisWidth, thisHeight, true, 0);
    newdata.draw(this);
    this.content.visible = false;
    newdata.lock();
    for ( var x:uint = this.x, drawX:uint=0; x < targetWidth; x++,drawX++ ) {
         for ( var y:uint = this.y, drawY:uint=0; y < targetHeight; y++,drawY++ ) {
              color = data.getPixel(x, y);
              newdata.setPixel( drawX, drawY, color );
    newdata.unlock();
    this.addChild( new Bitmap(newdata) );
    Anyone have any suggestions?
    My current direction is....
    1)  Is there a way to rasterize a transformed layer?  By that I mean make the current transformation permanent.  So, if an image was scale(1.5, 2)  you could function rasterize(image) and it would still stay scaled, but have scale(1, 1)
    2) Do the calculations to figure out the inverse matrix and apply it to the bitmapdata before adding it as a child of the image.  This way, when the background pixels get scaled/rotated, they will end up in the right place.
    3) Give up, quit my job, buy a sailboat and a lifetime supply of rum.

    Winston, don't know how I missed this earlier, but in case you're still looking for some kind of insight, here's what I would suggest:
    Keep your movies as .mov files, do not use .mp4
    For 4:3 moves, use 768x576 or 720x540 as your size
    For 16:9 movies, resize your movies to 1024x576 or 720x404
    (Exactly what you use is more about how large you want your file sizes to be)
    I know you've attempted very similar steps under the MPEG-4 options, but have you tried this:
    Open Movie in QuickTime Pro
    Press Command-E to bring up the Export dialog
    Under Export: leave as Movie To QuickTime Movie but press the Options... buttons
    In the Video pane, select the Settings... button, then set:
       Compression Type: H.264
       Frame Rate: Current
       Key Frames: Automatic
       Frame Reordering should be checked (this is crucial)
       Data Rate: Restrict to 3500 kbits/sec
       Optimized for Download
       Under Encoding, make sure Best Quality (Multi-Pass) is selected
       ... then click OK to exit this Compression Settings dialog
    Now, back in the Movie Settings dialog, select Size and adjust that accordingly. (If you're using QT 7.1 or later, you can select whether or not you'd like to Deinterlace your video as well in this dialog. If you're restricting your use of these files to your computer via Front Row, you just might want to deinterlace DV-sourced material.) Then click OK.
    Back in the Movie Settings dialog, deselect the Prepare for Internet Streaming option, then click OK to jump back to the QT Export dialog
    Export your file (this is not a speedy process)
    Or were you doing .mp4 files because .mov files weren't working out for you?
    Dual 1.42 G4, 2GB RAM, 9800 Pro, 20" Cinema;   Mac OS X (10.4.6)   Final Cut Studio 5.1

  • How to proper resize images and videos at runtime without losing quality?

    Hi guys. I need a bit of help here.
    I've built a flash site in which i want to resize a movie to the stage. I do it by keeping the proportion, thus i only resize the width and then i resize the height acordingly to the new width but keeping the proportion.
    The problem is that my film still looks "pixeled".
    I found a website on which the stage resizes dinamically with the movie and the background images without either of them losing quality. Till now i knew that resizing images or videos in flash at authoring or runtime produces pixeled results.
    This is the website: http://kampanjeweb.apt.no/jotun/romforrom/. Can someone tell me how do they do it without losing quality? just make the browser windowed and resize the margins to see the effect.
    Thanks.

    Hello, Venian.
    About the video, you could try setting the flash.media.Video's smoothing property to TRUE. This should keep a quality, but you can do nothing if the video has a poor quality. You need a great video.
    About the images, you you need to redraw the image each time you resize it. To achieve it, use a combination of Bitmap, BitmapData and Matrix classes. Any doubt, just call again. Here is a simple example:
    var scale:Number = .5;
    var highQualitySourceImage:Bitmap = ...your image...;
    var scaleMatrix:Matrix = new Matrix();
         scaleMatrix.scale(scale, scale);
    var bitmapData:BitmapData = new BitmapData( scale*highQualitySourceImage.width, scale*highQualitySourceImage.height);
         bitmapData.draw(highQualitySourceImage, scaleMatrix);
    var finalBitmap:Bitmap = new Bitmap(bitmapData);
    addChild( finalBitmap );
    Cheers,
    CaioToOn!

  • Invalid BitmapData Error #2015

    I'm getting an Invalid BitmapData Error #2015 at
    flash.display::BitmapData$iinit() that points to the line
    of code below where a BitmapData object is created.
    I am using this function to create only a few hundred
    Item objects, each of which is only 166 px by 96 px in
    size so I don't believe that the problem has to do with
    running out of memory. I also used system.totalMemory
    to trace memory consumption but it showed that only
    a few tens of megabytes were used when the error occurred.
    I have tried setting the BitmapData and Bitmap
    objects to null because that was a solution I found on another
    site. That didn't work. I tried dispose(). The error
    occurs intermittently, sometimes after running my app a few
    times and sometimes when I first load it. I am not
    refreshing my browser over and over in order to run the app.
    I cannot figure out the exact sequence of events that
    leads to this error. In earlier versions of my app, I was able to
    successfully use the exact same function (minus
    the lines where the BitmapData and Bitmap objects are set to
    null). I am not an expert at Actionscript, so perhaps
    I'm doing something wrong. Please help me out. Thanks.
              public function cloneItem(item:Item):Item {
                   var itemClone:Item = new Item(item.ID, item.name, item.bpCost, item.bcCost, item.quantity);
                   var tempBitmap:Bitmap;
                   var tempBitmapData:BitmapData;
                   var tempSprite:Sprite;
                   if (item.card != null) {
                        itemClone.card = new mcCard();
                        itemClone.card.txbCardName.text = item.card.txbCardName.text;
                        itemClone.card.setCost(item.card.cost);
                        itemClone.card.txbSet.text = item.card.txbSet.text;
                        itemClone.card.txbRarity.text = item.card.txbRarity.text;
                        itemClone.card.txbLevel.text = item.card.txbLevel.text;
                        itemClone.card.txbType.text = item.card.txbType.text;
                        if (itemClone.card.txbType.text.indexOf('Unit') == -1 && itemClone.card.txbType.text.indexOf('Hero') == -1 && itemClone.card.txbType.text.indexOf('Leader') == -1) {
                             itemClone.card.hideUnitAttributes();
                        } else {
                             itemClone.card.txbAttack.text = item.card.txbAttack.text;
                             itemClone.card.txbHP.text = item.card.txbHP.text;
                             if (itemClone.card.txbType.text.indexOf('Leader') == -1) {
                                  itemClone.card.lblMP.visible = false;
                                  itemClone.card.txbMP.visible = false;
                             } else {
                                  itemClone.card.lblAttack.visible = false;
                                  itemClone.card.txbAttack.visible = false;
                                  itemClone.card.mcSword.visible = false;
                                  itemClone.card.lblHP.x = itemClone.card.lblAttack.x;
                                  itemClone.card.txbHP.x = itemClone.card.txbAttack.x;
                                  itemClone.card.mcHeart.x = 0;
                                  itemClone.card.txbMP.text = item.card.txbMP.text;
                        itemClone.card.txbRules.text = item.card.txbRules.text;
                        tempBitmapData = new BitmapData(166, 96);
                        tempBitmapData.draw(item.card.mcImage);
                        tempBitmap = new Bitmap(tempBitmapData);
                        //tempBitmap.cacheAsBitmap = false;
                        //tempBitmap.smoothing = true;
                        tempSprite = new Sprite();
                        tempSprite.addChild(tempBitmap);
                        itemClone.card.mcImage.addChild(tempSprite);
                        //tempBitmapData.dispose();
                        tempBitmapData = null;
                        tempBitmap = null;
                        itemClone.card.buttonMode = true;
                        itemClone.card.mouseChildren = false;
                        itemClone.card.tabEnabled = false;
                   return itemClone;

    More shots in the dark...
    Check the following:
    1) The height and width may be invalid.  Change it to:
    new BitmapData (item.card.mcImage.width, item.card.mcImage.height);
    2) If that doesn't work, try it with just a single pixel
    new BitmapData(1,1);
    3) Check to see if the movieClip has been resized or transformed.
    4) Make sure the MovieClip is at 0,0 registration
    5) Try setting the alpha value to false and see if it captures a black rectangle
    new BitmapData(166,96,false);
    If it doesn't throw an error, and returns a black rectangle, it means there were no pixels for it to capture.
    6) Substitute the item.card.mcImage with a different MovieClip.
    7) And lastly, try to comment out code that comes before to see if it's something else that's causing the error.  Sometimes the error is being thrown for entirely different reasons than it says, but AS gets confused.

  • New to FLEX, Writing text on a BitmapData object

    Hello,
    it has been quite some time since I coded in actionscript, I am a java  developer who is struggling to learn some game oriented actionscript.
    The problem:
    I have a double buffering schema using a canvas declared on the MXML  file and a bitmapdata on a class as the back buffer. the enterframe  method paints the bitmapdata into the canvas thus updating the screen.
    I know I can add graphics to the bitmapdata object but I want to write  some text into the bitmapdata. How can I do that?

    You can convert Text into bitmapdata and write it.

  • PhotoHolder - Bitmap/BitmapData Problems

    Hello guys, how are you?
    I'm trying to create an actionscript 3 class that receives an external image, adds it into a movieclip and adjusts it without corrupting the aspect ratio of the image.
    I've tried working with BitmapData and Bitmap only, but can not hit the calculations. Can anyone help me?
    Thank you,
    package
        import flash.display.Bitmap;
              import flash.display.BitmapData;
              import flash.display.DisplayObject;
              import flash.display.Loader;
              import flash.display.MovieClip;
              import flash.display.PixelSnapping;
              import flash.display.Sprite;
              import flash.events.Event;
              import flash.events.IOErrorEvent;
              import flash.geom.Matrix;
              import flash.geom.Rectangle;
              import flash.net.URLRequest;
              import flash.system.LoaderContext;
              public class PhotoHolder extends MovieClip
                        private var _loader:Loader;
                        public function PhotoHolder()
                        public function loadPhoto(urlImg:String):void
                                  _loader = new Loader();
                                  _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
                                  _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
                                  _loader.load(new URLRequest(urlImg));
                        private function onError(e:IOErrorEvent):void
                                  trace("ERROR!");
                        private function onComplete(e:Event):void
                                  var loadedImage:Bitmap = Bitmap(_loader.content);
                                  var bmd:BitmapData = new BitmapData(_loader.content.width, _loader.content.height, true);
                                  bmd.draw(loadedImage, null);
                                  this.holder.addChild(createBitmap(bmd));
                        private function createBitmap(bmd:BitmapData):Bitmap
                var bitmap:Bitmap = new Bitmap(bmd);
                bitmap.smoothing = true;
                setSize(bitmap, bmd.width, bmd.height, this.holder.x, this.holder.y);
                return bitmap;
            private function setSize(target:DisplayObject, contentWidth:Number, contentHeight:Number, targetWidth:Number, targetHeight:Number):void
                var w:Number = targetWidth;
                var h:Number = targetHeight;
                // maintain aspect ratio
                var containerRatio:Number = targetWidth / targetHeight;
                var imageRatio:Number = contentWidth / contentHeight;
                if (containerRatio < imageRatio) h = w / imageRatio;
                else                             w = h * imageRatio;
                target.width = w;
                target.height = h;
                //centre content - this might change based on your setup
                target.x = (targetWidth - w) * .5;
                target.y = (targetHeight -h) * .5;

    You´re right! It´s happening, the case is my movieclip. I will think about it. I made fell changes in the class, it´s more easy to read. Now, that is the principal methods:
    private function onComplete(e:Event):void
                                  var w:Number = this.width;
                                  var h:Number = this.height;
                                  var loadedImage:Bitmap = Bitmap(_loader.content);
                                  _ratio = _loader.content.height / _loader.content.width;
                                  this.addChild(resizeIt(loadedImage, w, h));
                        private function resizeIt(bitmap:Bitmap, maxW:Number, maxH:Number):Bitmap
                                 if (bitmap.width > maxW)
                                       bitmap.width = maxW;
                                       bitmap.height = bitmap.width * _ratio;
                              if (bitmap.height > maxH)
                                     bitmap.height = maxH;
                                    bitmap.width = bitmap.height / _ratio;
                              bitmap.smoothing = true;
                               return bitmap;
    But I have one more question:
    I'm reducing the size of the image to place it in the container. I'm not using scaleX and scaleY. How do I fill the container without losing image quality?

  • Editing bitmaps using BitmapData

    Hi All,
    I has a series of bitmaps which have been broken apart in flash, I want to know if it is possible to go into these bitmaps using their bitmapdata and edit them based on information on the arrays that I get. I.E. I want to delete the transparent pixels each one has.
    Obviously I can do this by hand in photoshop or just using the lasso tool, but I have several thousand bitmaps that I have to edit, so I'm hoping theres a way to do this through code.
    Tom

    Hello tomhenry687,
    You can use getColorBoundsRect - which determines a rectangular region that either fully encloses all pixels of a specified color within the bitmap image (if the findColor parameter is set to true) or fully encloses all pixels that do not include the specified color (if the findColor parameter is set to false).
    You can see my code below. Here I used a movieclip ball_mc with the transparent area. And I checked with the mouse clicked position.
    This might help you.
    import flash.events.MouseEvent;
    import flash.display.BitmapData;
    import flash.display.Shape;
    addEventListener(MouseEvent.CLICK, hitTest);
    var outline:Shape = new Shape();
    addChild(outline);
    function hitTest(event:MouseEvent):void
        var bmpData:BitmapData = new BitmapData(ball_mc.width, ball_mc.height,true,0xFFFFFF);
        bmpData.draw(ball_mc);
        var color:uint = bmpData.getPixel32( mouseX, mouseY );
        var rect:Rectangle = bmpData.getColorBoundsRect( 0xFFFFFFFF, color );
        outline.graphics.clear();
        outline.graphics.lineStyle( 1, 0x000000, 1 );
        outline.graphics.drawRect( rect.x, rect.y, rect.width, rect.height );
        trace(rect)
    Regards
    Sazzad Ahmmed Mohon

  • What is or isn't possible on iOS?  (Not having Loader, loadBytes(), external swfs, etc)

    My basic question is:  "What are the classes which we should not use for iOS using the packager."
    I have been trying for a few days trying to get a simple Flash app to run on the iPad.  A very simple app (with sound!) with just 2 classes works fine (Performance is a whole other issue.  We will get to that).  But if I try anything else, all I get is a white/black screen on the iPad.  So it would be really nice to know what classes, functions, etc we CANNOT use for the Packager.
    I have fairly simple app (not as simple as 2 classes) which loads some art assets via URLRequest/Loader, puts them on the stage.  Fairly common standard practice in AS3.
    I've read about not able to load an external file using the Packager.  So to fix the situation of loading assets, I have looked into the [embed] tag, which seems to work.  I hope the blogger doesn't mind, but this page is an excellent source on what works and doesn't work with the [embed] tag in it's various flavors:  http://www.richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asse t_workflows.  For example, AS3 in a swf is stripped out from an external swf using [embed].
    The best way to load an external swf file for iOS seems to be using [embed] with "application/octet-stream" and load the swf through ByteArray (Option #4 in the link above).  This works great on the PC.  HOWEVER, on iPad, it fails.  The [embed] tag works on the iPad with the other ways, so my guess is that loadBytes() does not work.  Is this true Adobe/Flash guys?  Can you confirm this?
    My initial question is "why is this not allowed on iOS?".  If it is because of the fact that it uses a Loader, can it be changed so it's not using a Loader to construct a MovieClip?  I have a ByteArray with the raw swf/MovieClip data.  Why can't I construct a MovieClip from it without going through Loader?
    This loadBytes() failure seems to be the only thing preventing me from using the normal pipeline of Flash development in loading external assets.  If there are other ways people have found, please share!
    Now on to performance.  Adobe, can you post some examples/samples of code which runs at decent performance?  Like a "tech demo" of what is possible using the Packager running on iPad/iPhone.  That would be extremely helpful for everyone.  I have done a lot of the optimizing suggestions on various sites and pages ( and by Adobe http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html), but I am not seeing the 30 fps performance that is MORE than possible on iPhone/iPad.  Displaying and moving around Bitmaps (I don't use any vector graphics) should be blazing fast.  Quake runs on iPad without any problems and that code is 10 years old.  Moore's law dictates that drawing Bitmaps using CPU should be faster than a 3D engine written 10 years ago...  I am trying out the new iOS 4.2 which is supposed to be "significantly" better, but I am still stuck on loadBytes().
    So at this point, I am blocked on loadBytes() and my performance for a simple app which draws a few Bitmaps and MovieClips is terrible.  I am hopeful some people out there have figured out some solution (there are lots of clever people out there) and I will stumble on to something.  But being forced to go native Objective-C seems to be my only option at this point.
    In summary, here are the questions I would like to ask the Adobe/Flash group for some more help/information/advise:
    - Why is Loader not allowed on iOS?  Is it a technical limitation of the hardware/os/Flash?  Will it never be supported?  What is the future of this class on iOS?
    - Why is loadBytes() not allowed on iOS?  I have the raw embedded data in memory.  I don't need to make a remote call so security should not be an issue.  Can I create a MovieClip without using Loader?
    - Why is AS3 stripped from the timeline when a Symbol is retrieved using [embed]?  Maybe this is the same reason loadBytes() fails, but if I could use [embed] and get a copy of the Symbol, that is what I need.  (There are issues with the mx.core.MovieClipLoaderAsset/Asset, but it is better than being blocked by loadBytes())
    - What are some apps you guys have written that we can use to compare PC vs iOS?  Again, a "tech demo" or sample code of what you as experts in Packager for iOS have done which runs at decent framerate (30+fps) would be of tremendous help.  If the Adobe/Flash group hasn't gotten the current Packager for iOS to handle more than 50+ 2D Bitmaps on screen running at 30+fps, that would be good to know.  Please let us know what the experts and owners of your software are capable of getting the most throughput using the Packager.  I'd hate to sound a bit fed up/angry, but I think you are wasting a lot of people's time and energy with a piece of software that, to me, seems like it was a bit early to release.  Flash can do some great things.  If it can do it on iOS, even better.  But PROVE it to us that it's possible, before having your customers run into barriers imposed on us by trial and error.
    Thanks.

    I have hardly ever seen a post here from someone at Adobe, so you may need to be patient.
    Read this article, and get its associated demo files, to see some good performing tech demos:
    http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html
    Back to your main point, loaders are working, what isn't working for you is accessing of things in the library of a successfully loaded swf, that have been set to Export for ActionScript. That means that the swf you have loaded has an ActionScript Class, to represent the library symbol. iOS Flash apps are native ARM code, and don't include the virtual machines that a browser plugin has, and so it's not able to interpret ActionScript. That may be why it would fail.
    Now, I can think of at least a couple of reasons why you might want to have external swfs with elements that you want to reuse in the main swf. One would be if you're intending to make a lot of them, like say if you wanted to have an Asteroids game and the ability to use artwork from a set of different swfs. Another reason might be if you want to skin your interface, by taking specific elements from the loaded swf and using them in the main swf. That way you could have artists preparing those swfs for you, and you just include them in your package, and load the one you want.
    There is a way to do either of those things. The second one can be done by having the item as a named symbol on the stage of the loaded swf. With a to-be-loaded swf named "inner.swf", that has a movieclip on its stage named "mc1", this script in the main swf would load that external swf and use its symbol on the main swf's stage, without having to make the inner swf's symbol use ActionScript:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    For the other case, you can take the item off the stage of the loaded swf and draw it into a bitmapdata, and then make as many bitmaps from that as you like. Here's the above example, only it adds the original movieclip to the main swf stage, and also creates a bitmap that looks the same:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    var bmd:BitmapData = new BitmapData(innermc.width,innermc.height);
    bmd.draw(innermc);
    var bm:Bitmap = new Bitmap(bmd);
    bm.x = 150;
    bm.y = 150;
    addChild(bm);
    So, the thing to learn is that a native ARM code application does not have an ActionScript interpreter in it, and if you need to do something that normally requires interpreting ActionScript, find another way to do it.

  • How to use filters on ios mobile devices (iPhone/iPad) using GPU rendering (Solved)

    Many moons ago I asked a question here on the forums about how to use filters (specifically a glow filter) on a mobile devices (specifically the iPhone) when using GPU rendering and high resolution.
    At the time, there was no answer... filters were unsupported. Period.
    Well, Thanks to a buddy of mine, this problem has been solved and I can report that I have gotten a color matrix filter for desaturation AND a glow filter working on the iPhone and the iPad using GPU rendering and high resolution.
    The solution, in a nut shell is as follows:
    1: Create your display object... ie: a sprite.
    2. Apply your filter to the sprite like you normally would.
    3. Create a new bitmapdata and then draw that display object into the bitmap data.
    4. Put the new bitmapdata into a bitmap and then put it on the stage or do what you want.
    When you draw the display object into the bitmapdata, it will draw it WITH THE FILTER!
    So even if you put your display object onto the stage, the filter will not be visible, but the new bitmapdata will!
    Here is a sample app I created and tested on the iphone and ipad
    var bm:Bitmap;
    // temp bitmap object
    var bmData:BitmapData;
    // temp bitmapData object
    var m:Matrix;
    // temp matrix object
    var gl:GlowFilter;
    // the glow filter we are going to use
    var sprGL:Sprite;
    // the source sprite we are going to apply the filter too
    var sprGL2:Sprite;
    // the sprite that will hold our final bitmapdata containing the original sprite with a filter.
    // create the filters we are going to use.
    gl = new GlowFilter(0xFF0000, 0.9, 10, 10, 5, 2, false, false);
    // create the source sprite that will use our glow filter.
    sprGL = new Sprite();
    // create a bitmap with any image from our library to place into our source sprite.
    bm = new Bitmap(new Msgbox_Background(), "auto", true);
    // add the bitmap to our source sprite.
    sprGL.addChild(bm);
    // add the glow filter to the source sprite.
    sprGL.filters = [gl];
    // create the bitmapdata that will draw our glowing sprite.
    sprGL2 = new Sprite();
    // create the bitmap data to hold our new image... remember, with glow filters, you need to add the padding for the flow manually. Should be double the blur size
    bmData = new BitmapData(sprGL.width+20, sprGL.height+20, true, 0);
    // create a matrix to translate our source image when we draw it. Should be the same as our filter blur size.
    m = new Matrix(1,0,0,1, 10, 10);
    // draw the source sprite containing the filter into our bitmap data
    bmData.draw(sprGL, m);
    // put the new bitmap data into a bitmap so we can see it on screen.
    bm = new Bitmap(bmData, "auto", true);
    // put the new bitmap into a sprite - this is just because the rest of my test app needed it, you can probably just put the bitmap right on the screen directly.
    sprGL2.addChild(bm);
    // put the source sprite with the filter on the stage. It should draw, but you will not see the filter.
    sprGL.x = 100;
    sprGL.y = 50;
    this.addChild(sprGL);
    // put the filtered sprite on the stage. it shoudl appear like the source sprite, but a little bigger (because of the glow padding)
    // and unlike the source sprite, the flow filter should acutally be visible now!
    sprGL2.x = 300;
    sprGL2.y = 50;
    this.addChild(sprGL2);

    Great stuff dave
    I currently have a slider which changes the hue of an image in a movieclip, I need it to move through he full range -180 to 180.
    I desperately need to get this working on a tablet but cant get the filters to work in GPU mode. My application works too slow in cpu mode.
    var Mcolor:AdjustColor = new AdjustColor();   //This object will hold the color properties
    var Mfilter:ColorMatrixFilter;                           //Will store the modified color filter to change the image
    var markerSli:SliderUI = new SliderUI(stage, "x", markerSli.track_mc, markerSli.slider_mc, -180, 180, 0, 1);   //using slider from http://evolve.reintroducing.com
    Mcolor.brightness = 0;  Mcolor.contrast = 0; Mcolor.hue = 0; Mcolor.saturation = 0;            // Set initial value for filter
    markerSli.addEventListener(SliderUIEvent.ON_UPDATE, markerSlider);                          // listen for slider changes
    function markerSlider($evt:SliderUIEvent):void {
        Mcolor.hue = $evt.currentValue;                        
        updateM();
    function updateM():void{
        Mfilter = new ColorMatrixFilter(Mcolor.CalculateFinalFlatArray());
        all.marker.filters = [Mfilter];
    how would I use your solution in my case
    many thanks.

Maybe you are looking for

  • Rep-52005 error when running a report from form with parameter form

    I am trying to run a report from a web deployed form and this report has a parameter form. I am getting a Rep-52005: The specified key report does not exist in key map file. I am using Oracle Forms/Reports 10.1.2.0.2. My code is below. The first part

  • Full-screen Slideshow Set-up

    I want to create custom image slides from large scale high res photos in photoshop or illustrator to use in the Full-screen Slideshow widget in Muse. What height and width dimensions should I create the original image slides in before I load them int

  • Fwd: Dependencies for AIX6.1

    Hi Technology Consultants, I am installing ECC6.0SR3 with MaxDB7.6 On AIX6.1 (IBM P series Servers). when i was installing Java "IBMJava2-142-ppc64-SDK-1.4.2-13.0.ppc64.rpm" . its not installing and asking for dependencies. Anybody send me the link w

  • I can't get the CC installer to work nor get support to answer their phones

    I reciently changed the status of my CC subscription,  I was told to install a new version of the CC installer so my changes would be reflected. I downloadedd the new installer started it up and then found I needed to use the uninstall program to uni

  • Keyboard won't come up when screen pressed where i want to type?

    keyboard won't come up when screen pressed where i want to type?