This happens because of implicit type conversion (in this case it's
more than just type conversation but it makes sense here). notice that
adding another element to array leads to "Ok"


--- In flexcoders@yahoogroups.com, "Marco Catunda" <marco.catu...@...>
wrote:
>
> Hi,
> 
> Why the Alert method shows "Crazy" string at this code below?
> I really didn't fingure it out.
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
>       creationComplete="onCreationComplete(event)">
> 
>       <mx:Script>
>               <![CDATA[
>                       import mx.controls.Alert;
>                       public function onCreationComplete(event: Event): void {
>                               
>                               var a: Array = new Array();
>                               a.push( 2 );
>                               
>                               var i: Object = 2;
>                               
>                               if( a == i ) {
>                                       Alert.show( "Crazy...!!!" );
>                               } else {
>                                       Alert.show( "Ok" );
>                               }
>                               
>                       }
>                       
>               ]]>
>       </mx:Script>
> 
> 
>       
> </mx:Application>
>


Reply via email to