I’m trying to figure out the easiest way get BigFix Relevance into Adobe Flex. The one method I’m working on, which I’m not sure is the “Ideal” method is to sending the Parameters via FlashVars, explained in the article below.
So it fairly easy to get the relevance I’m looking for via the current BESClientUI (HTML), but we like the look and feel of Adobe Flex. So, the question is? How do I get <?relevance operating system ?> and <?relevance computer name ?> to pass it’s value to Flex? Assuming that it the best way to do it.
In what context are you trying to pass relevance results to Flex? Web reports or the console?
In Web Reports, the most efficient way is to make a Flex URLRequest and hit the SOAP API.
In the console, the most efficient method is to use ExternalInterface. If you anticipate that the size of the data set you plan to pass over ExternalInterface is large (e.g. more than 100K or so) you’ll want to serialize your data before passing it. I recommend using JSON. Let me know if you need a more concrete example.
The way you illustrate seems like it will work, though i am not very familiar with it.
We use a variant of that method by using swfobject.js (http://code.google.com/p/swfobject/) to assign parameters when instantiating our swf, then using the same Application.application.parameter call to get the data into flex.
The methods are very similar, and i don’t think there are any practical concerns, so which ever way you feel more comfortable will work just fine.
// call this on the Application’s creationComplete event.
private function creationComplete():void
{
ExternalInterface.addCallback(‘setComputerName’ , handleName);
ExternalInterface.addCallback(‘setComputerOS’ , handleOS);
ExternalInterface.call(‘onSWFReady’);
}
private function handleName(name:String):void
{
// do something here
}
private function handleOS(os:String):void
{
// do something here
}
I’m also not sure how important the “History” folder is… as it does not get copied into the “C:\program files\BigFix Enterprise\BES Client__BESData__UISession\0” folder, so I’m not sure if I should also be changing the href=“history/history.css” in the HTML file to href=“history.css”…
I had to create an example myself before I noticed the source of your error. You have everything correct except handleOS and handleName are setting a local variable rather than the global bindable variable.
All you need to do is remove the ‘var’ key word from those functions:
I have made the changes… as you stated, but still the same result…
Computer Name
Operation System
{which I guess should really say “Operating System” but I digress}
Note: no values imported. I have checked out the file… C:\program files\BigFix Enterprise\BES Client__BESData__UISession\0_currentTechnician.html and have noticed that the Relevance did change to values.
My latest Flex Code is below… I’m not sure if the BINDABLE PUBLIC VAR CN:String…etc is causing my ills… If you could post the code you have come up with that worked maybe that would help… Also, I’m not sure if my assumptions that I had to change your lines… in the JAVAScript to point to the name of the SWF file is a correct assumption ‘mySWF’ changed to ‘BigFixTest’… or if I need the full ‘BigFixTest.SWF’ either way… it didn’t work.
<html> <head> <link type=
"text/css" rel=
"stylesheet" href=
"offer.css"></link> <title>BigFix Technician Support</title> </head> <body> <script src=
"swfobject.js" type=
"text/javascript"></script> <div id=
"SWFHolder" height=
"100%" width=
"100%" margin=
"0" padding=
"0">You need to install/upgrade your Flash Player to version 9 <a href=
"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Download Flash Player from Adobe</a></div> <script type=
"text/javascript"> var so =
new SWFObject(
"ClientDashboard.swf",
"ClientDashboardSWF",
"100%",
"100%", 9,
"#FFFFFF"); so.write(
'SWFHolder'); function onSWFReady()
{ var name =
"<?relevance computer name ?>"; var os =
"<?relevance name of operating system ?>"; document.getElementById(
'ClientDashboardSWF').setComputerName(name); document.getElementById(
'ClientDashboardSWF').setComputerOS(os);
} </script> </body> </html>