2 Replies Latest reply on Mar 10, 2008 4:38 AM by Flex_Fresher

    Fetch data from flex application

    Flex_Fresher
      Hi,

      We use data of HTML in Flex through Flashvars, I want to use the data of flex app in HTML, how can i do so??

      I know that we use javascript functions for that but i need an example.

      Kindly help.
      Mandeep
        • 1. Re: Fetch data from flex application
          Gregory Lafrance Level 6
          You can see this FB 2.0.1 help topic (or via LiveDocs on the web):
          Accessing Flex from JavaScript

          -------------------------- MXML ---------------------------
          <?xml version="1.0"?>
          <!-- wrapper/AddCallbackExample.mxml -->
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="initApp()">
          <mx:Script>
          import flash.external.*;

          public function initApp():void {
          ExternalInterface.addCallback("myFlexFunction",myFunc);
          }

          public function myFunc(s:String):void {
          l1.text = s;
          }

          </mx:Script>

          <mx:Label id="l1"/>

          </mx:Application>

          ------------------------------- HTML ----------------------------
          <html><head>
          <title>wrapper/AddCallbackWrapper.html</title>
          </head>
          <body scroll='no'>

          <SCRIPT LANGUAGE="JavaScript">
          function callApp() {
          window.document.title = document.getElementById("newTitle").value;
          mySwf.myFlexFunction(window.document.title);
          }
          </SCRIPT>

          <h1>AddCallback Wrapper</h1>

          <form id="f1">
          Enter a new title: <input type="text" size="30" id="newTitle" onchange="callApp()">
          </form>

          <table width='100%' height='100%' cellspacing='0' cellpadding='0'>
          <tr>
          <td valign='top'>
          <object id='mySwf' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase=' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' height='200' width='400'>
          <param name='src' value='AddCallbackExample.swf'/>
          <param name='flashVars' value=''/>
          <embed name='mySwf' src='AddCallbackExample.swf' pluginspage=' http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' height='100%' width='100%' flashVars=''/>
          </object>
          </td>
          </tr>
          </table>

          </body></html>

          • 2. Re: Fetch data from flex application
            Flex_Fresher Level 1
            Hello,

            I wanted to know 1 more thing that, I m dragging any column from data grid and dropping at the chart, and i want that dragged column should become one of the axis of the chart....... i tried a lot using drag and drop manager but not getting the required output.

            How can i do so???

            Thanx