3 Replies Latest reply on Jan 25, 2008 7:25 AM by peterent

    Complex application, need some help

      Hello everyone!
      I am fairly new to Flex, so please forgive me if my questions might be somewhat silly.
      I am currently evaluating it for use as a UI- toolkit (together with AIR, once it is released for Linux) for an imaging application.
      Now this application is rather complex and I need some answers to some general questions before I will continue looking into this:
      The app will be rather simillar to some 3d- animation applications on the market. You will have multiple viewports displaying images (these are just "normal" 2d images). These images are generated by an external C++ based renderer. The user will interact with the UI and this will cause information to be sent to the renderer, which will then create a new image that will be displayed in the viewport(s). Now for this, I of course will have to update the images in the viewports dynamically.
      This means that if the user interacts, a comunication of some sorts (I am not entirely sure yet what the best way for this is, honestly) will happen from the Flex based UI to the renderer (e.g. place camera here, rotate objects this way...). Once this is done, the renderer produces a new image and this needs to be updated in the Flex UI.
      One issue here is speed. The renderer will refresh the image up to 25 times/sec, or more if possible and this then needs to be loaded and displayed in the Flex UI at roughly the same rate, with as little delay as possible.
      E.g. the user draggs a slider to the left to rotate the camera to the left. While he does that, the renderer gets updated information and spits out images that are then updated in the viewports while he is still dragging the slider.
      You see my problem here: It needs to be very interactive and I can not preload images.
      I have tried looking this up on the web and doing searches, but I could not really find something like that anywhere.
      So, can anyone tell me whether this is possible at all and if so, maybe you can point me into the right direction on some reading material. This would be highly appreciated.
      I really love Flex for the UIs you can do with it (in my short time of testing it, I was able to do some fairly complex UIs without any prior knowledge of the matter). So I would really like to use it.
      In addition to this, I want the user to be able to draw into the viewport on top of these rendered images. Means paint some stuff in there that I will then convert into information for later use. I think I have found hints to this being possible, but it is all a little vague, especially given the context that this is happening with.
      Thanks in advance for any help you can provide. It is highly appreciated.
        • 1. Re: Complex application, need some help
          peterent Level 2
          You realize that by separating the rendering with the UI with a network will result in unexpected/unpredictable delays. This is somewhat beyond your control. One of the reasons Flex can be successful is that you can put some of the burden on Flex, which you intend to do wtih your plan for some items.

          If you have to do the rendering outside of Flex, then I recommend using a socket for the communication. This is a permanent link, not a request/response link. You can use a socket either from a web app or a desktop (AIR) application.

          For performance, the AIR application will be faster because it doesn't have to cater to the browser. Plus you can write temp. file to local disk if you need to. And if necessary, use the SQL Lite built into AIR to cache information.

          Good luck with your project.
          • 2. Re: Complex application, need some help
            USSSkipjack Level 1
            Thank you Peter, this helps me a lot.
            The reason we have to render images outside of the Flex app is because our renderer is a Volume Renderer and written in C++. Imagine having a game engine running in a flex window and Flex providing the controls for that. This is basically what we are trying to achieve. It is complicated, but so far Flex is the best solution for UIs out of the ones we tested (all the others are way harder to use, or dont allow for the effects we want).

            The only reason we are not using Air at the moment is because we need to run this on Linux and Air is not going to be available for Linux until later this quarter (if the information I have is still correct).
            Meanwhile we want to prototype as much of the development with Flex and running in a browser. It is true that using Air will be much faster and we are going to use it as soon as it becomes available.

            If you can provide us with any more information, I would appreciate it.
            As I said, I just started looking into Flex a couple of weeks ago and I am not that familiar with all the possibilities and features (and this is a rather complicated subject).
            Thanks again for the response and the help. It is highly appreciated!
            • 3. Re: Complex application, need some help
              peterent Level 2

              I think a socket is your best bet, at least for prototyping. We do have an alternative: RTMP (real-time message protocol) but it may be more complex for you to set up. But the complexity also gives you flexability in terms of configuration. For example, RTMP can be used in a tunneling situation or even of HTTP. The socket is a basic network connection and you end users might not be able to use it.

              For the socket, check out the Flex documentation for the flash.net.Socket and look up "socket" in the general Flex documentation for other tips on using them.

              Do the same for RTMP.