Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6252387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:47:34+00:00 2026-05-24T13:47:34+00:00

I have a flex .swf and a seperate AIR project which I’m trying to

  • 0

I have a flex .swf and a seperate AIR project which I’m trying to get to communicate with each other via a socket.

The two programs are connecting ok, and the .swf is able to send data across to the AIR application without problem. However, I’m finding that when the AIR app sends data back to Flex, it is never received.

  • The .swf is launched locally via a file:// URI in the browser.
  • The .swf connects, and the CONNECT event is fired
  • I’ve added breakpoints looking for requests for a policy file as suggested here, but I don’t ever see the request for a policy file get issued from the SWF to the AIR app.

Here’s the snippet of code I’m running from the SWF to listen for data:

    private var address:String;
    private var port:int;
    private var socket:Socket;
    private var log:ILogger = LogUtil.getLogger(this);

    public function SocketPlayer(port:int=41051,address:String="127.0.0.1")
    {
        this.port = port;
        this.address = address;
        connect();
    }
    public function connect():void
    {
        socket = new Socket();
        socket.addEventListener(DataEvent.DATA,onData);
        socket.addEventListener(Event.CLOSE,logEvent);
        socket.addEventListener(Event.CONNECT,logEvent);
        socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR,logEvent);
        socket.addEventListener(IOErrorEvent.IO_ERROR,logEvent);
        socket.connect(address,port);
        log.info("Socket connected on {0}:{1}",address,port);
    }
    private function logEvent(event:Event):void
    {
        log.info("Event: {0}", ObjectUtil.toString(event));
        if (event is TextEvent)
        {
            log.error(TextEvent(event).text)
        }
    }
    private function onData(event:DataEvent):void
    {
        log.info("Data: " + event.data);
    }

Here’s the code used in the AIR app to send the data:

    public function execute():void
    {
        var message:String = "Testing...";
        socket.writeUTF(message);
        socket.flush();
    }

(Note that socket is stored locally as passed in the ServerSocketConnectEvent, though this code is not shown here)

If I place a breakpoint in the code that is sending within the SWF, I notice that the socket has a private _timeoutEvent property, which is set to an instance of a flash.events.SecurityErrorEvent with the following error text:

Error #2048: Security sandbox violation: file:///Users/martypitt/dev//ParsleyTest/bin-debug/RecordingTest.swf cannot load data from 127.0.0.1:41051.

However, the SecurityErrorEvent is never caught by my code (I’m not sure if this indicates it was actually ever dispatched).

Are there additional steps I need to take to allow this communication?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:47:35+00:00Added an answer on May 24, 2026 at 1:47 pm

    Whoops — the issue here is that I’m listening for the wrong event..

    I should be listening for ProgressEvent.SOCKET_DATA instead of DataEvent.ON_DATA, as this is a Socket, not an XMLSocket.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Flex 3 SWF in one Amazon S3 bucket, which dynamically loads
We have a Flex application which has several 'pages' worth of content. Each time
I have a Flex 4.5.1 application which loads another swf file (as a module
I have a html page which loads a flash(flex) swf file. Using https it
I have a mobile Flex project which I am deploying to iPhone/iPod and Android.
We have a Flex 3 application of which the main .swf is running in
I have a flex project with two .mxml files. Therefore, there are two .swf
I have a main Flex Application ('A.swf') loading a SubApplication (defined in' B.swf') via
I have a project which has several components loaded by a single preloader swf.
I have a flex application which is configured with blazeds sever and i am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.