I have a contact form movie clip inside my main stage and I can’t seem to figure out why I keep getting this error when I try to tab through my contact form:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at fl.managers::FocusManager/getChildIndex()
at fl.managers::FocusManager/sortByDepth()
at fl.managers::FocusManager/sortByTabIndex()
at Array$/_sort()
at Array/http://adobe.com/AS3/2006/builtin::sort()
at fl.managers::FocusManager/sortFocusableObjectsTabIndex()
at fl.managers::FocusManager/sortFocusableObjects()
at fl.managers::FocusManager/keyDownHandler()
This is yet another AS3 issue that’s leaves me running around in circles… can anyone help me out?
did you try tabIndex? Example my_text.tabIndex = 1; my_other_text.tabIndex = 2; I am not sure if it works in AS3 but it did in AS2.
[QUOTE=craig.clayton;2341960]did you try tabIndex? Example my_text.tabIndex = 1; my_other_text.tabIndex = 2; I am not sure if it works in AS3 but it did in AS2.[/QUOTE]
That’s not the problem. I’ve already got my tabIndex’s written. Has nothing to do with that.
There are 5 elements involved in the tab index… 4 textfields that are on the stage, and one button. this is just so ridiculous it’s not even funny.
I’m not dynamically creating anything… that’s why I think it’s so bizzare. They are literally on the stage when the SWF is published. Do I need to import something? AS3 is so frustrating.
Not using removeChild or addChild or anything dynamic, really…
There’s really not even any code… I’ve got 4 text boxes on the stage with instances and a button… I’ve given those tabIndex’s from 1-5.
I mean, here’s the code in that MovieClip:
stop();
contact_toEmail.text = MovieClip(root).szEmail;
//form handler
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("sendmail.php");
var varLoader:URLLoader = new URLLoader;
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
submit.addEventListener(MouseEvent.CLICK, sendActions, false, 0, true);
function sendActions(event:MouseEvent):void
{
if (contact_name.text == "" || contact_fromEmail.text == "" || contact_subject.text == "" || contact_message.text == "" )
{
contact_status.text = "You must fill in all of the fields to proceed";
}
else
{
variables.toEmail = contact_toEmail.text;
variables.fullName = contact_name.text;
variables.email = contact_fromEmail.text;
variables.subject = contact_subject.text;
variables.message = contact_message.text;
varLoader.load(varSend);
play();// playhead will move forward to the stop action on frame label "submit".
}
}
// tabIndex
contact_name.tabIndex = 1;
contact_fromEmail.tabIndex = 2;
contact_subject.tabIndex = 3;
contact_message.tabIndex = 4;
submit.tabIndex = 5;
I can’t imagine that there’s anything wrong in here…