4 Replies Latest reply on Jul 30, 2006 8:23 PM by JohnathonS

    Shockwave causes crash on htm page using SMUS

    JohnathonS Level 1
      I am currently working on a multiuser chat program that is to be embedded into a webpage. I am running into a problem though after the program connects to the server. For the most part it works fine during run mode, but when you try to quit the program by closing the window, going to another website, or in any other way that I've found causes the browser to crash (the standard Internet Explorer has encountered a problem and needs to close error) When I click for more information on the error it lists dirapi.dll as the source of the problem. Dirapi.dll is part of shockwave, so I can't be sure if it's just saying that shockwave in general crashed or shockwave overall crashed, but in any case, it lists it as the problem.
      I've tried everything I can think of to solve this problem and I just can't figure it out. I've tried rerouting all xtras to local files, tried a whole lot of things to clear globals and connections before quitting, letting the movie just run out into nothingness... I'm out of ideas. Your help would be greatly appreciated

        • 1. Re: Shockwave causes crash on htm page using SMUS
          James Newton, ACP Level 3
          One way to get the Multiuser Xtra to crash the browser is to leave pointers to net message handlers registered with the xtra at the moment the movie quits.

          The workaround is to deregister all net message callback handlers on stopMovie. In pseudo-code terms:

          on stopMovie()
            global gMultiuser
            repeat with each registered message handler
              gMultiuser.setNetMessageHandler(0, <object>, <subject>, <sender>)
            end repeat

          Does this help to prevent the crash occurring?
          • 2. Re: Shockwave causes crash on htm page using SMUS
            JohnathonS Level 1
            using sConnect as an example of what I'm using to connect to the server, here's what I'm doing to clear the connection and globals:
            on stopmovie
            global sConnect
            -- clear all callbacks by setting #handlerSymbol parameter to 0
            errCode = setNetMessageHandler(sConnect,0)
            errCode = setNetMessageHandler(sConnect,0, "ConnectToNetServer")
            errCode = setNetMessageHandler(sConnect, 0, "SomeOtherMessageHandler")

            -- clear instance of the Multiuser xtra
            sConnect = 0
            end stopMovie

            Shouldn't this automatically kill any communications between the server and the client then and prevent crashes caused by still running scripts?
            • 3. Shockwave causes crash on htm page using SMUS
              JohnathonS Level 1
              *Please see the edit below before reading the next portion as I have determined that it is innacurate*

              Update: I've found that the actual problem lies somewhere in the "errCode = sConnect.SetNetMessageHandler( #DefaultMessageHandler, script 1 )" line - I'm not sure how to get around this problem as I need the NetMessageHandler in order to communicate with the server (unless there's some other way that I'm not aware of to do the server/client communication)

              Again, your help would be greatly appreciated!

              Edit: Upon even further research I have determined that the actual error occurs once a sendNetMessage command is sent to the server from the client. (for example, if I were to run the following code on the client in the browser it would cause the crash when you quit the game):

              errCode = sConnect.sendNetMessage([#recipients:"system.script", #subject:"LoadChar",#content:AcctDat])

              Is there a way to clear it somehow in the on stopmovie method?
              • 4. Re: Shockwave causes crash on htm page using SMUS
                JohnathonS Level 1
                I've decided to post the script to see if any of you can find a problem with it that might be causing my problem, so here it is:

                global sConnect, MuteCountdown
                on stopmovie
                sConnect = 0
                end stopMovie

                on DefaultMessageHandler
                global sConnect, uname, passphrase, IAmAdmin, IAmMod, IAmGuide, MuteCountdown
                newMessage = sConnect.getNetMessage()
                errCode = newMessage.errorCode
                if errCode <> 0 then
                alert "Error: "& errCode & " : " & sConnect.getNetErrorString(errCode)
                if newMessage.Subject = "OkayToLog" then
                play frame 30
                end if
                if newMessage.SenderID = "System" AND newMessage.Subject = "ConnectToNetServer" then
                play frame 5
                end if
                end if

                -- LoadMeUp
                -- Command lines that run when the login button is pressed
                -- Creates the multiuser xtra instance and the connection to the server.
                on LoadMeUp
                set uname = field (member "username" of castlib "Internal")
                set passphrase = field (member "password" of castlib "Internal")
                sConnect = new(xtra "Multiuser")
                errCode = sConnect.setNetMessageHandler(#DefaultMessageHandler, script 1)
                errCode = sConnect.ConnectToNetServer( uname, passphrase, "server.theserv", 1626, "MainMovie" )
                play frame 4

                -- LoadCharacterCommand
                -- The script below is the problem causer. I'm not sure how to clear it
                -- in the on StopMovie command.
                on LoadCharacterCommand
                set uname = field(member "Username" of castlib "Internal")
                set passphrase = field(member "Password" of castlib "Internal")
                set CharDt = uname & ":" & passphrase
                -- The Commented line below is how I would normally send a command like this, the one below is how I have it set now, it makes no difference which I use. They both cause the crash in the end.
                -- errCode = sConnect.sendNetMessage([#recipients:"system.script", #subject:"LoadChar", #content:CharDt])
                errCode = sConnect.sendNetMessage("system.script", "LoadChar", CharDt)