Flex / AS3 metadata tags are handled differently when defining an interface, than when defining classes?

If I use metadata tags before the interface, is it the same as before the class? I. e., Can I do

[Event(name="fooUpdate", type="com.acme.events.FooEvent")
public interface IFoozer extends IEventDispatcher
{
}

// ... now omit that metadata in the implementations ...

public class Foozer extends EventDispatcher implements IFoozer
{
    public function set bar(b:Bar):void
    {
        this.dispatchEvent(new FooEvent(FooEvent.FOO_UPDATE));
    }
}

// ... and expect it to be known in MXML ...

<acme:Foozer fooUpdate="myUpdateHandler">
  <!-- ... -->
</acme:Foozer>

Or, similarly, with [Bindable]?

+3
source share
2 answers

You can define metadata [Event]in interfaces for informational purposes, but unlike functions, you cannot ensure that these implementations use these events. In my experience, you should override events in implementation classes.

+1
source

... [Event] ... [Bindable] - ... [Bindable] ( !!) AS3, , PropertyChangeEvent , ( , mxmlc AS3)...

, [Embed] ([Embed] . )... flash.utils::describeType... , , , ... , , , flex, MXML ( [Event])... AS3... AS3 - , VM, MXML Flex Framework .. ActionScript MXML ( , MXML , (, , ), AS3 ( "" MXML, AS3, , th e flash.events, MXML, AS3))...

, , ... , , ... ... , , /...

: , ... [Event(name="fooUpdate", type="com.acme.events.FooEvent")] - ... AS3, - ( [Bar(foo="123")])... , , , - : this.dispatchEvent(new FooEvent(FooEvent.FOO_UPDATE));... , , IFoozer FooEvent.FOO_UPDATE... , , ...

, ...

+5

Source: https://habr.com/ru/post/1721440/


All Articles