[BNM] Flash "if" statement @
Robert Stevens
robs_here at btinternet.com
Wed Nov 1 09:58:05 GMT 2006
Seb,
Thanks for your reply.
Dunno, can't seem to get it working.
Here's example of the code:
_root.form.my_btn.onRelease = function() {
emailAddress = _root.form.email;
if (emailAddress.indexOf("@")) {
_root.gotoAndStop("no_error");
}
};
Do I need to specify 'String' in here somewhere. Is
that it?
Thanks,
Rob
--- Seb L <pluginseb at gmail.com> wrote:
> Hi Robert,
>
> indexOf should work fine in this case... check for a
> result of -1 :
>
> var mystr:String = "12345 at 234";
> var mystr2:String = "123454t";
>
> trace(mystr.indexOf("@")); // returns 5
> trace(mystr2.indexOf("@")); // returns -1
>
> If that's still not working I suspect you have a
> referencing problem,
> make sure you're actually testing the right thing!
> I'd trace the value
> to make sure that it's what you should be checking.
>
> good luck :-)
>
> Seb
>
> On 31/10/06, Robert Stevens
> <robs_here at btinternet.com> wrote:
> > Hi All,
> >
> > An easy one here for many of you I'm sure.
> >
> > I have a function set up for a button which
> includes
> > an 'if' statement.
> > I simply need to check if the "@" symbol is
> present in
> > a form field.
> > I've tried the "indexOf" method but it didn't seem
> to
> > work.
> >
> > Thanks in advance,
> >
> > Rob
> >
> >
> > --
> >
> > BNM info/subscription/archives:
> http://www.brightonnewmedia.org/
> >
> > BNM archive search:
> http://www.roddis.org/bnm/search.php
> > BNM Del.icio.us tag: http://del.icio.us/tag/bnm/
> > BNM Flickr group:
> http://www.flickr.com/groups/bnm/
> >
> > BNM powered by http://www.screen-play.net/
> >
>
> --
>
> BNM info/subscription/archives:
> http://www.brightonnewmedia.org/
>
> BNM archive search:
> http://www.roddis.org/bnm/search.php
> BNM Del.icio.us tag: http://del.icio.us/tag/bnm/
> BNM Flickr group: http://www.flickr.com/groups/bnm/
>
> BNM powered by http://www.screen-play.net/
>
More information about the BNMList mailing list
BNMList is hosted by Screenlists, a Screen-Play.net service