Hi there. first post.
so i was writing/taking some code from the internet and modding it for my own needs, and it just so happens that no matter what i do, i can’t seem to get rid of ERROR 1069.
ReferenceError: Error #1069: Property writing not found on String and there is no default value.
at Untitled_fla::movie_stage_1/dataOnLoad()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
my code for my script is as follows
send_button.addEventListener(MouseEvent.CLICK, save_fn);
function save_fn(evt:Event):void {
if(nameof.text!="" && mobile.text !="" && email.text!=""){
var myData:URLRequest = new URLRequest("save.php")
// var myData:URLRequest = new URLRequest("save.cfm")
myData.method = URLRequestMethod.POST
var variables:URLVariables = new URLVariables()
variables.nameof = nameof.text
variables.mobile = mobile.text
variables.email = email.text
myData.data = variables
var loader:URLLoader = new URLLoader()
loader.dataFormat = URLLoaderDataFormat.TEXT
loader.addEventListener(Event.COMPLETE, dataOnLoad)
loader.load(myData)
//statustext.text = "Okay 1"
} else statustext.text = "All fields are mandatory"
}
// the error pertains from some sort of naming problem. either i have not declared "writing" properly with a evt.target.data thing, or there is something beyond what i could spot.
//and a call back piece of code
function dataOnLoad(evt:Event){
if(evt.target.data.writing=="Ok") {
trace("OKAY")
} else trace("Error in saving submitted data");
}
and the PHP code i’m using is:
<?php //Capture data from $_POST array $nameof = $_POST['nameof']; $email = $_POST['email']; $mobile = $_POST['mobile']; //Make one big string in a format Flash understand $toSave = "nameof=".$nameof."&email=".$email."&mobile=".$mobile; //Open a file in write mode $fp = fopen("text.txt", "w"); if(fwrite($fp, $toSave)) echo "writing = ok";
else echo "writing=Error"; fclose($fp); ?>
any help would be appreciated, in terms of what i’m doing wrong. it’s probably something right in front of me and i can’t see it.
my level: intermediate.