8 Replies Latest reply on Apr 10, 2007 6:10 AM by Arthur@aginova

    Flex Chart on web Page

    pravin_bluebird
      Hello All,
      I hvae one small flex application.
      And its working perfact when i run it through Flex Builder..

      My application takes xml data from one URL which i have given in SWF's flashvar......

      Now i want to know that how can i place this chart into web page.

      I try to insert the SWF file which is generated as a result of running mxml in flex builder
      But it does not take data from the url i provided in SWFs flashvar.

      And i want to know that which file i have to put in my web folder ?..Do i need to put mxml file in my web folder or just SWF is enough



      Here is my code

      <div style="width:450px; height:450px">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
      id="real_chart" width="450" height="450"
      codebase=" http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
      <param name="movie" value="real_chart.swf" />
      <param name="quality" value="high" />
      <param name="bgcolor" value="#869ca7" />
      <param name="allowScriptAccess" value="sameDomain" />
      <param name='flashVars' value='&serviceURL=http://192.168.1.2/chart_data/chart_data.aspx&symbol=IBM'
      <embed src="real_chart.swf" quality="high" bgcolor="#869ca7"
      width="450" height="450" name="real_chart" align="middle"
      play="true"
      loop="false"
      quality="high"
      flashVars='&serviceURL=http://192.168.1.2/chart_data/chart_data.aspx&symbol=IBM'
      allowScriptAccess="sameDomain"
      type="application/x-shockwave-flash"
      pluginspage=" http://www.adobe.com/go/getflashplayer">
      </embed>
      </object>
      </div>



      it takes the XML data from http://192.168.1.2/chart_data/chart_data.aspx



      when i make change in html generated from flex builder Its works fine.

      but when i move the bin folder at any other location Its doesn't show any results.....


      Any help will be very much thankful

      Regards
      Pravin
        • 1. Re: Flex Chart on web Page
          pravin_bluebird Level 1
          Any Help Please
          • 2. Re: Flex Chart on web Page
            davidmedifit Level 1
            Pravin,
            You only need the SWF, not the MXML on your production server. It would appear that the parameters is the issue. Does this work when you hard code the URL in your MXML code?

            David
            • 3. Re: Flex Chart on web Page
              peterent Level 2
              This sounds more like a Flash Player security error. If you are able to run the app from Flex Builder but not when deployed on a production system, it is usually a security issue. When you run from within Flex Builder, the application is marked as "local-trusted" which means it can read data from anywhere - your system as well as from the network. This happens because Flex Builder adds your application's directory to the list of trusted files.

              When you run from a server, the Flash Player notes that the URL which launched the SWF is different from the URL of the data, which in your case is coded as http://192.168.1.2/chart_data/chart_data.aspx.

              If the domain of your server is not 192.168.1.2 then that server will need a crossdomain.xml policy file to allow any SWF launched from your domain to have access to the data.
              • 4. Re: Flex Chart on web Page
                pravin_bluebird Level 1
                Thanks for your reply

                Hi David
                ok I got your point
                I want to put my resulting chart SWF on ASPX or HTML or PHP page.
                So i just have to paste only

                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                id="real_chart" width="450" height="450"
                codebase=" http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                <param name="movie" value="real_chart.swf" />
                <param name="quality" value="high" />
                <param name="bgcolor" value="#869ca7" />
                <param name="allowScriptAccess" value="sameDomain" />
                <param name='flashVars' value='&serviceURL=http://192.168.1.2/chart_data/chart_data.aspx&symbol=IBM'
                <embed src="real_chart.swf" quality="high" bgcolor="#869ca7"
                width="450" height="450" name="real_chart" align="middle"
                play="true"
                loop="false"
                quality="high"
                flashVars='&serviceURL=http://192.168.1.2/chart_data/chart_data.aspx&symbol=IBM'
                allowScriptAccess="sameDomain"
                type="application/x-shockwave-flash"
                pluginspage=" http://www.adobe.com/go/getflashplayer">
                </embed>
                </object>

                Right?... and i have to place that swf in appropriate folder.

                I tried wtih this,Flash is getting displayed but the chart is not coming because data are not getting fetch from url i provide in flashvar....



                According to Peter Ent

                I have also created crossdomain.XML and it somthing like below

                <?xml version="1.0"?>
                <!DOCTYPE cross-domain-policy SYSTEM " http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
                <cross-domain-policy>
                <allow-access-from domain="192.168.1.10" />
                </cross-domain-policy>


                But it still not able to fetching data from that server.....

                i use the xml data for displaying the chart which i fetch from
                http://192.168.1.2/chart_data/chart_data.aspx

                but if i directly provide xml then there is not problem of security Right?....

                So i have directly provided the XML file in Service URL.
                Still it give me no Result.

                So can u please give any other possible solution

                Regards
                Pravin
                • 5. Flex Chart on web Page
                  pravin_bluebird Level 1
                  Hello ,

                  i found one problem.

                  when i load the page outside the Flex Builder Bin Directory.
                  My control goes to
                  public function httpFault(event:FaultEvent)
                  Which means HTTPService call is fail.

                  It gives me error like Destination:DefaultHTTP
                  It means that the HTTPService object uses the DefaultHTTP destination.

                  So any solution to this problem?. Please...



                  Regards
                  Pravin
                  • 6. Re: Flex Chart on web Page
                    pravin_bluebird Level 1
                    Any help Please "destination : defaultHTTP " error

                    I stuck at this point i can't able to run my application on other machine even if i have included crossdomain.xml

                    Waiting for some ones help

                    regards
                    Pravin
                    • 7. Re: Flex Chart on web Page
                      davidmedifit Level 1
                      Pravin,
                      In your HTML code to call the SWF, you have:
                      <param name='flashVars' value='&serviceURL=http://192.168.1.2/chart_data/chart_data.aspx&symbol=IBM'
                      <embed src="real_chart.swf" quality="high" bgcolor="#869ca7"

                      You are missing a ">" at the end of the param - I assume this is just a typo.

                      Two things, I assume you can access that ASPX file outside of Flash.

                      Also, if you take that param, and hard code it in your Flex app, do you have any success? I'm trying to make sure that the problem isn't using the parameter.

                      Can you show us the code you use to call the service in Flex?

                      David
                      • 8. Re: Flex Chart on web Page
                        Arthur@aginova Level 1
                        Pravin,

                        test This:
                        try copying the flex swf to the aspx folder i.e. http://192.168.1.2/chart_data/chart_data.aspx

                        Try it!