Skip to main content
Participant
January 20, 2012
Answered

Getting #1009 error - can't find my error

  • January 20, 2012
  • 1 reply
  • 718 views

Hi,

I'm trying to set up a contact form but I get a #1009 error. I read somewhere that it has to do with false targeting but I can't find my error(s). Please help.

// Imports needed for radio button grouping

import fl.controls.RadioButton;

import fl.controls.RadioButtonGroup;

// hide processing CM

processing_mc.visible = false;

// custom function we create to populate the comboBox list

function addPrintsToList ():void {

printList.addItem( { label: "DIBC" } );

printList.addItem( { label: "Fittraketerna" } );

}

// Run function above now

addPrintsToList ();

// make radio button group distictions

var radioGroup1:RadioButtonGroup = new RadioButtonGroup("radioGroupStorlek");

radioSmall.group = radioGroup1;

radioMedium.group = radioGroup1;

radioLarge.group = radioGroup1;

// build variable name for the URL Variables loader

var variables:URLVariables = new URLVariables;

// Build the varSend variable

var varSend:URLRequest = new URLRequest("form_parse.php");

varSend.method = URLRequestMethod.POST;

varSend.data = variables;

// Build the varLoader variable

var varLoader:URLLoader = new URLLoader;

varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

varLoader.addEventListener(Event.COMPLETE, completeHandler);

// handler for the PHP script completion and return of status

function completeHandler(event:Event):void {

    // remove processing clip

    processing_mc.visible = false;

    name_txt.text = "";

    email_txt.text = "";

    msg_txt.text = "";

    antal.value = 1;

    checkbox.selected = false;

// Load the response from php here

status_txt.text = event.target.data.return_msg;

}

// function ValidateAndSend

function ValidateAndSend (event:MouseEvent):void {

    // validate fields

    if(!name_txt.length) {

    status_txt.text = "Var god och fyll i ditt namn.";

    } else if (!email_txt.length) {

    status_txt.text = "Var god och fyll i din email.";

    } else if (!msg_txt.length) {

    status_txt.text = "Var god och skriv ett meddelande.";

    } else {

    // All is good, send the data now to PHP

    processing_mc.visible = true;

    // ready the variables in our form for sending

    variables.userName = name_txt.text;

    variables.userEmail = email_txt.text;

    variables.userMsg = msg_txt.text;

    variables.userPrints = printList.value;

    variables.userAntal = antal.value;

    variables.userStorlek = radioGroup1.selection.value;

    variables.userNewsletter = checkbox.selected;

    // Send the data to PHP now

    varLoader.load(varSend);

    } // close else condition for error handling

} // close validate and send function

Thanks in advance,

Anton

This topic has been closed for replies.
Correct answer Ned Murphy

The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....

 

- is declared but not instantiated

- doesn't have an instance name (or the instance name is mispelled)

- does not exist in the frame where that code is trying to talk to it

- is animated into place but is not assigned instance names in every keyframe for it

- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).

 

If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
January 20, 2012

The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....

 

- is declared but not instantiated

- doesn't have an instance name (or the instance name is mispelled)

- does not exist in the frame where that code is trying to talk to it

- is animated into place but is not assigned instance names in every keyframe for it

- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).

 

If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

NorthmarkAuthor
Participant
January 22, 2012

"- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s)."

This seemed to be the problem. Thank you yet again, Ned.

Ned Murphy
Legend
January 22, 2012

You're welcome