LocalConnection and BitmapData

Hi.
I have a promlem with transferring BitmapData from one swf to
another by using LocalConnection:
//1st swf
sending_lc.send("lc_name", "functionName", 1, "2",
myBitmapData);
//2nd swf
receiving_lc.functionName = function(a,b,c){
trace(a);// output 1
trace(b);// output 2
trace(c);// output undefined <<<PROBLEM:)
Can anybody help me, please?
Thank you!

This post has a duplicate entry, original here:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1279966&enterthread=y

Similar Messages

  • Bitmap and BitmapData

    Finally taking a huge leap here and want to learn the Bitmap
    and BitmapData classes in AS3. I'm looking for any decent tutorials
    on my own but was wondering (for those that use it) what sites
    others here used while learning the classes. The shear power I've
    seen with regard to photographic images is just amazing. What sites
    do you guys recommend if I really want to learn this and unleash
    the "powa- of da beast"?

    Anyone? Just wanted to know if anyone had any good tutorials
    on Bitmap or BitmapData they'd like to share to get me going in the
    right direction....

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

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

  • LocalConnection and BitmabData

    Hi.
    I have a promlem with transferring BitmapData from one swf to
    another by using LocalConnection:
    //1st swf
    sending_lc.send("lc_name", "functionName", 1, "2",
    myBitmapData);
    //2nd swf
    receiving_lc.functionName = function(a,b,c){
    trace(a);// output 1
    trace(b);// output 2
    trace(c);// output undefined <<<PROBLEM:)
    Can anybody help me, please?
    Thank you!

    No, its not about the limit, its about the complex type of
    the object being sent. Flash uses references for complex objects
    when they are passed to functions as arguments. When using
    LocalConnection the SWF you send the BitmapData has a different
    memory address space than the receiving SWF so you get an
    undefined.
    Try it for yourself. Use 3 tier approach of LocalConnection:
    SWF1 <-----> SWF_GATEWAY <-----> SWF2
    1) non-working scenario:
    SWF1 sends BitmapData to SWF_GATEWAY that in turns sends it
    to SWF2, it will not work.
    2) working scenario:
    SWF1 sends BitmapData to SWF_GATEWAY that in turns sends it
    back to SWF1, it will work.

  • Flash Player 9, Director MX, LocalConnection and the file system sandbox

    I have a Director MX asset to which I have no source-code
    access. Previously I could use LocalConnection in a Flash Player 8
    projector to interact with the Director app, local to the
    file-system. I seem unable to do the same thing with a Flash Player
    9 projector. The director asset looks for and loads the relevant
    Flash projector and unloads itself when it is no longer present,
    and this functionality continues without a problem. However, when I
    use the LocalConnection.send method, the Flash player does not
    receive the expected responses.
    I know that this is a rather general and abstract question:
    put simply, does anyone know whether Flash Player 9 and Director MX
    can't talk to each other using LocalConnection?
    ps to pre-empt over-enthusiastic respondees, yes I am aware
    of other technologies such as AIR, Zinc etc, and no they're not a
    viable option for my particular project.

    Hi,
    the following sourcecode is compiled with Flexbuilder 2 and
    runs in flashplayer 9.0.115 as expected.
    How do you trigger the effect?
    best regards,
    kcell
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Button label="run"
    click="{wr1.play();}"></mx:Button>
    <mx:Label id="l1" top="20" text="this is label"
    visible="false"/>
    <mx:Image id="img1" source="@Embed('k.jpg')" top="40"
    visible="false"/>
    <mx:WipeRight id="wr1" target="{img1}" duration="1000"
    effectStart="img1.visible=true" effectEnd="{wr2.play();}"/>
    <mx:WipeRight id="wr2" target="{l1}" duration="1000"
    effectStart="l1.visible=true"/>
    </mx:Application>

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

  • LocalConnection and attachMovie...

    SORRY(BUT FOR ANYONE INTERESTED, THE PROBLEM WAS THE WORD
    "THIS" IN THE RECIEVING SWF... CHANGED TO _ROOT AND IT WORKS)
    hello,
    in the first (sending) swf is this code:
    one.onRelease=function(){
    var nChosen:Number=1;
    var sending_lc:LocalConnection = new LocalConnection();
    sending_lc.send("lcNumber", "methodToExecute", nChosen);
    two.onRelease=function(){
    var nChosen:Number=2;
    var sending_lc:LocalConnection = new LocalConnection();
    sending_lc.send("lcNumber", "methodToExecute", nChosen);
    and in the recieving .swf:
    // Code in the receiving SWF file
    this.createTextField("result_txt", 1, 10, 10, 100, 22);
    result_txt.border = true;
    var receiving_lc:LocalConnection = new LocalConnection();
    receiving_lc.methodToExecute = function(nChosen:Number) {
    this.attachMovie("circle"+nChosen, "circle",
    this.getNextHighestDepth(), {_x:180, _y:18});
    result_txt.text = nChosen;
    receiving_lc.connect("lcNumber");
    the textField properly displays nChosen, but the movieClip is
    not attaching (yes, the linkage name is set up, they are circle1
    and circle2)
    help appreciated thanks!

    http://www.adobe.com/devnet/director/articles/local_connect_objects_03.html#prepare:
    quote:
    Known Issues
    At this time, there are some situations in which
    LocalConnection objects do not behave as expected. These issues
    only arise for those using LocalConnection objects in Director MX
    2004/Shockwave Player 10 to connect with LocalConnection objects in
    Flash MX/Flash Player 6/Director MX. In these cases, the clients
    are both able to connect and exchange messages without producing
    any errors. The difficulty is that when the Director MX
    2004/Shockwave Player 10 client receives incoming messages, the
    allowDomain callback function is triggered as expected, but
    regardless of the return value it provides, the incoming message
    appears to be ignored. There are no known workarounds for this
    issue at this time, so the best measure of protection is to ensure
    that these version mismatches don't occur.
    however I am using Director10 and FlashCS3;
    dsdsdsdsd

  • Invisible parallel element and bitmapData

    Hi,
    I'm to rather new to AS3 and completely new to OSMF and so I hope somebody here can help me with the following.
    I want to make an application that plays two simultaneous streams (I suppose using parallel elements), where on of the streams is not visible on the stage/canvas. Of this second stream I would like to access the bitmapData to display it in another way (moving thumbnails of other videos).
    So I have two questions:
    First, how would I go about creating an element that doesn't show on the stage.
    And second, how do I get at the bitmapData of an element in OSMF.
    I hope somebody can help. Thanks, Heerko

    Hi Heerko,
    To make an element "invisible" you can check the LayoutMetadata class
    import org.osmf.layout.LayoutMetadata;
    import org.osmf.media.MediaElement;
    // element is the MediaElement you want to be invisible
    var metadata:LayoutMetadata = element.getMetadata(LayoutMetadata.LAYOUT_NAMESPACE) as LayoutMetadata;
    if (!metadata) {
        metadata=new LayoutMetadata();
        element.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, metadata);
    metadata.x = 0;
    metadata.y = 0;
    metadata.width =  0;
    metadata.height = 0;   // Setting width and height to 0 will make it look like if it was not visible
    Probably not the best solution, but does the work
    Now for your BitmapData question
    import flash.display.BitmapData;
    import flash.display.DisplayObject;
    import org.osmf.net.NetStreamDisplayObjectTrait;
    import org.osmf.traits.MediaTraitType;
    // Let's say you're loading a video for example
    // element is a VideoElement instance here
    var trait:NetStreamDisplayObjectTrait = element.getTrait(MediaTraitType.DISPLAY_OBJECT) as NetStreamDisplayObjectTrait;
    if(trait) {
        var d:DisplayObject = trait.displayObject as DisplayObject;
        var b:BitmapData = new BitmapData(d.width, d.height);
        b.draw(d); // Watch out though, if you're loading from a different domain, make sure you have set/loaded policy files, etc ...
    Hope it helps
    Cheers,
    Julien

  • Uh Oh... Major problem with iPad3 and BitmapData [HELP]

    So.. I have some stageWebView elements that use BitMapData to capture a screenshot of the browser to allow for other elements to animate ontop of the browser ( sharing options, etc ).
    When I capture this on the new iPad ... and add the bitmap to the stage the bitmap is zoomed in twice the size it should be.  Its not capturing the true viewport.  its zoomed in.
    This is what I'm using to capture the bitmap.
         SocialbitmapData = new BitmapData(socialWebView.viewPort.width, socialWebView.viewPort.height);
         socialWebView.drawViewPortToBitmapData(SocialbitmapData);
         socialViewBitmap = new Bitmap(SocialbitmapData);
         addChild(socialViewBitmap);
    Any help is appreciated

    I'll try that
    Just a note as well.   I wrote this solution ...  works perfectly when tested from the IDE ..    copyPixels fails to display anything on iPad2 or iPad3
      bitmapdataBrowser = new BitmapData(stage.stageWidth, stage.stageHeight);
                   bitmapdataBrowser.draw(stage);
                   bitmapDataA = new BitmapData(1024, 664);
                   bitmapDataA.copyPixels(bitmapdataBrowser, new Rectangle(0, 42, 1024, 664), new Point(0, 0));
                   var screenshot = new Bitmap(bitmapDataA);
                   addChild(screenshot);
                   screenshot.x = 0;
                   screenshot.y = 42;

  • Flex SWFLoader LocalConnection Click events problem

    Hi,
    I'm experiencing a issue while trying to integrate a SWF movie with Flex for using it to create an AddOn for Xcelsius SDK. The idea is to create a Map Addon , just like the ones that are included with Xcelsius but with a custom map of the region where i live.
    The swf communicates with Flex through a LocalConnection and sends a message each time a region has been clicked, Flex retrieves this event and copies a data row to another place in the Excel Spreadsheet, so other diagramms can feed themselves with this data and represent it or whatever.
    This localconnection works just fine when i execute the Flex Project alone, but when i generate the Addon (using the AddOn packager), this stops working. I introduced a label to use as debug so each time a message from the swf file comes , Flex will write the message in this Label.
    What i saw, and that is the strange part of this issue. is that this label is being Updated also in Xcelsius, because when i leave the Preview mode i can see on the edit window that the label has changed its text, but not during the Preview mode (it is where i need it to work)
    I am using Xcelius SDK 2.0.1 Hotfix 3 , Flex Builder 2, Flash cs5 (tried with AS2, AS3 and exporting for multiple browser)
    Has anybody experience the same issue?
    Know somebody a howto, tutorial or sample of a Custom map in Xcelsius?
    Where can i find good Documentation? (i have already the samples and tutorials from SAP)
    Thanks in advance,
    Alex.

    How are you embedding the map?
    Xcelsius does not use Flash maps (so does not embed them in a SWF).
    You may be better off using SVG for your map and compiling it into the Flex project using the [Embed] metadata like you can for SVG.
    Or like I did with AnyMap parse and draw the SVG on the fly instead.
    That way you don't need to embed a Flash map and use the LocalConnection.
    Regards
    Matt

  • Load a  external jpg in BitmapData

    Hello Everybody,
    I search a way to load a external jpg from my server in my
    swf to use
    it with the BitmapData-Class.
    The Method loadBitmap only works with images from my internal
    library.
    What do you think is the best way to solve this problem.
    For me it seems to be a little bit stupid to load the image
    in a MovieClip.
    Then Scan the Mc to write it in a BitmapData-Object.
    To Filter it. And then write it back to an MC.
    Do you know a way, where I can load it directly to and
    BitmapData-Object
    like this:
    1) load Image in BitmapData-Object
    2) Filter - Image
    3) attachBitmap to MovieClip
    I am a noob with Flash 8 and my english is very bad.
    So sorry and thanks for you help
    jm

    //import BitmapData
    import flash.display.BitmapData;
    //stop movie so it doesn't repeat over and over
    stop();
    //load a pic into an mc on the stage
    content_mc.loadMovie("flash.jpg", 1);
    //create a function that runs every frame (only for this
    example, it keeps running and you won't want that
    _root.onEnterFrame = function() {
    //this is the interesting bit, basically the next line is
    your preloader 100% action, the pic has to actually have been fully
    loaded before we can do this
    if (_root.content_mc.getBytesLoaded() ==
    _root.content_mc.getBytesTotal()) {
    //create a variable to hold the bitmapdata info
    myBitmapData = new
    flash.display.BitmapData(content_mc._width, content_mc._height,
    true, 0x00FFFFFF);
    //copy the bitmap into the bitmapdata variable we just
    created
    myBitmapData.draw(_root.content_mc);
    //now attach it to a different mc for the sake of example
    _root.content_mc2.attachBitmap(myBitmapData, 1, "auto",
    true);
    //rotate both movieclips so you can see the difference
    _root.content_mc._rotation = 30;
    _root.content_mc2._rotation = 30;
    supplied by myFlash83

  • LocalConnection: Receiving message from flash(.swf) file

    hi
    I have got a flash radio file (.swf) from third party which playes the songs. I need to integrate this inside my application.Application is portal and written in asp.net which launches this flash file as pop-up
    Scenario is : When user click on any song in .swf file, at the application we should be able to display its title.
    I have found(through reverse enginnering) that radio.flash file uses localConnection and send following parameters whenever the user click on any song.
    conn.send("basePlayerConnect,"setPlayerLabel","title","thumb","albumtitle")
    where title is string, thumb is image and albumtitle is string
    Now i have written a another flex application which has a textinput. i emebeded this in the portal application (as embedded .swf file). Whenever a radio popup is launch at site and user click on any song the title of the song should be displayed inside this flex application
    Code is:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="{createLw()}">
    <mx:Script>
        <![CDATA[
        import flash.net.LocalConnection;
        private var incoming_lc:LocalConnection = new LocalConnection();
        private function createLw()
            incoming_lc.connect("basePlayerConnect");
              incoming_lc.client = this;
        function setPlayerLabel(param1:String,param2:String,param3:String):void
          sentMessage_txt.text = "param1";
        ]]>
    </mx:Script>
        <mx:TextInput id="sentMessage_txt" x="0" y="0"/>
    </mx:Application>
    this is very imp for me please let me know how to ahieve this

    Try
        public function setPlayerLabel(param1:String,param2:String,param3:String):void
          sentMessage_txt.text = param1;     // no quotes
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • AIR to AIR localconnection working only in one direction

    I have two simple air applications and i need to be able to send a message to the opposite app on the click of a button. My code works fine from app1 to app2 but i am getting the following error when trying to send a message from app2 to app1: Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.LocalConnection was unable to invoke callback returnMessageHandler. error=ReferenceError: Error #1069: Property returnMessageHandler not found on flash.net.LocalConnection and there is no default value.
    Here is my code:
    App1
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initConn();">
        <mx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import flash.net.LocalConnection;
                public var conn:LocalConnection;
                public function initConn():void
                    conn = new LocalConnection();
                    conn.allowDomain("app#app2");
                    conn.addEventListener(StatusEvent.STATUS, onStatus);
                    //Alert.show(conn.domain);
                    try
                        conn.connect("returnConnection");
                    catch (error:ArgumentError)
                        trace("Can't connect.");
                private function onStatus(event:StatusEvent):void
                    switch (event.level)
                        case "status":
                            //Alert.show("LocalConnection.send() succeeded");
                            break;
                        case "error":
                            //Alert.show("LocalConnection.send() failed");
                            break;
                public function returnMessageHandler():void
                    Alert.show("Recieved return message from app2");
                public function sendMessage():void
                    conn.send("app#app2:taskConnection", "localconnectionHandler");
            ]]>
        </mx:Script>
        <mx:Button x="10" y="10" label="send message" click="sendMessage();"/>
    </mx:WindowedApplication>
    App2
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="InitConn();">
        <mx:Script>
            <![CDATA[
              import mx.controls.Alert;
              import flash.net.LocalConnection;
              public var conn:LocalConnection;
              public function InitConn():void
                    conn = new LocalConnection();
                    conn.addEventListener(StatusEvent.STATUS, onStatus);
                    conn.allowDomain("app#app1");
                    conn.client = this;
                    //Alert.show(conn.domain);
                    try
                        conn.connect("taskConnection");
                    catch (error:ArgumentError)
                        trace("Can't connect.");
                public function onStatus(event:StatusEvent):void
                    switch (event.level)
                        case "status":
                            Alert.show("LocalConnection.send() succeeded");
                            break;
                        case "error":
                            Alert.show("LocalConnection.send() failed");
                            break;
                public function localconnectionHandler():void
                    Alert.show("Recieved message from app1");
                public function sendReturnMessage():void
                    conn.send("app#app1:returnConnection", "returnMessageHandler");
            ]]>
        </mx:Script>
        <mx:Button x="10" y="10" label="send return message" click="sendReturnMessage()"/>
    </mx:WindowedApplication>
    If anyone can plese help me figure this out I would greatly appriciate it I'm tearing my hair out!
    Thanks
    Adam
    Flexchief

    I figured out what my problem was...
    app1 needed the following line: conn.client = this;
    in order to receive the return message from app2.
    Flexchief

  • AS3 Scripting for Animated GIF

    Hi,
    I am trying to create an animated GIF for a white noise animation (needed for those viewers who don't have access to a Flash player). The SWF version runs perfectly. Currently, all of the AS3 for the bitmapData.noise and bitmapData.palettemap script is in the first keyframe. So, when I export as an animated GIF, I get a white screen in playback.
    I think the problem for the animated GIF is that there are no frames past the first frame. But, I am not sure how to add frames or re-write the AS3 to get a 30 second animated GIF? I tried duplicating the first keyframe into several new keyframes and get error messages. I would appreciate any help.
    Here's the AS3 in the first keyframe that works well for a SWF (previous relevant thread: http://forums.adobe.com/thread/734335?tstart=0):
    var array:Array=new Array();
    for (var i:uint = 0; i < 255; i++) {
    array[i] = 0xffffff * (i % 2);
    var _bitmapData:BitmapData;
    var bDHolder:Sprite = new Sprite();
    _bitmapData = new BitmapData(stage.stageWidth/4, stage.stageHeight/4);
    bDHolder.addChild(new Bitmap(_bitmapData));
    bDHolder.scaleX = bDHolder.scaleY = 4;
    addChild(bDHolder);
    addEventListener(Event.ENTER_FRAME, onSpriteEnterFrame);
    function makeNoise():void {
                _bitmapData.noise(getTimer(), 100, 255, 7, true);
                _bitmapData.paletteMap(_bitmapData, _bitmapData.rect, new Point(0,0), array, array,array);
    function onSpriteEnterFrame(event:Event):void {
                makeNoise();
    var itsNoisy:Boolean = true;
    stage.addEventListener(MouseEvent.MOUSE_DOWN, manageNoise);
    function manageNoise(evt:MouseEvent):void {
         if(itsNoisy){
             removeEventListener(Event.ENTER_FRAME, onSpriteEnterFrame)
         } else {
             addEventListener(Event.ENTER_FRAME, onSpriteEnterFrame)
         itsNoisy = !itsNoisy;
    Kind Regards,

    Jimmy,
    You may (also) try to ask in the (most) relevant Photoshop forum.
    http://forums.adobe.com/community/photoshop

Maybe you are looking for

  • CONNECTING IPAD TO DENON VIA HDMI

    Can I use my ipad to connect to denon HDMI port so that I can use it as a display device to view the onscreen menu of the denon. As you know onscreen menu or GUI of denon is displayed only via HDMI port, so I want to connect my ipad to this HDMI out

  • "biggest" character in an order by operation using NLS_SORT=WEST_EUROPEAN

    I thought this would be simple to find out, but it isn't. I'd like to find the single character that comes out last in a "sort by" on a varchar field. If I use the normal ASCII sort order everything works as expected and the characters like ~ and } c

  • Alert view with a text field

    Hi, Is it possible on iPhone to create an alert with a text field? Thanks, Nava

  • Positioning of submenus?

    Hi- can anyone tell how to make Spry submenus appear ABOVE the main menu bar instead of below? Thanks, Jaclyn

  • Book_mark_inconsistent_ipad

    Hi, After publishing my captivate 6 project to LMS with AICC standards. Book mark functionality is working inconsistently. What is the reason for this?? Regards, Lokesh V