Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SWF Can't Access Network

Explorer ,
Oct 16, 2014 Oct 16, 2014

Hello, so I'm making a Flash game, and I got LAN connection to work, but for some reason when I upload the SWF to a website and try to access it, I get the whole "do you want to allow this to access the internet?" conformation box, except I can't actually change any of its settings. It's all blank and when I click on it nothing happens. Here is a screenshot: 7170db2f8b7108246a3729102a711700

I tried opening it on multiple computers, all of them get the same issue. Does anyone have any ideas why this is happening?

TOPICS
ActionScript
945
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 17, 2014 Oct 17, 2014

you must be calling click_lan_multiplayer before your group is defined.

in your netStatus function you should be defining your group when

event.info.code==  "NetConnection.Connect.Success":

check my P2P class.

Translate
Community Expert ,
Oct 16, 2014 Oct 16, 2014

click file>publish settings>swf>local playback security>access local files only.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 16, 2014 Oct 16, 2014

It was already set to that, no change. I also tried changing it to "access network only" but that didn't do anything either.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 16, 2014 Oct 16, 2014

what's the url of your embedding html file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 16, 2014 Oct 16, 2014

It's literally just a link, I have it up right here: http://www.newgrounds.com/dump/item/16952a538d620b8ab83fb39530ba20fd

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 16, 2014 Oct 16, 2014

upload that to a file server that only loads your html and your swf.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 16, 2014 Oct 16, 2014
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014

copy/pasteyour netstream/netconnection code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Yeah, I'm pretty sure I just coded something wrong. You can be the judge of that:

import flash.events.NetStatusEvent;

import flash.net.NetConnection;

import flash.net.NetGroup;

import flash.net.GroupSpecifier;

var nc:NetConnection;

var group:NetGroup;

var obj:Object = {};

var p1x;

var p1y;

var p2x;

var p2y;

var m_switch1 = "false";

var m_switch2 = "false";

var multiplayer = "off";

nc = new NetConnection();

var message:Object = {varName:'p1_up',value:p1_up};

addEventListener(Event.ENTER_FRAME, connect);

nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);

nc.connect("rtmfp:");

function netStatus(event:NetStatusEvent):void

{

    switch (event.info.code)

    {

        case "NetConnection.Connect.Success" :

            setupGroup();

            break;

        case "NetGroup.Connect.Success" :

            break;

        case "NetGroup.Posting.Notify" :

        break;

        case "NetGroup.SendTo.Notify" :

            switch ( event.info.message.varName )

            {

                case 'p1y' :

                    p1y = event.info.message.value;

                    break;

                case 'p1x' :

                    p1x = event.info.message.value;

                    break;

                case 'm_switch1' :

                    m_switch1 = event.info.message.value;

                    break;

                case 'p1_up' :

                    p1_up = event.info.message.value;

                    break;

                case 'p1_down' :

                    p1_down = event.info.message.value;

                    break;

                case 'p1_left' :

                    p1_left = event.info.message.value;

                    break;

                case 'p1_right' :

                    p1_right = event.info.message.value;

                    break;

                case 'p1_attack' :

                    p1_attack = event.info.message.value;

                    break;

                case 'p1_block' :

                    p1_block = event.info.message.value;

                    break;

                case 'p2y' :

                    p2y = event.info.message.value;

                    break;

                case 'p2x' :

                    p2x = event.info.message.value;

                    break;

                case 'p2_up' :

                    p2_up = event.info.message.value;

                    break;

                case 'p2_down' :

                    p2_down = event.info.message.value;

                    break;

                case 'p2_left' :

                    p2_left = event.info.message.value;

                    break;

                case 'p2_right' :

                    p2_right = event.info.message.value;

                    break;

                case 'p2_attack' :

                    p2_attack = event.info.message.value;

                    break;

                case 'p2_block' :

                    p2_block = event.info.message.value;

                    break;

            }

            break;

            break;

        case "NetGroup.Neighbor.Connect" :

            break;

    }

}

function connect(e:Event):void

{

    group.sendToAllNeighbors(obj);

    if (m_switch2=="true")

    {

        group.sendToAllNeighbors( {varName: 'p1_up', value: p1_up});

        group.sendToAllNeighbors( {varName: 'p1x', value: p1x});

        group.sendToAllNeighbors( {varName: 'p1y', value: p1y});

        group.sendToAllNeighbors( {varName: 'p1_down', value: p1_down});

        group.sendToAllNeighbors( {varName: 'p1_left', value: p1_left});

        group.sendToAllNeighbors( {varName: 'p1_right', value: p1_right});

        group.sendToAllNeighbors( {varName: 'p1_attack', value: p1_attack});

        group.sendToAllNeighbors( {varName: 'p1_block', value: p1_block});

        p1x = p1.x;

        p1y = p1.y;

        p2.x = p2x;

        p2.y = p2y;

    }

    if (m_switch1=="true")

    {

        if (m_switch2=="false")

        {

            group.sendToAllNeighbors( {varName: 'p2x', value: p2x});

            group.sendToAllNeighbors( {varName: 'p2y', value: p2y});

            group.sendToAllNeighbors( {varName: 'p2_up', value: p2_up});

            group.sendToAllNeighbors( {varName: 'p2_down', value: p2_down});

            group.sendToAllNeighbors( {varName: 'p2_left', value: p2_left});

            group.sendToAllNeighbors( {varName: 'p2_right', value: p2_right});

            group.sendToAllNeighbors( {varName: 'p2_attack', value: p2_attack});

            group.sendToAllNeighbors( {varName: 'p2_block', value: p2_block});

            p2x = p2.x;

            p2y = p2.y;

            p1.x = p1x;

            p1.y = p1y;

        }

    }

}

function setupGroup():void

{

    var groupspec:GroupSpecifier = new GroupSpecifier("test");

    groupspec.postingEnabled = true;

    groupspec.routingEnabled = true;

    groupspec.ipMulticastMemberUpdatesEnabled = true;

    groupspec.addIPMulticastAddress("225.225.0.1:30000");

    group = new NetGroup(nc,groupspec.groupspecWithAuthorizations());

    group.addEventListener(NetStatusEvent.NET_STATUS,netStatus);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014

what's that:

nc.connect("rtmfp:");

are you trying to create a peer-to-peer connection?  or do you have a flash media server?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Sorry, should have been more specific.

I'm trying to make a peer-to-peer connection. That "rtmfp:" thing is, according to the tutorial I used:

"...we can now attempt to create a new NetConnection object and connect to via Real Time Media Flow Protocol (RTMFP).  RTMFP was developed by Adobe which basically enables low latency UDP streamings and direct P2P communication between multiple Adobe Flash Players and applications."

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014

that's wrong.

here's an excerpt from a book (Flash Game Development: In a Social, Mobile and 3D World) i wrote last year:

Peer-to-peer games

Since Flash player 10, you can create multiplayer games without the need of an intermediary server to facilitate player communication.  The Flash player can use a protocol (Adobe's Real-Time Media Flow Protocol) that allows direct peer-to-peer communication.

Instead of using server-side code to handle the game logic and coordinate game state among players, each peer in the network handles their own game logic and game state and communicates that directly to their peers and each peer updates their game state based on the data received from others.

To use peer-to-peer networking each peer must connect with an Adobe server.  Peer-to-peer communication does not go through that server (or it that would not be peer-to-peer) but peers must stay connected with the Adobe server in order to communicate with each other.

To communicate with the Adobe server you should use your own server URL and developer key. That URL and key can be obtained at http://www.adobe.com/cfusion/entitlement/index.cfm?e=cirrus.

Below is a simple tic-tac-toe game that uses Adobe's peer-to-peer networking to pair-up players.  The NetConnection class is used to establish a connection to the Adobe server while the NetGroup class is used for peer-to-peer communication.

I used only a small part of the NetGroup methods for the tic-tac-toe game but there are more available if you are sharing data among many users and/or sharing large amounts of data.

here's part of the P2P class that shows how to use adobe's peer-to-peer:

var nc:NetConnection = new NetConnection();

            // Add event listener to handle connections and data to and from this peer.

            nc.addEventListener(NetStatusEvent.NET_STATUS,netStatusF);

            // Use your server address and key (from Adobe, http://www.adobe.com/cfusion/entitlement/index.cfm?e=cirrus)

const SERVER:String="rtmfp://p2p.rtmfp.net/";
const DEVKEY:String="use your own development key";

            nc.connect(SERVER+DEVKEY);

///////////////////////////////////////////////////////

here's the entire class:

package com.kglad{

    import flash.display.MovieClip

    import flash.events.NetStatusEvent;

    import flash.net.NetConnection;

    import flash.net.NetGroup;

    import flash.net.GroupSpecifier;

    import flash.net.NetGroupReplicationStrategy;

    public class P2P {

        private static var nc:NetConnection;

        private static var netGroup:NetGroup;

        private static var main:MovieClip;

        internal static function init(_main:MovieClip):void {

            main = _main;

            // Create a NetConnection instance

            nc = new NetConnection();

            // Add event listener to handle connections and data to and from this peer.

            nc.addEventListener(NetStatusEvent.NET_STATUS,netStatusF);

            // Use your server address and key (from Adobe, http://www.adobe.com/cfusion/entitlement/index.cfm?e=cirrus)

            nc.connect(Data.SERVER+Data.DEVKEY);

        }

        private static function netStatusF(e:NetStatusEvent):void {

            CONFIG::DEBUG {

                main.textF("p2p netStatusF begin:",main.message_tf);

                main.stringifyF(e.info);

                main.textF("p2p netStatusF end:",main.message_tf);

            }

           

            switch (e.info.code) {

                case "NetConnection.Connect.Success":

                    // When this user connects, initialize group

                    Data.id = nc.nearID;

                    initializeGroupF();

                    break;

                case "NetGroup.Neighbor.Connect":

                    // only ~14 closest peers will be neighbors

                    Data.addToGroup(e.info.neighbor);

                    CONFIG::DEBUG{

                        main.textF("*** addToGroup: ***"+e.info.neighbor,main.message_tf);

                    }

                    // Notify user they need to enter a name.

                    if(main.message_tf.text.indexOf("To start, enter your name and click SEND")==-1 && Data.nameS.length<1){

                        main.textF("To start, enter your name and click SEND",main.message_tf);

                        main.sendName_btn.visible = true;

                    }

                    break;

                case "NetGroup.Neighbor.Disconnect":

                    // A peer connection was lost.  Remove from Data.groupAddressA and check if peer was this user's opponent.

                    Data.removeFromGroup(e.info.neighbor);

                    main.checkGroupLostF(e.info.neighbor);

                    break;

                case "NetGroup.SendTo.Notify":

                    CONFIG::DEBUG{

                        main.textF("*** NOTIFY *** "+Data.groupAddressA.length,main.message_tf);

                    }

                    // Process received data in Main.

                    main.receiveDataF(e.info);

                    // Allowing netGroup.sendToNearest() to execute crashes the debug flash player. I could not find a problem commenting out this section but I only tested with up to 40 peers.

                    /*

                    if(e.info.fromLocal){

                        main.receiveDataF(e.info);

                    } else {

                        netGroup.sendToNearest(e.info.message, e.info.message.destination);

                    }

                    */

                    break;

            }

        }

        private static function initializeGroupF():void {

            // Define a GroupSpecifier.  Presumably using this should allow each developer (with their one key) to develop many different games and applications.

            // This is the tic-tac-toe group.

            var groupSpecifier:GroupSpecifier=new GroupSpecifier("tttGroup");

            // Enable posting to entire group.

            groupSpecifier.postingEnabled = true;

            // Enable direct routing a peer.

            groupSpecifier.routingEnabled = true;

            // Allow peers to join the group automatically.

            groupSpecifier.serverChannelEnabled = true;

            // Create NetGroup instance.

            netGroup=new NetGroup(nc,groupSpecifier.groupspecWithAuthorizations());

            netGroup.addEventListener(NetStatusEvent.NET_STATUS,netStatusF);

        }

       

        internal static function sendDataF(obj:Object):void {

            if(Data.connectionAddressF.length>0){

                // communicate only with the peer at Data.connectionAddressF

                obj.destination = Data.connectionAddressF;

                netGroup.sendToNearest(obj, obj.destination);

            } else {

                netGroup.sendToAllNeighbors(obj);

            }

        }

        internal static function sendDirectedDataF(obj:Object):void {

            // Send message to only one peer.

            netGroup.sendToNearest(obj, obj.destination);

           

        }

        // I don't need this function but it shows how to send a message to everyone in the group.

        internal static function sendDataToAllF(obj:Object):void{

            netGroup.sendToAllNeighbors(obj);

        }

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Thanks so much, I'll try this out and report back what happens. But I have one question, if I wanted to distribute this game out online or something, I want them to also be able to play peer-to-peer with each other. According to what you've written up, unless I'm reading it wrong, I would have to use my own address in the script, and that would just make MY internet connection work with peer-to-peer, but no one else's?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014

you use adobe's address.  they supply the servers that allows users to connect with each other.

again:

To use peer-to-peer networking each peer must connect with an Adobe server.  Peer-to-peer communication does not go through that server (or it that would not be peer-to-peer) but peers must stay connected with the Adobe server in order to communicate with each other.

To communicate with the Adobe server you should use your own server URL and developer key. That URL and key can be obtained at http://www.adobe.com/cfusion/entitlement/index.cfm?e=cirrus

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Alright, I've been playing around with it for a bit, so far I haven't used the package you set up, but I used my code I have written out and tried replacing the vars and such:

nc = new NetConnection();

var message:Object = {varName:'p1_up',value:p1_up};

nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);

const SERVER:String = "xxxx";

const DEVKEY:String = "xxxx";

nc.addEventListener(NetStatusEvent.NET_STATUS,connect);

nc.connect(SERVER+DEVKEY);

I don't get any errors or anything, up until I click on the "LAN multiplayer" button I have set up, which in the code is supposed to do this:

function click_lan_multiplayer(event:MouseEvent):void

{   

    multiplayer = "on";

    if (m_switch1=="false")

    {

    group.sendToAllNeighbors( {varName: 'm_switch1', value: m_switch1});

        m_switch2 = "false";

        m_switch1 = "true";

        gotoAndStop(101);

    }

    else

    {

        m_switch2 = "true";

        gotoAndStop(101);

    }

}

Basically, I have it set up so it decides who is player 1 and player 2 depending on who connects first. For some reason, when I click on the button, I get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at Game_fla::MainTimeline/click_lan_multiplayer()

That did not happen before.

Do I have to use the package you have created, or can I just make some tweaks to the code I already have set up? If I have to use the package, I have no clue what I'm doing because when I paste it on the frame it says the package is "unexpected".

Thanks for all of your help so far either way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014

these need to be fixed:

const SERVER:String = "xxxx";

const DEVKEY:String = "xxxx";

and all your variables need to be declared.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Oh no, ha ha the "xxxx" I put in just because I didn't think it would be a good idea to put in my developer keys in a public forum (unless it doesn't matter?), I have the actual ones pasted in the script in the Flash document.

And as for all of the variables being declared, I thought they all were already? The error goes away when I remove the "group.sendToAllNeighbors( {varName: 'm_switch1', value: m_switch1});" from the "function click_lan_multiplayer(event:MouseEvent):void". I'm pretty sure I just did something totally wrong with the whole internet connection thing...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014

i don't see where they're declared.

use:

var nc:NetConnection = new NetConnection();

var message:Object = {varName:'p1_up',value:p1_up};

nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);

const SERVER:String = "xxxx";

const DEVKEY:String = "xxxx";

nc.addEventListener(NetStatusEvent.NET_STATUS,connect);

nc.connect(SERVER+DEVKEY);

// i don't know what these strings are supposed to do

var multiplayer:String;

var m_switch1:String;

var m_switch2:String;

var group:NetGroup;

function click_lan_multiplayer(event:MouseEvent):void

{  

var groupSpecifier:GroupSpecifier=new GroupSpecifier("some name for your group");

            // Enable posting to entire group.

            groupSpecifier.postingEnabled = true;

            // Enable direct routing a peer.

            groupSpecifier.routingEnabled = true;

            // Allow peers to join the group automatically.

            groupSpecifier.serverChannelEnabled = true;


group=new NetGroup(nc,groupSpecifier.groupspecWithAuthorizations());

// i'm not sure what the m_switch strings are supposed to convey

      m_switch2 = "false";

        m_switch1 = "true";

    group.sendToAllNeighbors( {varName: 'm_switch1', value: m_switch1});

 

        gotoAndStop(101);

    }

    else

    {

        m_switch2 = "true";

        gotoAndStop(101);

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Still no luck, I get this error:

ArgumentError: Error #2126: NetConnection object must be connected.

    at flash.net::NetGroup/ctor()

    at flash.net::NetGroup()

    at GameNewConnection_fla::MainTimeline/click_lan_multiplayer()

This is what I have set up:

var nc:NetConnection = new NetConnection();

var message:Object = {varName:'p1_up',value:p1_up};

nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);

const SERVER:String = "rtmfp://p2p.rtmfp.net/bc2e309a9922d17c5c93d209-67472b5c1565/";

const DEVKEY:String = "bc2e309a9922d17c5c93d209-67472b5c1565";

nc.addEventListener(NetStatusEvent.NET_STATUS,connect);

nc.connect(SERVER+DEVKEY);

var multiplayer = "off";

var m_switch1 = "false";

var m_switch2 = "false";

var group:NetGroup;

function click_lan_multiplayer(event:MouseEvent):void

{

    var groupSpecifier:GroupSpecifier = new GroupSpecifier("TheGroup");

    groupSpecifier.postingEnabled = true;

    groupSpecifier.routingEnabled = true;

    // Allow peers to join the group automatically.

    groupSpecifier.serverChannelEnabled = true;

    group = new NetGroup(nc,groupSpecifier.groupspecWithAuthorizations());

    multiplayer = "on";

    if (m_switch1=="false")

    {

        group.sendToAllNeighbors( {varName: 'm_switch1', value: m_switch1});

        m_switch2 = "false";

        m_switch1 = "true";

        gotoAndStop(101);

    }

    else

    {

        m_switch2 = "true";

        gotoAndStop(101);

    }

}

On another frame right on the layer above it I have this:

//Network

import flash.display.MovieClip;

import flash.events.NetStatusEvent;

import flash.net.NetConnection;

import flash.net.NetGroup;

import flash.net.GroupSpecifier;

import flash.net.NetGroupReplicationStrategy;

var obj:Object = {};

var p1x;

var p1y;

var p2x;

var p2y;

function netStatus(event:NetStatusEvent):void

{

    switch (event.info.code)

    {

        case "NetConnection.Connect.Success" :

            setupGroup();

            break;

        case "NetGroup.Connect.Success" :

            break;

        case "NetGroup.Neighbor.Connect" :

            break;

        case "NetGroup.Posting.Notify" :

            break;

        case "NetGroup.SendTo.Notify" :

            switch ( event.info.message.varName )

            {

                case 'p1y' :

                    p1y = event.info.message.value;

                    break;

                case 'p1x' :

                    p1x = event.info.message.value;

                    break;

                case 'm_switch1' :

                    m_switch1 = event.info.message.value;

                    break;

                case 'p1_up' :

                    p1_up = event.info.message.value;

                    break;

                case 'p1_down' :

                    p1_down = event.info.message.value;

                    break;

                case 'p1_left' :

                    p1_left = event.info.message.value;

                    break;

                case 'p1_right' :

                    p1_right = event.info.message.value;

                    break;

                case 'p1_attack' :

                    p1_attack = event.info.message.value;

                    break;

                case 'p1_block' :

                    p1_block = event.info.message.value;

                    break;

                case 'p2y' :

                    p2y = event.info.message.value;

                    break;

                case 'p2x' :

                    p2x = event.info.message.value;

                    break;

                case 'p2_up' :

                    p2_up = event.info.message.value;

                    break;

                case 'p2_down' :

                    p2_down = event.info.message.value;

                    break;

                case 'p2_left' :

                    p2_left = event.info.message.value;

                    break;

                case 'p2_right' :

                    p2_right = event.info.message.value;

                    break;

                case 'p2_attack' :

                    p2_attack = event.info.message.value;

                    break;

                case 'p2_block' :

                    p2_block = event.info.message.value;

                    break;

            }

            break;

            break;

        case "NetGroup.Neighbor.Connect" :

            break;

    }

}

function connect(e:Event):void

{

    group.sendToAllNeighbors(obj);

    if (m_switch2=="true")

    {

        group.sendToAllNeighbors( {varName: 'p1_up', value: p1_up});

        group.sendToAllNeighbors( {varName: 'p1x', value: p1x});

        group.sendToAllNeighbors( {varName: 'p1y', value: p1y});

        group.sendToAllNeighbors( {varName: 'p1_down', value: p1_down});

        group.sendToAllNeighbors( {varName: 'p1_left', value: p1_left});

        group.sendToAllNeighbors( {varName: 'p1_right', value: p1_right});

        group.sendToAllNeighbors( {varName: 'p1_attack', value: p1_attack});

        group.sendToAllNeighbors( {varName: 'p1_block', value: p1_block});

        p1x = p1.x;

        p1y = p1.y;

        p2.x = p2x;

        p2.y = p2y;

    }

    if (m_switch1=="true")

    {

        if (m_switch2=="false")

        {

            group.sendToAllNeighbors( {varName: 'p2x', value: p2x});

            group.sendToAllNeighbors( {varName: 'p2y', value: p2y});

            group.sendToAllNeighbors( {varName: 'p2_up', value: p2_up});

            group.sendToAllNeighbors( {varName: 'p2_down', value: p2_down});

            group.sendToAllNeighbors( {varName: 'p2_left', value: p2_left});

            group.sendToAllNeighbors( {varName: 'p2_right', value: p2_right});

            group.sendToAllNeighbors( {varName: 'p2_attack', value: p2_attack});

            group.sendToAllNeighbors( {varName: 'p2_block', value: p2_block});

            p2x = p2.x;

            p2y = p2.y;

            p1.x = p1x;

            p1.y = p1y;

        }

    }

}

function setupGroup():void

{

    var groupspec:GroupSpecifier = new GroupSpecifier("test");

    groupspec.postingEnabled = true;

    groupspec.routingEnabled = true;

    groupspec.ipMulticastMemberUpdatesEnabled = true;

    groupspec.addIPMulticastAddress("225.225.0.1:30000");

    group = new NetGroup(nc,groupspec.groupspecWithAuthorizations());

    group.addEventListener(NetStatusEvent.NET_STATUS,netStatus);

}

The "m_switches" are meant to determine who is P1 and P2 when two peers are connected.

It just seems no matter what, if I have that "sendtoallneighbors" thing put into the code, it gives me an error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014

you must be calling click_lan_multiplayer before your group is defined.

in your netStatus function you should be defining your group when

event.info.code==  "NetConnection.Connect.Success":

check my P2P class.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Alright, but I know for a fact my click_lan_multiplayer is defined well before the button is clicked to call it. It works fine when I take out the "SendToAllNeighbors" line of it and it goes to the frame, but with that line in, I get the error.

As for the netStatus function, I do have a group defined in it, which is:

function setupGroup():void

{

    var groupspec:GroupSpecifier = new GroupSpecifier("test");

    groupspec.postingEnabled = true;

    groupspec.routingEnabled = true;

    groupspec.ipMulticastMemberUpdatesEnabled = true;

    groupspec.addIPMulticastAddress("225.225.0.1:30000");

    group = new NetGroup(nc,groupspec.groupspecWithAuthorizations());

    group.addEventListener(NetStatusEvent.NET_STATUS,netStatus);

}

Is something coded incorrectly here?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Oh, just found something else interesting, when I have this set up:

const SERVER:String = "rtmfp://p2p.rtmfp.net/bc2e309a9922d17c5c93d209-67472b5c1565/";

const DEVKEY:String = "bc2e309a9922d17c5c93d209-67472b5c1565";

nc.connect(SERVER+DEVKEY);

I get the error. However, when I just have this one set up:

nc.connect("rtmfp:");

It works just fine. If I have two SWFs open, they will connect and play with each other fine. But again, I get that other internet problem with that, which is why I made this thread in the first place...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2014 Oct 17, 2014

Disregard those last messages, I got it to work! I just had some stuff written incorrectly and sloppily. Thank you so much!!!!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2014 Oct 17, 2014
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines