Then, we hack around a bit. First of all, we need to convert the data to JSON format:
toJsonString( notifier.data )
We also need to minimize it, because Flex's JSON Library
doesn't like new lines or carriage returns in that data (this took me a
long time to figure out!). So, we run:
jsmin( toJsonString( notifier.data ) )
Finally, we pas the result of that function to the method in our MXML file, bindJSONToChart():
bindJSONToChart( jsmin( toJsonString( notifier.data ) ) );
I'm lazy and I've made that all one line in the code.
Now, it will do that fine if the .swf file has loaded.
However, sometimes the data gets returned before the .swf file is
actually loaded. I found this out when running the application locally.
So, I've wrapped all this in a try / catch statement, and added an
initialization function on the swf file, so that if its not loaded,
when it loads it will run this function and populate the graph with
data from the Ajax call.
There you go. When you load the HTML page, Spry will load that PHP file
using an Ajax call, the PHP file will connect to Feedburner, get the
XML data, print it out. Spry will read that in, bind it to the HTML
elements on the page, then call the Flex application, passing it the
data in JSON format. The Flex application will read in the data and
display it in a Flex chart. Here are a few tips and tricks that I've
found when building this out:
1. I found it easiest to modify the HTML that gets output by Flex
Builder, rather than to reference the built swf file. If you do that,
be sure to modify index.template.html in the html-template folder of
your Flex project, rather than the .html files in the bin/ directory of
your Flex project. The HTML files in bin/ get overwritten when you save
and re-build your Flex application, and if you modify those, rather
than index.template.html, you'll lose your changes.
2. I started building out the Flex graph using JavaScript and the Flex
/ Ajax bridge. I don't recommend that. Build out your entire Flex
component in Flex Builder, then simply write functions to pass data to
it from HTML. I think that's easier than trying to build Flex
components using JavaScript.
3. Similarly, write functions that closely couple your Flex
application to your HTML page. For instance, you'll notice that in my
MXML file, I call the chartClicked JS function using:if(
ExternalInterface.available )
I could have attached an observer to the lineChart
instead, using the Flex / Ajax bridge, but I find it easier to get the
data items and debug the application in Flex Builder, rather than
trying to do that in JavaScript on the HTML page.
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#9
AJAXWorld News Desk commented on 29 Sep 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#8
AJAXWorld News Desk commented on 29 Sep 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#7
CFDJ News Desk commented on 29 Sep 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#6
SYS-CON Brazil News Desk commented on 17 Aug 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#5
SYS-CON Australia News Desk commented on 17 Aug 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#4
n d commented on 16 Aug 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#3
JDJ News Desk commented on 16 Aug 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#2
SYS-CON Italy News Desk commented on 16 Aug 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
#1
Web Developer's & Designer's Journal commented on 14 Aug 2006
We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
j j wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
AJAXWorld News Desk wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
AJAXWorld News Desk wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
CFDJ News Desk wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
SYS-CON Brazil News Desk wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
SYS-CON Australia News Desk wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
n d wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
JDJ News Desk wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
SYS-CON Italy News Desk wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.
Web Developer's & Designer's Journal wrote: We've all seen Google finance, and the great job that it does at mixing HTML content with Flash content, as seen on company stock quotes. Google has done a great job at using Flash where it makes the most sense, in the graphs for company quotes, with HTML where it makes sense (linking to news items). Today, I'll show you how to build your own Google-finance type site, using a combination of Ajax, JSON, PHP and Flex / Flash. And, best of all, we'll do it all for free.