flash data integration:
Hi everyone...hoping you guys can give me some feedback on the following. I'm stuck. I have a form that I can get to work using text input fields, but I need to get it to work using the components. I have a flash form with the following: prmZip instance: text input box prmMilage instance: combo box prmUnita instance: data= Mi, label= Mi prmUnitb instance: data=Km, label=Km go button with the following AS attached: on (release) { var EditSubmit = 1; (this is code that my CF form uses) getURL("http://www.mycoldfusionURL.cfm", "_blank", "POST"); } First Frame AS: textListener = new Object(); textListener.handleEvent = function (evt){ if (evt.type == "enter"){ trace("You must enter at least 5 characters"); } } prmZip.addEventListener("enter", textListener); prmMilage.addItem({data:20, label:"20"}); prmMilage.addItem({data:5, label:"5"}); prmMilage.addItem({data:50, label:"50"}); prmMilage.addItem({data:100, label:"100"}); prmMilage.addItem({data:200, label:"200"}); var cbListener:Object = new Object(); cbListener.change = function (evt_obj:Object) { trace("Currently selected item is: " + evt_obj.target.selectedItem.label); } //Add Listener prmMilage.addEventListener("change", cbListener); My question is, when exported, the variables are not gettng sent to my URL. I read something about having to put it inside a Movie Clip? If so, do I put all the variables inside the movie clip? just one? I'm confused...I got this to work with text input fields, but I need to get the components to work...Published in Flash 6. Any help is appreciated!! Thanks.
Elizabeth, Looking at your code, you are just loading the url from CF. You will need to use LoadVars to pass variables to CF (or other web forms). Here is an example of how to use LoadVars: var resultLV:LoadVars = new LoadVars(); var formLV:LoadVars = new LoadVars(); formLV.prmZip = prmZip.text; formLV.prmMileage = prmMileage.selectedItem.value; //rest of form data formLV.sendAndLoad("http://www.mycoldfusionURL.cfm", resultLV, "POST"); resultLV.onLoad = function(success){ if(success){ //code what to do when server returns result } } Hope this helps, Shack
Thanks for your response Shack...a bit confused. Does this go on the button? formLV.sendAndLoad("http://www.mycoldfusionURL.cfm", resultLV, "POST"); Not sure what to do with this part either: resultLV.onLoad = function(success){ if(success){ //code what to do when server returns result } Do i need to add the formLV.sendAndLoad("http://www.mycoldfusionURL.cfm", resultLV, "POST"); here? : I have this on my First Frame... textListener = new Object(); textListener.handleEvent = function (evt){ if (evt.type == "enter"){ trace("You must enter at least 5 characters"); } } prmZip.addEventListener("enter", textListener); prmMilage.addItem({data:20, label:"20"}); prmMilage.addItem({data:5, label:"5"}); prmMilage.addItem({data:50, label:"50"}); prmMilage.addItem({data:100, label:"100"}); prmMilage.addItem({data:200, label:"200"}); var cbListener:Object = new Object(); cbListener.change = function (evt_obj:Object) { trace("Currently selected item is: " + evt_obj.target.selectedItem.label); } //Add Listener prmMilage.addEventListener("change", cbListener); var resultLV:LoadVars = new LoadVars(); var formLV:LoadVars = new LoadVars(); formLV.prmZip = prmZip.text; formLV.prmMileage = prmMileage.selectedItem.value; formLV.prmUnita = prmUnita.selectedItem.value; formLV.prmUnitb = prmUnitb.selectedItem.value; resultLV.onLoad = function(success){ if(success){ //code what to do when server returns result } }
Elizabeth, Yes the sendAndLoad function will be in the onRelease function for your button. The resultLV.onLoad is a callback from the CFM page and handles the return object (if any) for your application. If you are not returning anything from the CFM, then a simple message to the user letting them know that the form was submitted and processed would go there. Shack
Don't see what you're looking for? Try a search.
|