| Author |
Serverside type check
|
|
| Stefan Richter 2005-08-10, 5:46 pm |
| I have an object property in my serverside script that I want to check.
There is a room Object 'roomObj' and sometimes this object will have
properties such as roomObj.roomname
The type of roomObj itself is 'object'.
I try and check if the roomname already exists but when I do
var myvar = roomObj.roomname;
I get an error:
room.asc: line 49: TypeError: roomObj has no properties
Ok I know why that is, there is no roomname at the time of my check. But how
can I check it? Even this line throws the same error:
trace(typeof(roomObj.roomname)); // script falls over
Thanks
Stefan
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Beto A 2005-08-10, 5:46 pm |
| put an if statement in there.
if (yourvar=3D=3Dundefined){
trace("not setup");
}else{
trace(typeof(roomObj.roomname));=20
}
Stefan Richter <stefan-fMeCE+ULXElEfu+5ix1nRw@public.gmane.org> wrote:
I have an object property in my serverside script that I want to check.
There is a room Object 'roomObj' and sometimes this object will have
properties such as roomObj.roomname
The type of roomObj itself is 'object'.
I try and check if the roomname already exists but when I do
var myvar =3D roomObj.roomname;
I get an error:
room.asc: line 49: TypeError: roomObj has no properties
Ok I know why that is, there is no roomname at the time of my check. But =
how
can I check it? Even this line throws the same error:
trace(typeof(roomObj.roomname)); // script falls over
Thanks
Stefan
=3D-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
________________________________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around=20
http://mail.yahoo.com=20
=3D-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Naicu Octavian 2005-08-10, 5:46 pm |
| > put an if statement in there.
> if (yourvar=3D=3Dundefined){
> trace("not setup");
> }else{
> trace(typeof(roomObj.roomname));=20
> }
The above code will throw an error when used
Server-Side.
Use instead:
if (typeof yourvar =3D=3D"undefined"){
trace ("yourvar does not exists")
}
THis issue is covered in programming FCS Chapter 4.
=09
________________________________________
____________
Start your day with Yahoo! - make it your home page=20
http://www.yahoo.com/r/hs=20
=20
=3D-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Beto A 2005-08-10, 5:46 pm |
| thanx for the correction.
Naicu Octavian <naicuoctavian-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> put an if statement in t=
here.
> if (yourvar=3D=3Dundefined){
> trace("not setup");
> }else{
> trace(typeof(roomObj.roomname));=20
> }
The above code will throw an error when used
Server-Side.
Use instead:
if (typeof yourvar =3D=3D"undefined"){
trace ("yourvar does not exists")
}
THis issue is covered in programming FCS Chapter 4.
________________________________________
____________
Start your day with Yahoo! - make it your home page=20
http://www.yahoo.com/r/hs=20
=3D-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=09
---------------------------------
Start your day with Yahoo! - make it your home page=20
=3D-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Peldi Guilizzoni 2005-08-10, 5:46 pm |
| if (roomObj !=3D undefined && roomObj["roomname"] !=3D undefined)
//do something
-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of Stefan
Richter
Sent: Wednesday, August 10, 2005 10:06 AM
To: 'FlashComm Mailing List'
Subject: [FlashComm] Serverside type check
I have an object property in my serverside script that I want to check.
There is a room Object 'roomObj' and sometimes this object will have
properties such as roomObj.roomname
The type of roomObj itself is 'object'.
I try and check if the roomname already exists but when I do
var myvar =3D roomObj.roomname;
I get an error:
room.asc: line 49: TypeError: roomObj has no properties
Ok I know why that is, there is no roomname at the time of my check. But
how
can I check it? Even this line throws the same error:
trace(typeof(roomObj.roomname)); // script falls over
Thanks
Stefan
=3D-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Fernando Flórez 2005-08-10, 5:46 pm |
| Actually just the second part should work. You can use strict typing
for this kind of work. 
Fernando
On 8/10/05, Peldi Guilizzoni <gguilizzoni-14osZcCZf762oZ/6fjIToQ@public.gmane.org> wrote:
> if (roomObj !=3D undefined && roomObj["roomname"] !=3D undefined)
> //do something
>=20
> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of Stefan
> Richter
> Sent: Wednesday, August 10, 2005 10:06 AM
> To: 'FlashComm Mailing List'
> Subject: [FlashComm] Serverside type check
>=20
> I have an object property in my serverside script that I want to check.
> There is a room Object 'roomObj' and sometimes this object will have
> properties such as roomObj.roomname
>=20
> The type of roomObj itself is 'object'.
>=20
> I try and check if the roomname already exists but when I do
> var myvar =3D roomObj.roomname;
> I get an error:
>=20
> room.asc: line 49: TypeError: roomObj has no properties
>=20
>=20
> Ok I know why that is, there is no roomname at the time of my check. But
> how
> can I check it? Even this line throws the same error:
>=20
> trace(typeof(roomObj.roomname)); // script falls over
>=20
> Thanks
>=20
> Stefan
>=20
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20
> -----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> -----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Stefan Richter 2005-08-10, 5:46 pm |
| Thanks everyone, so easy when you know how...
-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of Peldi
Guilizzoni
Sent: Wednesday, August 10, 2005 7:06 PM
To: FlashComm Mailing List
Subject: RE: [FlashComm] Serverside type check
if (roomObj != undefined && roomObj["roomname"] != undefined)
//do something
-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of Stefan Richter
Sent: Wednesday, August 10, 2005 10:06 AM
To: 'FlashComm Mailing List'
Subject: [FlashComm] Serverside type check
I have an object property in my serverside script that I want to check.
There is a room Object 'roomObj' and sometimes this object will have
properties such as roomObj.roomname
The type of roomObj itself is 'object'.
I try and check if the roomname already exists but when I do var myvar =
roomObj.roomname; I get an error:
room.asc: line 49: TypeError: roomObj has no properties
Ok I know why that is, there is no roomname at the time of my check. But how
can I check it? Even this line throws the same error:
trace(typeof(roomObj.roomname)); // script falls over
Thanks
Stefan
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=---------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=---------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
|
|
|
|