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 8614211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:04:10+00:00 2026-06-12T05:04:10+00:00

Hello i am trying to open socket in flash.So i followed one tutorial but

  • 0

Hello i am trying to open socket in flash.So i followed one tutorial but i got errors:

package com.game.game
{
    import flash.net.socket;
    import flash.events.*;
    public dynamic class game
    {
        var mysocket:Socket = new Socket();

        Security.allowDomain("*");

        mysocket.addEventListener(Event.CONNECT, onConnect);
        mysocket.addEventListener(Event.CLOSE, onClose);
        mysocket.addEventListener(IOErrorEvent.IO_ERROR, onError);
        mysocket.addEventListener(ProgressEvent.SOCKET_DATA, onResponse);
        mysocket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecError);

        mysocket.connect("hejp.co.uk", 80);
    }

}

i got these errors:

1120: Access of undefined property mysocket.
1120: Access of undefined property onConnect.
1120: Access of undefined property mysocket.
1120: Access of undefined property onClose.
1120: Access of undefined property mysocket.
1120: Access of undefined property onError.
1120: Access of undefined property mysocket.
1120: Access of undefined property onResponse.
1120: Access of undefined property mysocket.
1120: Access of undefined property onSecError.
1120: Access of undefined property mysocket.
The class 'com.game.game.game' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

Must i import something ???
Any ideas ?

  • 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-06-12T05:04:11+00:00Added an answer on June 12, 2026 at 5:04 am

    It looks like you have the correct code for sockets, but it needs to be inside of a method. If you put the code to instantiate the socket inside of the constructor method, then you will connect to the socket when you instantiate the class. Alternatively, You could put the socket code inside a different public method that could be called from outside the class.

    You may also need to state the scope of your class properties and methods by stating public or private at their declaration.

    You also need to declare each of the listener functions, otherwise the socket won’t have functions to connect to.

    package com.game.game
    {
        import flash.net.socket;
        import flash.events.*;
        public dynamic class game
        {
            //public class variables
            public var mysocket:Socket;
    
            //constructor
            public function game() {
                mysocket = new Socket();
    
                Security.allowDomain("*");
    
                mysocket.addEventListener(Event.CONNECT, onConnect);
                mysocket.addEventListener(Event.CLOSE, onClose);
                mysocket.addEventListener(IOErrorEvent.IO_ERROR, onError);
                mysocket.addEventListener(ProgressEvent.SOCKET_DATA, onResponse);
                mysocket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecError);
    
                mysocket.connect("hejp.co.uk", 80);
            }
    
            //private listener methods
            private function onConnect(evt:Event):void {
                //connect method code
            }
    
            private function onClose(evt:Event):void {
                //close method code
            }
    
            private function onError(evt:IOErrorEvent):void {
                //error method code
            }
    
            private function onResponse(evt:ProgressEvent):void {
                //response method code
            }
    
            private function onSecError(evt:SecurityErrorEvent):void {
                //security error method code
            }
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello i am trying a sqlite database tutorial to build, but its not working
I'm simply trying to run the basic openCV hello world tutorial code, but I'm
I'm trying to compile a hello-world app: 8g test1.go -o test1.8 Error: open -o:
Hello im trying to echo only the 50 letters, but something in my code
Hello I am trying to create a custom expandable listview, but the documentation on
Hello I'm trying to populate a mschart from sql but even if the series
Hello iam trying to store sum information inside a SQL Server table , but
Hello everyone iam trying to open a aspx page in a dialog box window
I am trying to open a socket connection from my iphone simulator and send
Hello I´m trying using the next piece of code: import pickle object = Object()

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.