all groups > coldfusion flash integration > april 2006 >
I am not sure if I am going to say this right. But here goes. I am try to use Flash Remoting with my cfform (Flash). What I want to do is two things. Is this possible? One show an alert if under certain conditions. Two make a certain Tab active under certain conditions. (tabnavigator) Here is my cfc remoteing file that gets called. <cffunction name="gettax" output="false" description="Returns the current time" access="remote" returntype="string"> <cfargument name="SState" required="false" type="string" default=""/> <cfargument name="stax" required="false" type="string" default=""/> <cfif ucase(arguments.SState) is "NC"> ****** show alert here ***** <cfset stax = 0.059> <cfelse> ******* Make tab index 2 active. ******* <cfset stax = 0> </cfif> <cfreturn stax /> </cffunction> Thanks for any help you can give!!!
Is there any references you can give me to the AS check? I am unfamiliar with that. Thanks!!! [quoted text, click to view] "doug777" <doug777@ms15.hinet.net> wrote in message news:e0nnjf$4bn$1@forums.macromedia.com... > You can't do it directly in the CFC. You can either use the returned > variable stax and then in the AS check whether it's 0 or >0, or if there > are more options, make stax a structure and add whatever you want to it > and then look through the object in AS, or you could add the items to a > list (as long as the order is always the same) which looks like a string > to AS then convert it to an array in AS and loop through the array. > > As you find the items in AS you can perform whatever action you want: > > alert("This sales tax is excessive"); > > tnav[1].enabled = true; > > and so on, > Doug
I am sorry for my ignorance but this is ActionScript correct? Where does this go in the main cfm file correct? How is it called? Thanks Again!! [quoted text, click to view] "doug777" <doug777@ms15.hinet.net> wrote in message news:e0no4u$4tf$1@forums.macromedia.com... > If in formgroup tabnavigator id="tnav" > > var tnav=tnav > responseHandler.onResult = function(results:Number):Void { > if(results) { > alert("This sales tax is excessive"); > } else { > tnav[1].enabled=true; > } > } > > Doug
If you are using flash remoting then it goes in the result handler of the remoting function which will either be in the flash form or in an AS page in your movie presumably.
I just realize that what you mean by make tab 2 active is this: tnav.selectedIndex = 1; not .enabled
If in formgroup tabnavigator id="tnav" var tnav=tnav responseHandler.onResult = function(results:Number):Void { if(results) { alert("This sales tax is excessive"); } else { tnav[1].enabled=true; } }
You can't do it directly in the CFC. You can either use the returned variable stax and then in the AS check whether it's 0 or >0, or if there are more options, make stax a structure and add whatever you want to it and then look through the object in AS, or you could add the items to a list (as long as the order is always the same) which looks like a string to AS then convert it to an array in AS and loop through the array. As you find the items in AS you can perform whatever action you want: alert("This sales tax is excessive"); tnav[1].enabled = true; and so on,
I am beginning to understand how this works. Is there a way to do a conditional if statement based on what is retuned instead of if something is returned? Like this...but this does not work. responseHandler.onResult = function(results:Number):Void { stax.text = results; if(results = 10) { alert("This sales tax is excessive"); } else { tnav.selectedIndex = 1; } } Thanks for all your help!! [quoted text, click to view] "doug777" <doug777@ms15.hinet.net> wrote in message news:e0nokk$5en$1@forums.macromedia.com... > If you are using flash remoting then it goes in the result handler of the > remoting function which will either be in the flash form or in an AS page > in your movie presumably. > > Doug
Like Javascript I see. Thanks!! [quoted text, click to view] "doug777" <doug777@ms15.hinet.net> wrote in message news:e0pt8o$p1n$1@forums.macromedia.com... > If you type if (results = 10) {} then results will always equal 10 because > what you are saying is: set results equal to 10, so the if will always be > true. > > If you want to check the equivalence of results and 10, you have to use > the equivalence operator which is == (is equivalent to) > > so if you type if (results == 10) {} you will get the desired result. > > Doug
I would like to send two variables over to the cfc file but one seems to get ignored. Is my code wrong? Can I make two calls like that? //get service. First parameter is path to component and //the second it's the object that will handle the response myService = connection.getService("cgi-bin/flashRemotingResponder", responseHandler ); //make call myService.gettax(SState.text); myService.gettax(SCity.text); You have been a lot of help I realy apreshate it. Rick [quoted text, click to view] "doug777" <doug777@ms15.hinet.net> wrote in message news:e0pt8o$p1n$1@forums.macromedia.com... > If you type if (results = 10) {} then results will always equal 10 because > what you are saying is: set results equal to 10, so the if will always be > true. > > If you want to check the equivalence of results and 10, you have to use > the equivalence operator which is == (is equivalent to) > > so if you type if (results == 10) {} you will get the desired result. > > Doug
You can simply send them both together: myService.gettax(SState.text, SCity.text); Then in the cfc put two cfargument in the same order. <cfargument name="stateText" type="string" required="yes"> <cfargument name="cityText" type="string" required="yes"> The value in SState.text will end up in the cf variable stateText and so on for as many arguments as you want.
If you type if (results = 10) {} then results will always equal 10 because what you are saying is: set results equal to 10, so the if will always be true. If you want to check the equivalence of results and 10, you have to use the equivalence operator which is == (is equivalent to) so if you type if (results == 10) {} you will get the desired result.
How about on the return. Is there a way to return more than one variable? Something like if(results.stax == -1) { Thanks again!! [quoted text, click to view] "doug777" <doug777@ms15.hinet.net> wrote in message news:e0q873$7sq$1@forums.macromedia.com... > You can simply send them both together: > > myService.gettax(SState.text, SCity.text); > > Then in the cfc put two cfargument in the same order. > <cfargument name="stateText" type="string" required="yes"> > <cfargument name="cityText" type="string" required="yes"> > > The value in SState.text will end up in the cf variable stateText and so > on for as many arguments as you want. > > Doug
Would you use more of these? <cfreturn qty /> <cfreturn stax /> Thanks!! [quoted text, click to view] "Rick" <rick@di-wave.com> wrote in message news:e0rrun$hci$1@forums.macromedia.com... > How about on the return. Is there a way to return more than one variable? > Something like > > if(results.stax == -1) { > > Thanks again!! > > "doug777" <doug777@ms15.hinet.net> wrote in message > news:e0q873$7sq$1@forums.macromedia.com... >> You can simply send them both together: >> >> myService.gettax(SState.text, SCity.text); >> >> Then in the cfc put two cfargument in the same order. >> <cfargument name="stateText" type="string" required="yes"> >> <cfargument name="cityText" type="string" required="yes"> >> >> The value in SState.text will end up in the cf variable stateText and so >> on for as many arguments as you want. >> >> Doug > >
Ok I figured out how to get more than one variable back but how do I loop through and separate them. responseHandler.onResult = function(results:Number):Void { stax.text = results; } what I am getting looks like this. 57.34,99.00 I want to put 57.34 in the stax field and 99.00 in the shipping field. Thanks for ALL you help!!! [quoted text, click to view] "Rick" <rick@di-wave.com> wrote in message news:e0rs1n$hfo$1@forums.macromedia.com... > Would you use more of these? > > <cfreturn qty /> > <cfreturn stax /> > > Thanks!! > > "Rick" <rick@di-wave.com> wrote in message > news:e0rrun$hci$1@forums.macromedia.com... >> How about on the return. Is there a way to return more than one variable? >> Something like >> >> if(results.stax == -1) { >> >> Thanks again!! >> >> "doug777" <doug777@ms15.hinet.net> wrote in message >> news:e0q873$7sq$1@forums.macromedia.com... >>> You can simply send them both together: >>> >>> myService.gettax(SState.text, SCity.text); >>> >>> Then in the cfc put two cfargument in the same order. >>> <cfargument name="stateText" type="string" required="yes"> >>> <cfargument name="cityText" type="string" required="yes"> >>> >>> The value in SState.text will end up in the cf variable stateText and so >>> on for as many arguments as you want. >>> >>> Doug >> >> > >
This worked sooooooo great!!!!!! Thanks!!! [quoted text, click to view] "doug777" <doug777@ms15.hinet.net> wrote in message news:e0sc28$7nk$1@forums.macromedia.com... > You're right, you can only return one thing from a function, but that > thing can be a query, a structure (and for both these the AS return type > should be Object), a string, a number and what you've got this time, a > list. Since this is a list, your variable type should be results:String, > not :Number. > > Unfortunately AS does not have any list handling capabilities, so you need > to turn this into an array. In flash forms we can't use the 'new' keyword > so do it like this: > > var retarray:Array = results.split(","); > > Now retarray[0] will equal 57.34 and retarray[1] will equal 99.00, so > > stax.text = retarray[0]; > > Always glad to be of help, but I'm off the forum for a while so if you > want more help I suggest you start a new thread. > > Doug
You're right, you can only return one thing from a function, but that thing can be a query, a structure (and for both these the AS return type should be Object), a string, a number and what you've got this time, a list. Since this is a list, your variable type should be results:String, not :Number. Unfortunately AS does not have any list handling capabilities, so you need to turn this into an array. In flash forms we can't use the 'new' keyword so do it like this: var retarray:Array = results.split(","); Now retarray[0] will equal 57.34 and retarray[1] will equal 99.00, so stax.text = retarray[0]; Always glad to be of help, but I'm off the forum for a while so if you want more help I suggest you start a new thread.
Don't see what you're looking for? Try a search.
|
|
|