Re: [Flashcoders] Swtich Statement issue!?

2005-12-07 Thread Julien Vignali

Dan,
I'm also using the switch with static attributes from other class 
without any problems. I guess you have a type error problem.

Check the trace of a strict equality test:
trace(currItem.getMediaType() === VideoVO.SWF_STATE);
If it returns true, then the switch should evaluate properly. If not, 
the switch will branch to the default case because the condition and the 
case aren't of the same type.




Dan Thomas a écrit :

I have a method that returns a number which I know to be of value 1
I have a static number variable in another class (SWF_STATE) which I
also know to be 1.
In an if() statement they evaluate to equal the same, however in the
following switch statement it will not evaluate?


trace(TYPE:+currItem.getMediaType()+ COMPARED TO: +
VideoVO.SWF_STATE); // this traces TYPE:1 COMPARED TO:1


if(currItem.getMediaType() == VideoVO.SWF_STATE)
{
trace(wtf?!);//this evaluates and traces
}
switch(currItem.getMediaType()) // this switch always traces the
error (default branch)
{
case VideoVO.FLV_STATE:
this.currentPlayer = swfPlayer;
break;
case VideoVO.SWF_STATE:
this.currentPlayer = swfPlayer;
break;
case VideoVO.MP3_STATE:
this.currentPlayer = swfPlayer;
break;
case sometest==VideoVO.JPG_STATE:
this.currentPlayer = swfPlayer;
break;
default:
trace(ERROR: NO MEDIA TYPE!);
}

trace(sometest); // traces 1
trace(VideoVO.SWF_STATE); // traces 1

Any help on this very much appreciated!

Dan

This message and any attachments should only be read by those persons to whom it is addressed and be used by them for its intended purpose.  It must not otherwise be reproduced, modified, distributed, published or actioned. If you have received this e-mail in error, please notify us immediately by telephone on 01202 237000 and delete it from your computer immediately. This e-mail address must not be passed to any third party or be used for any other purpose. Every reasonable precaution has been taken to ensure that this e-mail, including attachments, does not contain any viruses. However, no liability can be accepted for any damage sustained as a result of such viruses, and recipients are advised to carry out their own checks. 



Moov2 Ltd cannot accept liability for statements made which are clearly the 
senders own and not made on behalf of the Moov2 Ltd. An e-mail reply to this 
address may be subject to interception or monitoring for operational reasons or 
for lawful business purposes.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Swtich Statement issue!?

2005-12-06 Thread Dan Thomas
I have a method that returns a number which I know to be of value 1
I have a static number variable in another class (SWF_STATE) which I
also know to be 1.
In an if() statement they evaluate to equal the same, however in the
following switch statement it will not evaluate?


trace(TYPE:+currItem.getMediaType()+ COMPARED TO: +
VideoVO.SWF_STATE); // this traces TYPE:1 COMPARED TO:1


if(currItem.getMediaType() == VideoVO.SWF_STATE)
{
trace(wtf?!);//this evaluates and traces
}
switch(currItem.getMediaType()) // this switch always traces the
error (default branch)
{
case VideoVO.FLV_STATE:
this.currentPlayer = swfPlayer;
break;
case VideoVO.SWF_STATE:
this.currentPlayer = swfPlayer;
break;
case VideoVO.MP3_STATE:
this.currentPlayer = swfPlayer;
break;
case sometest==VideoVO.JPG_STATE:
this.currentPlayer = swfPlayer;
break;
default:
trace(ERROR: NO MEDIA TYPE!);
}

trace(sometest); // traces 1
trace(VideoVO.SWF_STATE); // traces 1

Any help on this very much appreciated!

Dan

This message and any attachments should only be read by those persons to whom 
it is addressed and be used by them for its intended purpose.  It must not 
otherwise be reproduced, modified, distributed, published or actioned. If you 
have received this e-mail in error, please notify us immediately by telephone 
on 01202 237000 and delete it from your computer immediately. This e-mail 
address must not be passed to any third party or be used for any other purpose. 
Every reasonable precaution has been taken to ensure that this e-mail, 
including attachments, does not contain any viruses. However, no liability can 
be accepted for any damage sustained as a result of such viruses, and 
recipients are advised to carry out their own checks. 


Moov2 Ltd cannot accept liability for statements made which are clearly the 
senders own and not made on behalf of the Moov2 Ltd. An e-mail reply to this 
address may be subject to interception or monitoring for operational reasons or 
for lawful business purposes.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders