3 Replies Latest reply on Mar 5, 2008 11:47 PM by art0rs

    Custom Events in Custom Class

    art0rs
      Hi,

      My problem is quite difficult to explain, but I'll try.
      I'm writing a custom class that connects to a server using the Socket object and exchanges simple text. I can't go into too many of the details, but the protocol has several different commands, and I want to be able to hook them to specific functions. For example, when a Flex project uses the class, hooks a specific command, let's say "CMD: text here", the project can bind that specific event to a function. Almost exactly how regular events like Event.CLICK etc. works, using obj.addEventListener.

      The socket ProgressEvent.SOCKET_DATA is bound to a function in the class I've written. This function should dispatch functions defined by the project using the class.

      Since eval() got axed, this has become quite difficult. I've read numerous samples and docs, but they all point to writing a custom event for a UI component, which I am not making. It probably isn't far off, but I've found nothing that really helps.

      If anyone has any experience with this, I would love to hear from them. Help is greatly appreciated.

      Thanks