4 Replies Latest reply on Aug 13, 2008 5:51 PM by wgb14

    It should be simple, but I don't remeber how

    wgb14 Level 1
      Hi all

      I have an ActiveX control in sprite1 from where I would like to read data continously to Director


      What I would like to do is to put the numbers xc yc the one below the other in a text field member. As the control (in sprite(1) feeds data continously I guess some kind of repeated loop is needed). Also sometimes the xc and yc are 0. Any idea hwo to do that?

      Many thanks for any replies
        • 1. Re: It should be simple, but I don't remeber how
          robdillon Most Valuable Participant
          put xc & space & yc & return after member(the text member)

          Where "the text member" is the name or reference to the text member or field that you are using to display the information.
          • 2. Re: It should be simple, but I don't remeber how
            wgb14 Level 1
            The data that my control feeds are continous, if i will do it like this it will return the x, y values just once and then it will stop. I think i need some kind of repeated loop in order to continously read the data

            • 3. It should be simple, but I don't remeber how
              Chunick Level 3
              don't do a repeat loop... put the code in an on enterFrame frame script or create a timeout object or use on stepFrame... I will give you an example of code that uses a timeout object in a behavior script:

              -- attach this behavior script to the text member that will display
              -- the data value from the ActiveX control

              property spriteNum, sp, mem
              property dataSprite

              on beginSprite me
              -- create references to the sprite and the
              -- member that the script is attached to
              sp = sprite(spriteNum)
              mem = sp.member
              -- create a reference to the ActiveX data sprite
              dataSprite = sprite(1)
              -- create the timeout object (MX2004 syntax)
              -- 30 referrs to 30 milliseconds which is roughly
              -- how often the timeout handler is called
              dataTMObj = timeOut().new("activeXData", 30, #getDataFromActiveX, me)

              on getDataFromActiveX me
              -- use .setContentsAfter() method of the text member
              -- to display the data from the ActiveX control.
              mem.setContentsAfter(string(dataSprite.XCoord) & RETURN & string(dataSprite.YCoord) & RETURN)

              on endSprite
              if objectP(timeOut("activeXData")) then timeOut("activeXData").forget()
              dataTMObj = 0

              **** Note: this is untested code but everything does look syntactically correct.
              • 4. Re: It should be simple, but I don't remeber how
                wgb14 Level 1
                Thank you the code is OK but there must be somethign wrong with my control as the value are being read in director but it shows them only after the control has been terminated. I am working to fix the problem now, again many thanks