4 Replies Latest reply on Jun 9, 2010 10:58 AM by Ansury

    What is the Need for communication between Flex ActionScript to Javascript

    kiran7881 Level 1

      Hi ,

       

      Flex has made it communication possible from FLEX Mx:script to Java Script .

      Can anybody could please tell me what is the need or any scenario  for communication Flex with Javascript

      Thanks in advance .

        • 1. Re: What is the Need for communication between Flex ActionScript to Javascript
          Ansury Level 3

          Sorry but I can't resist the chance for a dig here - it's mostly to let people write fragile JavaScript dependent hacks and presumably also to allow the use of inferior XML-based AJAX protocols.  Also to meet the requirements of idiot managers, who mandate the use of legacy technologies rather than letting their engineers do their job.

           

          (In fairness, there's probably a few legitmate and possibly even reliable uses, but if you've never had a need to seek out such solutions, count your blessings.)

          • 2. Re: What is the Need for communication between Flex ActionScript to Javascript
            msakrejda Level 4

            Ansury has a fair point. For a slightly less jaded reply:

             

            The bridge (JS-to-AS and AS-to-JS) can be used to build Flex applications as "widgets" in a larger HTML-based page, and interact with them. E.g., you could have a JavaScript combobox (or even a plain set of HTML anchors, with some JS) select the current child in a ViewStack. Also, I believe the Flex "View Source" feature uses the opposite of this: you have a Flex Tree control on the left, but in the frame on the right, the contents of the currently selected item are displayed as a plain HTML page. The Tree still controls navigation, but the presentation is HTML. I'm not sure if this is accomplished using the bridge, but it certainly could be.

            • 3. Re: What is the Need for communication between Flex ActionScript to Javascript
              Zolotoj Level 3

              I've been using ExternalInterface on daily basis. Not because of reasons you are describing, but because of kind of tasks you are working on. Let me specify just two in order of commonality:

              1. Local Printing.

                   A user needs to have printing services provided by applications he is running. And it happens that he is running Web Flex applications. Have you tried any serious printing from Flex? Reports, and I mean REPORTS? Silent printing? Barcoded Labels?

               

              2. Applications that involve scanners. Not these keyboard ones, but serial scanners, and other serial devices such scales.

               

              Just my 2 cents.

              • 4. Re: What is the Need for communication between Flex ActionScript to Javascript
                Ansury Level 3

                1- Printing in Flex is terrible (although for simpler requirements it can do fine), true, but it's not incredibly better elsewhere in the browser unless I'm missing the point.  This can be gotten around for many by streaming PDFs or Excel spreadsheets from a server, though.

                 

                2- If it has to be web, I guess you're stuck.  If it can be an installed app (AIR) I'd prefer to hook into Java.  Like I said, there may be some limited specific uses, but good reasons to base the majority of your app on JS hacks are hard to come by.