flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Heidegger ...@leichtgewicht.at>
Subject Re: [BUG][ISSUE] Regards Type Casting
Date Wed, 28 Mar 2012 07:36:37 GMT
Hello Manish,

-- Casting:
ActionScript does not differ between a Integer or int. However: casting 
is possible by using a class as a function:

   var foo: Bar = Bar( anything );

or with the "as" keyword

   var foo: Bar = anything as Bar;

The difference between the two statements is that Bar(anything) will 
throw an error if the types don't match but "as Bar" will return null.
If you have a variable of a dynamic "*" type then it will be 
automatically casted:

    var anything: * = new Baz();
    var foo: Bar = anything; // throws an error if anything isn't of 
type Baz

-- Events:
ActionScript implements the ECMAScript event dispatching mechanism [1]. 
The separation of type (String) and data (Event object) is useful
to pass additional data with it.

-- Function Overloading:
ActionScript does not support parameter overloading. It has been 
requested as ASL feature at Adobe [2]  But Adobe is very careful not
to change(improve) ActionScript as a language. Aside from that: Method 
overloading is a controversial feature anyways.

ALL the questions you've asked are ActionScript specific (not Flex 


[1] http://www.w3.org/TR/DOM-Level-2-Events/ecma-script-binding.html
[2] https://bugs.adobe.com/jira/browse/ASL-9

On 28/03/2012 16:09, manish sharma wrote:
> Hi All,
> I am not able to understand that it is a bug or not an issue.
> If you know the concept of Casting (in which one object is 
> being cased in to parent Class) i.e. you can convert *int* into *INTEGER.*
> *
> *
> Same thing I am going to do with the Event class. In the attached 
> files I have just dispatch a simple MouseEvent.Click  which is cased 
> into Event but when i run the application it gives a error no Source. 
> i.e. Can be type casted.
> Second thing. I have also apply a add Event Listener in the main file 
> and Linten a mouse Event and apply a function on it which calls when 
> the event is being dispatched. In Argument I have pass a Event Class 
> object.
> How's that Possible one side it gives me error and second side it is 
> working fine.
> Please Tell me about this.  One more thing I have found the Flex is 
> not Supported the OOPS concept. i.e. Function Overloading
> Thanks & Regards***?*

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message