Don’t call Jobs() from initialize.
Instead call it from the result handler of ReportJob.
<mx:operation name=”ReportJob”
result=”Jobs()” />
Matt
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf
Of gotjosh819i
Sent: Thursday, June 16, 2005
11:50 AM
To: [email protected]
Subject: [flexcoders] Re:
Assigning a AS variable to the return value of a web service
Ya i tried that one. Here is what I have so far...(see 3
paragraphs
below this) no more errors...
However the flex app isnt reacting
accordingly. I dont think its
getting the data from the web srvc. I know
the service works. i
tested it with another bit of code and dropped the
result into a
datagrid.
There has to be a way I can put the WS data (which
is yes or no
result) into the AS variable so I can change the
enable/visible items
on the flex app.
Basically I have a cfc that checks the database,
which has a table
whith 2 columns and it fills in Yes or No
depending if a certain Job
is running, which makes the data unavailable in my
app until the job
is finished. That way users cant connect to
the DB until the Job is
complete or not running.
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
initialize="Jobs();gvsJob.ReportJob.send()"
backgroundImage="_images/gvsbackground.jpg"
backgroundSize="100%"
styleName="_css/emx_nav_left.css"
height="100%" width="100%"
xmlns:comp="*" pageTitle="GVS
Report Generator" themeColor="haloBlue"
>
<mx:Script
source="_as/showmenus-b.as"/>
<mx:WebService wsdl="http://blahblah.com/_cfc/gvs_reports.cfc?wsdl"
id="gvsJob">
<mx:operation
name="ReportJob"/>
</mx:WebService>
<mx:Script>
<![CDATA[
var linkData:Array
= ["Home", "Standard Reports", "Custom
Reports", "My Saved Reports" ];
var
link1Data:Array = ["Needs", "Solutions",
"Deliverables"]
var
link2Data:Array = ["Thrust Reports", "Business Unit
Reports", "Sub-Council Reports"];
]]>
function
Jobs() {
var
JobRunning:Object = gvsJob.ReportJob.result;
//Checks to see if database Jobs are
running, if
they are not it will
//say available = yes, if they are it
will say
available = no
if (JobRunning == "Yes")
{
Welcome.visible = false;
ReportJobScreen.visible = true;
HomeLink.enabled = false;
StandardRLink.enabled = false;
CustomRLink.enabled = false;
MyReportsLink.enabled
= false;
}
}
</mx:Script>
--- In [email protected], "Kent
Henneuse" <[EMAIL PROTECTED]>
wrote:
>
> By the look of it you are trying to use
DataAvailable and it is not
valid.
> You might want to try this:
>
>
<![CDATA[
>
var JobRunning:Object =
gvsJob.ReportJob.result;
> ]]>
>
> This appears to be the way the example in the
Flex Samples Explorer-
>Dynamic
> Data Services does it.
<wsId>.<operation>.result
>
> You may have to dig through the result for
what you want but that is
> probably not hard.
>
> -Kent
>
> -----Original Message-----
> > <mx:WebService wsdl="http://blahblah/_cfc/gvs_reports.cfc?wsdl"
> > id="gvsJob">
>
> <mx:operation
name="ReportJob"
/>
> > </mx:WebService>
> >
> >
> > <mx:Script>
> >
<![CDATA[
> >
var JobRunning:Object =
ReportJob.DataAvailable.result;
> >
]]>
> >
> > //Checks
to see if database Jobs are running, if they are
> > not it will
> >
//say available = yes, if they are it will say available =
> > no
> > if
(JobRunning == "No")
> > {
> >
someactions
>
> }
> > </mx:Script>
Yahoo! Groups Links