SecurityError 2123: ImageSnapshot.captureBitmapData(video)

Hi
Project compiled for Flash Player 9 and developed with Flex SDK 3.5
I try to take snapshats from a rtmp video.
I wrote a crossdomain.xml:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <site-control permitted-cross-domain-policies="all"/>
  <allow-access-from domain="*" />
</cross-domain-policy>
directly located in the folder where the swf is located.
ActionScript Code in the init function:
Security.loadPolicyFile("./crossdomain.xml");
ActionScript Code in the function "when content.xml loaded":
Security.allowDomain(myXML.elements("flvUrl").attribute("url").toString());
content.xml:
<content>
    <flv url="rtmp://3p0.de/vod/Extremists"/>
    <flvUrl url="rtmp://3p0.de/vod/*"/>
</content>
The rtmp video is located an a server I do not know.
I just had to write a swf which manipulate the video.
I loaded the project to a fileserver and tried it to run but I get the SecurityError (translated in english):
BitmapData.draw: ..../my.swf couldn´t access to rtmp://3p0.de/vod/Extremists there are no security file which allow the access.
Can someone help me?
Is it possible to test the access from a fileserver?
thanks and
best regards

Please a advice
I don´t know how to go ahead with this problem....

Similar Messages

  • Error: ImageSnapshot.captureBitmapData(video)

    Hi
    Project compiled for Flash Player 9 and developed with Flex SDK 3.5 
    I try to take snapshats from a rtmp video. 
    I wrote a crossdomain.xml: 
    <?xml version="1.0"?> 
    <!DOCTYPE cross-domain-policy 
    SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 
    <cross-domain-policy> 
    <site-control permitted-cross-domain-policies="all"/> 
    <allow-access-from domain="*" /> 
    </cross-domain-policy> 
    directly located in the folder where the swf is located. 
    ActionScript Code in the init function: 
    Security.loadPolicyFile("./crossdomain.xml"); 
    ActionScript Code in the function "when content.xml loaded": 
    Security.allowDomain(myXML.elements("flvUrl").attr   ibute("url").toString()); 
    content.xml: 
    <content> 
    <flv url="rtmp://3p0.de/vod/Extremists"/> 
    <flvUrl url="rtmp://3p0.de/vod/*"/> 
    </content> 
    The rtmp video is located an a server I do not know. 
    I just had to write a swf which manipulate the video. I tested the swf  project on my fileserver. 
    I loaded the project to a fileserver and tried it to run but I get the  SecurityError 2123 (translated in english): 
    BitmapData.draw: ..../my.swf couldn´t access to  rtmp://3p0.de/vod/Extremists there are no security file which allow the  access. 
    Can someone help me? 
    Is it possible to test the access from a fileserver? 
    I don´t know how to go ahead with this problem....

    Maybe you would more likely get an answer if you posted in the Flash or Flex forum.

  • I get a security sandbox error #2122 when i try to use ImageSnapshot on video player

    hey guys... so all my application does is... it has a video player... and when i initiate the component it loads the flv from a different server, and plays the video... now while its playing the video i have a button called capture, and whe you hit that button the user is able to take snapshots of the current frame.
    this seems to work perfectly locally, but as soon as i uploaded it to the server i get problems...
    the error states:
    SecurityError: Error #2122: Security sandbox violation: BitmapData.draw: http://website1.com/Content/swf/oneStopImageVersion.swf cannot access http://website2.com/videos/originals/Grand_Opening.flv. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
         at flash.display::BitmapData/draw()
         at mx.graphics::ImageSnapshot$/captureBitmapData()
         at modules.videoHandler::videoHandler/captureVideo()
         at modules.videoHandler::videoHandler/___videoHandler_LinkButton3_click()
    i have the crossdomain file in the root directory of website2.com, and i have the folloing line of code in there
    <?xml version="1.0"?>
    <cross-domain-policy>
         <site-control permitted-cross-domain-policies="all" />
         <allow-access-from domain="website1.com"/>
         <allow-access-from domain="*.website1.com"/>
             <allow-http-request-headers-from domain="*.website1.com" headers="SOAPAction"/>
    </cross-domain-policy>
    any ideas on how to fix this problem???
    my actionscript code is as follows
    public function captureVideo():void{
         var snapshot:BitmapData = ImageSnapshot.captureBitmapData(videoPlayer.videoDisplay);
         initialThumbnail.source = new Bitmap(snapshot); //this is the image tag in my mxml
    any help is greatly appretiated!!!!
    thanks in advance!

    any one with ideas???
    i've been doing some more research... and found a possible solution... where i could send the video thru a server proxy... but the only thing is doing that might slow down my process... i was wondering if there was any other solution to this problem??

  • Imagesnapshot.capturebitmapdata with rotation matrix

    Hi all,
    I am not able to use imagesnapshot with rotation matrix.
    I am using imagesnapshot to cpature bitmapdata from image.
    My image is rotated so I want to rotate bitmapdata as per rotation.
    Here is the code.
    var matrix:Matrix = new Matrix();
    matrix.rotate(degreesToRadians(90));
    var bitmapData:BitmapData = ImageSnapshot.captureBitmapData(image, matrix);
    This code is not working it gives error.
    any idea why it is giving error?

    Kglad,
    While the parent isn't being rotated, it used to:
    Group all of the shapes together
    Acts as a basis for a bitmap object
    The problem occurs when I align the parentMC to the bottom and right edges of the stage. If left where the true boundary of the parentMC exists, there's a huge gap between the visible part of the shapes and the edge of the screen. If I manually adjust the parenMC, the screen size of the background is enlarged, and any object that rely on the right edge for alignment slide off screen.
    The breakdown of the display objects looks like this:
    ScreenContainer
    Background Image Container
    Shapes Container (holds all of the puzzle shapes)
    Individual Shape Container (a movieclip that can be dragged or rotated--X and Y offset to rotate around center)
    Individual Shape Subcontainer (a movieclip holds the drag handles and the shape--X and Y offset)
    Handle at each vertex
    Shape
    Tool Area
    I want to rotate the Individual Shape Container (not the subcontainer) without offsetting the X and Y positions of it or the Subcontainer using a transform. My problem seems to be in assigning the center point during the transform.
    Does that make sense?

  • Save imageSnapshot to Server

    Hello all.
    I am trying to make a little component that allows a user to take a picture using their webcamera and then save it to a server.  I have the application so far allowing the user to take a picture and its creating a bitmap.  I then have another button "Save" that then converts this bitmap into a Snapshot which i want to then upload but am having troubles doing this.  I can save it to the users desktop computer no problem.  Just cant upload =[
    My code is looking like this
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx" >
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.graphics.ImageSnapshot;
                import mx.graphics.codec.JPEGEncoder;
                import mx.graphics.ImageSnapshot;
                [Bindable] public var bitmap:Bitmap;
                public function takeSnapshot():void
                    var snapshot:BitmapData = ImageSnapshot.captureBitmapData(videoDisplay);
                    bitmap= new Bitmap(snapshot);
                    img.source=bitmap;
                //Web Cam Stuff
                private function videoDisplay_creationComplete():void {
                    var camera:Camera = Camera.getCamera();
                    if (camera) {
                        videoDisplay.attachCamera(camera);
                    } else {   
                private function saveImageToFileSystem():void
                    var jPEGEncoder:JPEGEncoder = new JPEGEncoder(500);
                    var imageSnapshot:ImageSnapshot = ImageSnapshot.captureImage(img, 0, jPEGEncoder);
                    var fileReference:FileReference = new FileReference();
                    fileReference.save(imageSnapshot.data, "img123.jpg");
            ]]>
        </fx:Script>
        <mx:VideoDisplay id="videoDisplay"
                         creationComplete="videoDisplay_creationComplete()"
                         width="320" height="240" autoPlay="true" x="15" y="28"/>
        <mx:Image id="img" x="343" y="28"/>
        <s:Button id="button" label="Take Screenshot" click="takeSnapshot()" x="15" y="276"/>
        <s:Button click="saveImageToFileSystem()" label="Save Image" x="135" y="276"/>
        <s:Label x="54" y="348" text="Label"  useHandCursor="true" buttonMode="true" mouseChildren="false"/>
    </s:Application>
    If anyone could help that would be great.  I want to use a PHP backend if possible

    Hi and thanks for the reply.
    I have made some good progress on this.  I now have the application taking a bitmap screenshot, allowing the user to save this image to their desktop computer and then allow them to search their desktop computer for a file to upload.  I have done this using the file reference as you suggested.
    My only problem however is that i dont want the user to have to save the image onto their computer and then find it to upload it using the .browser() function.
    Is there anyway possible to pass a file to that browse direct?
    My code is this -
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx" >
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.graphics.ImageSnapshot;
                import mx.graphics.codec.JPEGEncoder;
                import mx.graphics.ImageSnapshot;
                [Bindable] public var bitmap:Bitmap;
                public function takeSnapshot():void
                    var snapshot:BitmapData = ImageSnapshot.captureBitmapData(videoDisplay);
                    bitmap= new Bitmap(snapshot);
                    img.source=bitmap;
                //Web Cam Stuff
                private function videoDisplay_creationComplete():void {
                    var camera:Camera = Camera.getCamera();
                    if (camera) {
                        videoDisplay.attachCamera(camera);
                    } else {   
                private function saveImageToFileSystem():void
                    var jPEGEncoder:JPEGEncoder = new JPEGEncoder(500);
                    var imageSnapshot:ImageSnapshot = ImageSnapshot.captureImage(img, 0, jPEGEncoder);
                    var fileReference:FileReference = new FileReference();
                    fileReference.save(imageSnapshot.data, "img123.jpg");
                //Upload Stuff
                import mx.controls.Alert;
                private var fileRef:FileReference;
                private const FILE_UPLOAD_URL:String = "http://www.******/upload.php";
                private function init():void {
                    fileRef = new FileReference();
                    fileRef.addEventListener(Event.SELECT, fileRef_select);
                    fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
                private function browseAndUpload():void {
                    fileRef.browse();
                private function fileRef_select(evt:Event):void {
                    fileRef.upload(new URLRequest(FILE_UPLOAD_URL));
                private function fileRef_complete(evt:Event):void {
                    Alert.show("Image has been uploaded", "Success");
            ]]>
        </fx:Script>
        <mx:VideoDisplay id="videoDisplay"
                         creationComplete="videoDisplay_creationComplete()"
                         width="320" height="240" autoPlay="true" x="15" y="28"/>
        <mx:Image id="img" x="343" y="28"/>
        <s:Button id="button" label="Take Screenshot" click="takeSnapshot(),init()" x="15" y="276"/>
        <s:Button click="saveImageToFileSystem()" label="Save Image" x="135" y="276"/>
        <s:Button x="229" y="276" label="Upload" click="browseAndUpload()"/>
    </s:Application>
    If you look at it the process is - Take Screenshot, which create the bitmap, Save Image which converts it into Snapshot and then lets the user save it to their computer, Upload which lets the computer browse their desktop to search for an image to upload.
    However i want to merge steps two and three together, so that the user Takes a Screenshot, which saves it as a bitmap, this can be repeated many times as it is now, but then whent hey are happy with the image, they should just click Upload, which will save the image as a SnapShot and then upload it directly, without them needing to save it and then find it again using the .browse()
    So my question really is,
         Is it possible to pass a file into the browse straightway ?  Mainly passing a snapShot thru ?
    Just so you know my php code looks like this
    <?php
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $fileName = $_FILES['Filedata']['name'];
    $fileSize = $_FILES['Filedata']['size'];
    $name = $_GET['extraVar'];
    $argh = $name.'.doc';
    move_uploaded_file($tempFile, "./" . $argh);
    ?>
    Thanks !

  • How do i resize the image getting captured by ImageSnapshot???

    hey guys... so im taking an image of a movie clip using ImageSnapshot.captureBitmapData(myClip);
    i need to resize the bitmap data that i get back, the size needs to be 720X486
    the code i have is...
    var myClip:MovieClip = event.target as MovieClip;
    var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myClip);
    var pngEncode:PNGEncoder = new PNGEncoder();
    var ba:ByteArray = pngEncode.encode(imageBitmapData);
    any ideas??? i tried to use the matrix.scale, but i guess i didnt understand on how to use it properly...
    any help is greatly appretiated!!
    thanks

    Hi,
    You can also use the below approach to  capture the BitmapData of your moviclip(myClip).
    So that you can make use of matrix class to resize the bitmap image.
         var myClip:MovieClip = event.target as MovieClip;
         var imageBitmapData:BitmapData = new BitmapData(myClip.width,myClip.height);
        var pngEncode:PNGEncoder = new PNGEncoder();
        var ba:ByteArray = pngEncode.encode(imageBitmapData);
        var m:Matrix = new Matrix();
        imageBitmapData.draw(myClip,m);
        m.scale(1.2,1);
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • StyleManager timing and ImageSnapshot

    I think I'm being dense on this, but I can't figure it out.
    I have a Group with an image, and several TextAreas on top of the image.  The TextAreas have a yellow border.
    I want to use ImageSnapshot to a static shot of the image + text areas .. a sort of "Preview" window.
    But of course I want to disable the borders on the text areas first.
      styleManager.getStyleDeclaration("spark.components.TextArea").setStyle("borderVisible","false");
      var bitmap:BitmapData = ImageSnapshot.captureBitmapData(mainGroup);
    mainGroup is the s:Group containing the image and text areas.
    The image produced shows the text areas with their borders, but the text areas really do lose their borders in the app.
    setStyle doesn't seem to fire an event to listen for it to be complete, so how do I do this?  I need ImageSnapshot to wait till setStyle is done.

    Ah, it didn't work because I didn't set up showPreview correctly.
    This works:
      mainGroup.addEventListener(FlexEvent.UPDATE_COMPLETE,showPreview);
      styleManager.getStyleDeclaration("spark.components.TextArea").setStyle("borderVisible","false");
    private function showPreview(event:FlexEvent):void {
      var bitmap:BitmapData = ImageSnapshot.captureBitmapData(mainGroup);
    It's because I left off event:FlexEvent as a parameter to showPreview
    Thanks for the help!

  • .removeEventListener(Event.ENTER_FRAME  is not working please help

    hey guys... so i have a new problem... basically im trying to load a swf, and for this swf to load properly i need to pass it an id, and when the swf, after using the id gets all the necessary data, sets a variable called loadCompleted to true
    The problem is after my code encounters the loadComplete == true, it adds an image of that swf to my tileList, and it adds a million of these images, indicating that my event never got removed.... any ideas??
    i have the following code
    private function swfLoaded(event:Event):void{
         trace("-------------> in function swfloader");
         childSwf = new MovieClip();
         childSwf = event.target.content;
         childSwf.init(name[1]);
         childSwf.addEventListener(Event.ENTER_FRAME, compFrameEntered);
    private function compFrameEntered(event:Event):void{
         if(childSwf.currentFrame == childSwf.totalFrames){
              if(event.target.loadComplete == true){
                   trace("<<<<< load complete: " + event.target.loadComplete);
                   childSwf.removeEventListener(Event.ENTER_FRAME, compFrameEntered);
                   var myClip:MovieClip = event.target as MovieClip;
                   var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myClip);
                   var imgData:Bitmap = new Bitmap(imageBitmapData);
                   slideImages.addItem(imgData);
                   trace("load complete company ");
    it not only adds a million same images, but it also displays "load complete company" a million times....
    any ideas?? any help is greatly appretiated! ive been having this problem for a couple of days now

    hi,
    It seems they have changed how it works,
    https://acrobat.com/    when I go here it is automatically logged me in to a page that allowed me to start a meeting
    David

  • Generating a PDF of what the user sees, and sending it as a binary stream to the server

    Hi All,
    On the final page of our Flex app, we allow the user to print out a copy of everything they've entered for their own records.
    I'm wondering if there is a way for me, programmatically, to generate a PDF document that is the same as their printout (I pass a particular container to the "print" button I've got for the user), and send those bytes back to the server.  We can store this PDF along with all the rest of their data, and it would be useful as a "snapshot" of exactly what the user saw when they submitted their application.
    I'm looking into Flex PDF generation, but so far haven't gotten this figured out.  I thought some folks here might be able to point me in the right direction.
    Thanks!
      -Josh

    Here is how you can take a snapshot.
    import mx.graphics.ImageSnapshot;
    import mx.graphics.codec.IImageEncoder;
    import mx.graphics.codec.PNGEncoder;
    import mx.utils.Base64Encoder;
    private function uploadImage(rSource:IBitmapDrawable):void
                        var tBitmapData:BitmapData = ImageSnapshot.captureBitmapData(rSource);
                        var tEnc:IImageEncoder = new PNGEncoder();
                        var tBA:ByteArray = tEnc.encode(tBitmapData);
                        var tB64:Base64Encoder = new Base64Encoder();
                        tB64.encodeBytes(tBA);
                        // send tB64.toString() using POST to the server to save the image.
    // call
    uploadImage(this) // where parameter is an object to get the snapshot of. Can be anything including Application. ("this" in my case).

  • Need Help With An Application That Produces Live Images Within Tilelists

    At the moment I have an application which is meant to produce live thumbnail images of websites. Currently how it does this is a html component (myhtml) loads websites via it's location property changing from website to website and upon fully loading of each site a "snapshot" is taken of the html component and saved as a bitmap and applied as the source of an image corresponding to that particular site (abcnewsimage and bbcnewsimage). However I now need to insert these snapshots within the 'icon' properties of 2 array collections (myTilelistAArrayCollection and myTilelistBArrayCollection) which act as dataproviders to populate 2 tilelists (mtTilelistA and myTilelistB).
    Basically I need the same images to appear automatically within the tilelists the way they do in the 2 images as the snapshots are taken by applying the same bitmaps into the currently empty 'icon' properties of the 2 tilelists i.e. the icon of the ABC News Item of both array collections must be the same as the abcnewsimage and appear as it appears and the same for the BBC News Item icon being the same as the bbcnewsimage picture as that appears.
    It should look like the images are appearing in the tilelist at the same time as they are appearing in the regular images. What will I need to put into the icon properties to do this?
    I hope this makes sense and if anyone can help me out it would be much appreciated. :-)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" verticalAlign="middle" backgroundColor="white" width="1024" height="768">
    <mx:Script>
    <![CDATA[
    import mx.graphics.ImageSnapshot;
    import mx.collections.*;
    private function takeSnapshot(event:Event) :void{
    var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myhtml) ;
    switch(myhtml.location){
    case "http://abcnews.go.com/":abcnewsimage.source =
    new Bitmap(imageBitmapData);myhtml.location =
    "http://news.bbc.co.uk/";
    break;
    case "http://news.bbc.co.uk/":bbcnewsimage.source =
    new Bitmap(imageBitmapData);
    break;}
    private var myTilelistAArrayCollection:ArrayCollection = new ArrayCollection([{id:
    "ABC New Item", label:"ABCNews", icon:""},{id:
    "BBC News Item", label:"BBC News", icon:""}]);
    private var myTilelistBArrayCollection:ArrayCollection = new ArrayCollection([{id:
    "ABC News Item", label:"ABCNews", icon:""},{id:
    "BBC News Item", label:"BBC News", icon:""}]);
    ]]>
    </mx:Script>
    <mx:HBox x="10" y="10">
    <mx:Image id="abcnewsimage" width="100" height="100" scaleContent="true"/>
    <mx:Image id="bbcnewsimage" width="100" height="100" scaleContent="true"/>
    </mx:HBox>
    <mx:HTML id="myhtml" location="http://abcnews.com/" complete="takeSnapshot(event)" width="250" height="250" horizontalScrollPolicy="off" verticalScrollPolicy="off" x="10" y="118"/>
    <mx:TileList x="268" y="118" width="294" height="250" id="myTilelistA" dataProvider="{myTilelistAArrayCollection}" rowHeight="100" columnWidth="100"/>
    <mx:TileList x="570" y="118" width="294" height="250" id="myTilelistB" dataProvider="{myTilelistBArrayCollection}" rowHeight="100" columnWidth="100"/>
    </mx:WindowedApplication>

    Cheers Flex harUI. From what I can see superimage is mainly used to keep images at better quality. What I'm concerned with is having the images set within the 'icon' properties of the 2 tilelists AS they are set within their specific images. I've tried databinding by doing this for example:-
    {id:
    "ABC New Item", label:"ABCNews", icon:"{abcnewsimage.source}"},
    I hoped that would cause the icon field of the array collection to be populated by the source of the abcnewsimage so that as the abcnewsimage is populated by the snapshot that is taken of the abcnews website the icon field of the abc news item in the array collection would be too so that furthermore the tilelists would then be populated by these images. Basically as each snapshot appears in it's specfic image it needs to be loaded into the icon property of the array collection too. In the end the icons should look as if they are appearing within both the tilelists the same way as they are appearing within the images if that makes sense. The images should be loading within the tilelist one at a time as they are in the regular image components.

  • Need Help With An Application Which Produces Live Images Within Tilelists

    At the moment I have an application which is meant to produce live thumbnail images of websites. Currently how it does this is a html component (myhtml) loads websites via it's location property changing from website to website and upon fully loading of each site a "snapshot" is taken of the html component and saved as a bitmap and applied as the source of an image corresponding to that particular site (abcnewsimage and bbcnewsimage). However I now need to insert these snapshots within the 'icon' properties of 2 array collections (myTilelistAArrayCollection and myTilelistBArrayCollection) which act as dataproviders to populate 2 tilelists (mtTilelistA and myTilelistB).
    Basically I need the same images to appear automatically within the tilelists the way they do in the 2 images as the snapshots are taken by applying the same bitmaps into the currently empty 'icon' properties of the 2 tilelists i.e. the icon of the ABC News Item of both array collections must be the same as the abcnewsimage and appear as it appears and the same for the BBC News Item icon being the same as the bbcnewsimage picture as that appears.
    It should look like the images are appearing in the tilelist at the same time as they are appearing in the regular images. What will I need to put into the icon properties to do this?
    I hope this makes sense and if anyone can help me out it would be much appreciated.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" verticalAlign="middle" backgroundColor="white" width="1024" height="768">
    <mx:Script>
    <![CDATA[
    import mx.graphics.ImageSnapshot;
    import mx.collections.*;
    private function takeSnapshot(event:Event) :void{
    var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myhtml) ;
    switch(myhtml.location){
    case "http://abcnews.go.com/":abcnewsimage.source =
    new Bitmap(imageBitmapData);myhtml.location =
    "http://news.bbc.co.uk/";
    break;
    case "http://news.bbc.co.uk/":bbcnewsimage.source =
    new Bitmap(imageBitmapData);
    break;}
    private var myTilelistAArrayCollection:ArrayCollection = new ArrayCollection([{id:
    "ABC New Item", label:"ABCNews", icon:""},{id:
    "BBC News Item", label:"BBC News", icon:""}]);
    private var myTilelistBArrayCollection:ArrayCollection = new ArrayCollection([{id:
    "ABC News Item", label:"ABCNews", icon:""},{id:
    "BBC News Item", label:"BBC News", icon:""}]);
    ]]>
    </mx:Script>
    <mx:HBox x="10" y="10">
    <mx:Image id="abcnewsimage" width="100" height="100" scaleContent="true"/>
    <mx:Image id="bbcnewsimage" width="100" height="100" scaleContent="true"/>
    </mx:HBox>
    <mx:HTML id="myhtml" location="http://abcnews.com/" complete="takeSnapshot(event)" width="250" height="250" horizontalScrollPolicy="off" verticalScrollPolicy="off" x="10" y="118"/>
    <mx:TileList x="268" y="118" width="294" height="250" id="myTilelistA" dataProvider="{myTilelistAArrayCollection}" rowHeight="100" columnWidth="100"/>
    <mx:TileList x="570" y="118" width="294" height="250" id="myTilelistB" dataProvider="{myTilelistBArrayCollection}" rowHeight="100" columnWidth="100"/>
    </mx:WindowedApplication>

    Cheers Flex harUI. From what I can see superimage is mainly used to keep images at better quality. What I'm concerned with is having the images set within the 'icon' properties of the 2 tilelists AS they are set within their specific images. I've tried databinding by doing this for example:-
    {id:
    "ABC New Item", label:"ABCNews", icon:"{abcnewsimage.source}"},
    I hoped that would cause the icon field of the array collection to be populated by the source of the abcnewsimage so that as the abcnewsimage is populated by the snapshot that is taken of the abcnews website the icon field of the abc news item in the array collection would be too so that furthermore the tilelists would then be populated by these images. Basically as each snapshot appears in it's specfic image it needs to be loaded into the icon property of the array collection too. In the end the icons should look as if they are appearing within both the tilelists the same way as they are appearing within the images if that makes sense. The images should be loading within the tilelist one at a time as they are in the regular image components.

  • How to convert Doc file into image

    hello frnds
                     Can any body guide me how to convert doc file into image and show into swf loader.
    actually i have to convert doc files into swf files in runtime so that i have to use this flow.
    is it possible to convert doc file into byte array and than convert into image.
    Thanks And Regards
        Vineet Osho

    You can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()

  • Save file on Android

    Hi,
    I'm trying to save an image on Android. But i get only the path '/mnt/sdcard/...'. I would like to save in a custom folder like '/Root/myapp/img.png'. but how?
    This is what i do:
    var f:File = File.documentsDirectory.resolvePath('imagem.png');
    var bytes:ByteArray = new PNGEncoder().encode(ImageSnapshot.captureBitmapData(uiCanvas));
    f.save(bytes, 'imagem.png');
    But documentsDirectory or any other has the same effect.
    Thanks.

    I'm interested in this as well. Can anyone comment?

  • Printing with PrintJob

    Hi there!
    I have got a search dialog and I want to print the search criterias (labels) on a cover page and the search result (datagrid) following the cover page.
    Up to now, I used the FlexPrintJob class. Everything works well.
    Now I have to move to PrintJob because I need to force the pages containing the search result to be printed out in landscape, even if the user has selected to print out portrait within the operating-system-related print dialog.
    Further restriction: I can't embed fonts.
    But let's start with a simple question:
    How can I get this working? The page remains blank when I try this.
    var pj:PrintJob = new PrintJob();
    if (pj.start())
         var testLabel:Label = new Label();
         testLabel.width = 400;
         testLabel.text = "TEST";
         var container:UIComponent = new UIComponent();
         container.addChild(testLabel);
         pj.addPage(container);
         pj.send();
    Thanks, Cheers!

    My next step, which was the original problem I tried to solve, is the rotation to landscape of the content. Since I can't make use of embedded fonts I see only the solution to create an image of the page and rotate it 90 degrees. The following code works in that way that it makes the rotation, but the content disappears and instead is shown a grey bar. Without rotation the page is shown as attached.
    var pj:PrintJob = new PrintJob();
    if (pj.start())
    var container:VBox;
    var vBox:VBox;
    try {
          var testLabel:Label = new Label();
          testLabel.width = 400;
          testLabel.text = "TEST";
          container = new VBox();
          container.width = pj.pageWidth;
          container.height = pj.pageHeight;
          container.setStyle("backgroundColor", "#FFFFFF");
          container.addChild(testLabel);
          addChild(container);
          container.validateNow();
          var bitmap:BitmapData =
              ImageSnapshot.captureBitmapData(testLabel);
          var img:Image = new Image();
          // comment out following line for no rotation
          img.rotation = 90;
          img.width = 400;
          img.height = 20;
          img.source = new BitmapAsset(bitmap);  
          vBox = new VBox();  
          vBox.addChild(img);
          vBox.width = pj.pageWidth;
          vBox.height = pj.pageHeight;
          addChild(vBox);
          vBox.validateNow();
          pj.addPage(vBox);
          pj.send();
    catch (error:Error)
      Alert.show(error.toString());
    finally {
       // clean-up code
       removeChild(container);
       removeChild(vBox);
    Do I have to call something when I rotate the component?

  • Setting the font of a UITextField control

    I am using a UITextField control to create text offscreen, then I'm using ImageSnapshot to get a bitmap and draw it on the screen using graphics methods. It's working fine, except for one thing: for the life of me I cannot change the font used from Times Roman.
    I've scoured the internet and tried many things, such as using a style (stylename=, not setStyle), trying the setTextFormat function, but nothing works.
    I have a work-around using a label control that is part of the parent container with visible=false, but it is not correctly autosizing as I'd like and there are other issues that crop up in this approach.
    Does anyone know how to how to set the font and get it to be used? Here is a snippet of code:
                        var sizeText : UITextField = new UITextField();
                        sizeText.autoSize = TextFieldAutoSize.LEFT;
                        sizeText.background = true;
                        var textFormat : TextFormat = new TextFormat( "Arial", 13, 0xAAAAAA );
                        sizeText.setTextFormat( textFormat );
                        sizeText.text = "blah";
                        var textBitmapData:BitmapData = ImageSnapshot.captureBitmapData( sizeText );
                        var coef:Number = Math.min( sizeText.measuredWidth / textBitmapData.width, sizeText.measuredHeight / textBitmapData.height );
                        sizeMatrix = new Matrix(coef, 0, 0, coef);
                        textBitmapData = ImageSnapshot.captureBitmapData( sizeText, sizeMatrix );
    Thx in advance, d.

    Maybe but doubtful.  Now that you are using TextField, you must next decide on whether you are using embedFonts or not and set that property correctly.  Next, I would set defaultTextFormat to the same TextFormat you are using for setTextFormat.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

Maybe you are looking for