"myXML = new XML(event.result);"
And you do not need the "new". XML() is a very powerful "top-level" function. Often, you can cast, using the "as' keyword, but I have found the XML() function to be more reliable. Also, trace() is invaluable for debugging. You may need to configure your mm.cfg file to enable tracing. Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Troy Gilbert Sent: Saturday, April 19, 2008 12:29 PM To: [email protected] Subject: Re: [flexcoders] flashvars issues > It seems to keep dying, any ideas? Where does it die? Have you stepped through the code in a debugger? Does it successfully connect and then fail, or does an exception get thrown prior to that? Its much easier for you to see the problem on your end when you step through the debugger. A few issues, perhaps one of them addresses the problem: > var service:HTTPService = new HTTPService; In AS3, you really should use constructors like this: var service:HTTPService = new HTTPService(); Constructors are functions, and as such should have open/close parens on them. > service.url = "{getsite()}"; Binding doesn't work like that. Curly-brace binding { } can only be used in MXML attributes, not inside of script blocks (or .as files). That line should be rewritten as: service.url = getsite(); In this situation, binding is probably not appropriate anyway (the value doesn't change during the lifetime of the application) and wouldn't work anyway as the binding would have no idea when it should "fire" because you've just given it a function... it'll execute the function once at startup (if used correctly in MXML), but after that it won't know when the function would return a different value. > service.addEventListener("result", httpResult); > service.addEventListener("fault", httpFault); You really should be used the ResultEvent.RESULT and FaultEvent.FAULT constants for the event types instead of the string literals. Makes the code easier to maintain, improves readability, etc. > var result:Object = event.result; > myXML = new XML(result); FYI, you don't have to copy event.result into result:Object before passing it to the XML constructor. You could just do: myXML = new XML(event.result); > var faultstring:String = event.fault.faultDetail; > Alert.show("Unable to get site."); If you don't want to mess with the debugger, you should at least include the contents of the error message in your alerts: Alert.show("Unable to get site: " + event.fault.faultDetail); Troy.

