Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 86170

Strange error: "Handler not found in object: #newObject" (at a sprite object)

$
0
0

Hi there,


I'm facing a strange error in Lingo. I'm using Director 11.5 on Windows 7.


First I was reconstructing a tutorial for netConnection in Director. This worked fine.

Then I added some further functionality and then - a strange error occured where nothing much has been altered and which was working fine before. Now Lingo doesn't know the handler "newObject" at the sprite pSprite anymore! Why???

 

Bild

 

The regarding code for this error is a behavior for the button to connect. The code is the following:

 

global pNetConn
global gUserList
property pSprite

on beginSprite (me)     pSprite = sprite(me.spriteNum)  pSprite.cursor = 280 
end beginSprite




on mouseDown (me)   sIch = me.stripSpaces( sprite(3).text )  put "eigener Name ist: "& sIch  if ((sIch = "") or (sIch = void)) then       alert "Bitte geben Sie Ihren eigenen Namen an."      else          gNameSelbst = sIch       if voidP(pNetConn) then      me.setConnection()    end if    me.getUserList()       go frame(23)       end if 
end mouseDown





on setConnection me   pNetConn = pSprite.newObject("NetConnection")   pSprite.setCallback(pNetConn,"onStatus",#statusUpdate,me)  pSprite.setCallback(pNetConn,"clientListChannel",#userListUpdate,me)    tURL = "rtmp://xxxxxxxx"  pNetConn.connect(tURL) 
end setConnection


on statusUpdate aArg1, aArg2   if (aArg2.code = "NetConnection.Connect.Success") then       -- Hier erfolgt später die Sendung des eigenen Videostreams an den Server  end if 
end statusUpdate





on userListUpdate aArg1, aArg2   luserList = aArg2   if   (luserList <> void) then       put "-----USER-LIST UPDATE------"    gUserList = []       repeat with counter = 0 to luserList.length -2           sname = luserList[counter].label      gUserList.add(sname)     end repeat     end if 
end userListUpdate



on stripSpaces (me, aString)   -- clear all spaces from the string  repeat while offset(SPACE,aString)    tCharIndex = offset(SPACE,aString)    delete aString.char[tCharIndex]  end repeat   -- return the string  return aString 
end


The tutorial code which works is the following:

Here the netConnection is built in the on exitFrame - but I already tried this in my new code above without any success. By the way, I intentionally xxx-ed the URL ;-) Of course in the original there's a correct server adress.

 

global gNames
property pCamera
property pInStream
property pMicrophone
property pNetConn
property pOutStream
property pSprite

on exitFrame (me)
  if voidP(pNetConn) then    me.initiateConnection()  end if 
end exitFrame

on initiateConnection (me)
  pSprite = sprite(me.spriteNum)  pNetConn = pSprite.newObject("NetConnection")  pSprite.setCallback(pNetConn,"onStatus",#myOnStatus,me)  tURL = "rtmp://xxxxxx"  pNetConn.connect(tURL)
end initiateConnection

on initiateStreams (me)
  tCamObj = pSprite.newObject("Camera")  pCamera = tCamObj.get()  tMicObj = pSprite.newObject("Microphone")  pMicrophone = tMicObj.get()  pOutStream = pSprite.newObject("NetStream",pNetConn)  pOutStream.attachAudio(pMicrophone)  pOutStream.attachVideo(pCamera)  pOutStream.publish(gNames.publishName,"live")  pInStream = pSprite.newObject("NetStream",pNetConn)  pInStream.play(gNames.subscribeName)  pVideoClip = pSprite.getVariable("VideoClip",FALSE)  pVideoClip.attachVideo(pInStream) 
end initiateStreams

on endSprite
  if not( voidP(pOutStream) ) then    pOutStream.close()  end if  if not( voidP(pInStream) ) then    pInStream.close()  end if   if not( voidP(pNetConn) ) then    pNetConn.close()  end if 
end endSprite

on myOnStatus me, aArg1, aArg2   put aArg2.code   if (aArg2.code = "NetConnection.Connect.Success") then       me.initiateStreams()     end if 
end myOnStatus

 

Did anybody ever face the same error? Can anyone tell me where the misstake lies? Or is it a kind of bug? I really don't knwo what could be wrong. I'd appreciate any help!


Thanks

Jana


Viewing all articles
Browse latest Browse all 86170

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>