0 Replies Latest reply: Nov 12, 2014 12:06 AM by bluelemonade RSS

    newProxyCallback question

    bluelemonade Community Member

      hello

       

      inside a flash sprite behaviour I initialize my callback

       

      on beginssprite me

            pCB = sprite(me.spriteNum).newProxyCallback(#sendToLingo)

            sprite(me.spriteNum).stage.getChildAt(0).addEventListener("sendToLingo", pCB)

      end

       

      -- this function is called from the flash.

      on sendToLingo me, evt

       

           put "Data received from AS3:" && evt.data

       

      end

       

       

      inside flash I have a class to get some values via tcpip, this works fine...

      I add an ondataArravied eventlistener to rhis object.

       

      com_pci.addEventListener("dataArrived",onDataArrived);

       

      that calls the method

       

      function onDataArrived(e:Event){

       

      trace("onDataArrived " + getTimer() );

      comInAry = com_pci.data;

       

      var tempPos:String = (comInAry[0]).toString();

       

      if (tempPos != currSlidePos) {

          trace("onDataArrived and changed" + getTimer() );

          dispatchEvent( new LingoEvent("slidePos:" + currSlidePos) );

         

      }

      }

       

       

      OK, when I onDataarrived is called one, I get a bunch of events in director, every time the tempPos != currSlidePos I get 20 or 30 times the sendToLingo

      event in director. why, the trace inside flash is only fired once...

       

      would be nice to get some help.

       

      Or is there a way to read as3 vars direct from director?

       

      regards.