Mark, I beat on this for another hour and finally just stuck "_root" in front of the function call yesterday, and what do you know, it worked. I was pretty sure it was a scope issue, but I didn't know what script language the flash form was technically using. It appeared to be close to JavaScript, ActionScript, and even C#, but I couldn't get it to behave like it was completely any one of those langs. I did however find that it would accept flex style class references minus things like "import" and "new" statements.
That led me to my next issue which was figuring out how to make a confirmation box work. I leaned quickly that the flash form does not stop and wait for a response making it different than other langs I've worked with but more truly event driven, I guess. I read that you can't add event responders to the flash forms code, but I clearly saw them working in the flash remoting code which lead me to believe it could be done. Luckly, I read some class definitions of the Flex's Alert class and I was able to get that work after hours of beating it with my E-hammer. Just figured out accidentally how to define a multidimensional array in that scripting lang by guessing. I had no idea that the scripting lang used for flash forms was so under documented. I guess in the end this is what leads everyone to start learning Flex. I've taken a look at some of the code base for it, and I can honestly say it doesn't look too pleasing to me. However, I didn't like ColdFusion at first glance either. We all gotta learn something new sometime. Kier Simmons Analyst/Programmer Phone: 713-791-6619 Toll Free: 1-888-482-5663 Fax: 713-791-6681 www.giveblood.org -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Force Sent: Thursday, January 15, 2009 2:48 AM To: Houston ColdFusion Users' Group Subject: [houcfug] Re: CFSCRIPT and Flash Remoting - Scope of functions and methods Kier, It may be that the function is not seeing where the GetCustomerFilesScript is located. You might want to try and designate it at the root level. I'm assuming that you are doing Flash Remoting with Coldfusion Flash Forms. Sometimes when it can't locate a function it won't throw an error. It just acts as if it doesn't exist. If you attempt to force an error in the calling of the cfc does the onStatus throw the alert? If this is a new app I'd recommend that you bite the bullet and learn Flex. The data handling is much better and quite a bit more powerful using the ArrayCollection class to store query results. Allows you to do all those neat things, i.e. sorting, filtering, etc in the flex component rather than have to make repeated cfc calls. Mark On Jan 14, 11:24 am, [email protected] wrote: > Alright, I've been trying to figure out what I'm doing wrong here. As > far as I can guess, the method I'm defining within a function I use > for flash remoting will not call a method that I have previously > defined. I'm guessing this is while all the examples out there use a > template and store all their functions as variables in order to avoid > additional function calls. Simply put the following code executes > everything without error, but the responseHandler.onResult method that > is called by the myService object after results are recieved from the > insertNewCustomer method does not call the GetCustomerFilesScript > function defined earlier in the script. GetCustomerFilesScript can be > as simple as just one alert statement and it will not execute. You > can define an alert statement right before calling the > GetCustomerFilesScript function and that WILL execute. > > Any ideas? > > function insertCustomer() { > var connection:mx.remoting.Connection = > mx.remoting.NetServices.createGatewayConnection("http:// > #cgi.HTTP_HOST#/flashservices/gateway/"); > var myService:mx.remoting.NetServiceProxy; > var responseHandler = {}; > responseHandler.onResult = function( results: Object ):Void { > var newitemindex = 0; > var newitemkey = 0; > _root.currentCustomers.dataProvider = results.items; > for (var i=0; i lt _root.currentCustomers.length; i++) { > if (_root.currentCustomers.dataProvider[i] > ['CUSTOMER_KEY'] gt newitemkey) > { > newitemkey = _root.currentCustomers.dataProvider[i] > ['CUSTOMER_KEY']; > newitemindex = i; > } > } > _root.currentCustomers.selectedIndex = newitemindex; > //This is the function that is not being called > GetCustomerFilesScript(); > } > > responseHandler.onStatus = function( stat: Object ):Void { > alert("Error while calling cfc:" + stat.description); > } > > myService = connection.getService > ("#APPLICATION.loc#.CFC.DataEntry", responseHandler ); > > myService.insertNewCustomer('#APPLICATION.dsn#','Enter ID', > 0,0,'','Enter Customer Name',0,'','','','',''); > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Houston ColdFusion Users' Group" discussion list. To unsubscribe, send email to [email protected] For more options, visit http://groups.google.com/group/houcfug?hl=en -~----------~----~----~----~------~----~------~--~---
