I don't know why its crashing but:

I don't see what your frame++ is doing because you reset it to 0 right
before anyway, so you should keep getting "EnterFrame 1" anyway.
Secondly, your else should also carry code to disable the Submit button, so
that if someone fills things in and then deletes it the button will disable
again.

I would recommend individual onChange listeners though, since you only
really have two things to check; it better than running a continuous
EnterFrame.

That's all I got,

Ashim

2008/10/23 sebastian <[EMAIL PROTECTED]>

> Assuming the form is also in the same flash file:
>
> I see no reason to use 'Event.ENTER_FRAME'
>
> Just have the other parts of your code 'activate' when you click the
> 'submit' button.
>
> Sebastian
>
>
> jonathan howe wrote:
>
>> But he wants the button to be disabled until it passes validation. Maybe
>> it's okay to do it the dirty way instead of assigning 4 different
>> listeners
>> to each of the validated fields.... but... I guess I would still have a
>> single validation function that is called onchange of the various entry
>> fields.
>>
>> On Wed, Oct 22, 2008 at 5:12 PM, Paul Andrews <[EMAIL PROTECTED]> wrote:
>>
>>  I'm surprised if it compiles.
>>>
>>> First look: trace("EnterFrame"+(frame+)); should at least be
>>> trace("EnterFrame"+(frame++));
>>>
>>> Try that. I'd be tempted not to use enterframe at all and validate on
>>> submit.
>>>
>>> Paul
>>>
>>>
>>> ----- Original Message ----- From: "FlashDev" <[EMAIL PROTECTED]>
>>> To: "Flash Coders List" <[email protected]>
>>> Sent: Wednesday, October 22, 2008 8:32 PM
>>> Subject: [Flashcoders] AS3 - Code problem, can anyone help?
>>>
>>>
>>>
>>> Hi Guys
>>>
>>> Im trying to write a little piece of code to stop the submit button of a
>>> form be active until the form fields have been completely filled in, its
>>> a
>>> really simple for consisting of 1 form field and 1 checkbox, ive had a go
>>> at
>>> writing some code of my own but for some reason flash quits on export.
>>>
>>> Whats wrong with my code?
>>> What do you think could be causing it to crash?
>>>
>>> here is my stab at it...
>>>
>>> submit_btn.useHandCursor = false;
>>> submit_btn.mouseEnabled = false;
>>>
>>> submit_btn.addEventListener(MouseEvent.CLICK, submit_btn_CLICK);
>>> this.addEventListener(Event.ENTER_FRAME, ENTERFRAME);
>>>
>>> function ENTERFRAME(ev:Event):void
>>> {
>>>  if((mobileNumber.text != "") || (mobileNumber.text != NaN) ||
>>> (mobileNumber.text != undefined) && (terms.selected != false)){
>>>      submit_btn.useHandCursor = true;
>>>      submit_btn.mouseEnabled = true;
>>>  }else{
>>>      var frame:int = 0;
>>>      trace("EnterFrame"+(frame+));
>>>  }
>>> }
>>> function submit_btn_CLICK(ev:Event):void
>>> {
>>>  var url:String = "formSubmit.php";
>>>  var request:URLRequest = new URLRequest(url);
>>>  var variables:URLVariables = new URLVariables();
>>>      variables.mobile = mobileNumber.text;
>>>  request.data = variables;
>>>  request.method = URLRequestMethod.POST;
>>>  try {
>>>      navigateToURL(request, "_blank");
>>>  }
>>>  catch (err:Error) {
>>>      trace(err);
>>>  }
>>> }
>>>
>>> Thanks
>>> SJM
>>> _______________________________________________
>>> Flashcoders mailing list
>>> [email protected]
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>> _______________________________________________
>>> Flashcoders mailing list
>>> [email protected]
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>>
>>
>>
>>  _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
The Random Lines
My online portfolio
www.therandomlines.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to