3

The Context: I'm creating a component in Flash CS6 with ActionScript 3. I use a custom class which extends UIComponent. When I drag the component on the scene I have some properties with values in the Component Parameters in Flash. I created them with

[Inspectable(name="ParamName", type="String", defaultValue="some_param_value")]

I have one property which is a List.

[Inspectable(name="My List", type="List", defaultValue="One", enumeration="One,Two,Three")]

The Question Can I fill the list with values I collect in an array via a web service. I'm talking about the enumeration property.

I really need to make that work, so if it's not technically possible, how can I build my component alternatively?

Thanks in advance for every idea, suggestion or hint!

Leo
  • 5,363
  • 5
  • 27
  • 30
  • So let me understand this. You want your component to pull data from a server at author time? – The_asMan Nov 09 '12 at 16:17
  • Exactly! I'm not quite sure if this is possible, but I need to figure out how to do it for the component? – Leo Nov 09 '12 at 16:48

1 Answers1

1

Inspectable metadata tag is intended to provide information to the compiler that describes how your components are used in an application.

These compile-time directives are never interpreted during run time.

Described by the class definition, these properties are not dynamic.

<type name="X" base="Class" isDynamic="true" isFinal="true" isStatic="true">
  <extendsClass type="Class"/>
  <extendsClass type="Object"/>
  <accessor name="prototype" access="readonly" type="*" declaredBy="Class"/>
  <factory type="X">
    <extendsClass type="flash.events::EventDispatcher"/>
    <extendsClass type="Object"/>
    <implementsInterface type="flash.events::IEventDispatcher"/>
    <variable name="listOptions" type="Array">
      <metadata name="Inspectable">
        <arg key="name" value="My List"/>
        <arg key="type" value="List"/>
        <arg key="defaultValue" value="One"/>
        <arg key="enumeration" value="One,Two,Three"/>
      </metadata>
    </variable>

In addition, application domain and network calls at author time on Flash Pro's artboard can be problematic; although, I've developed a Google Maps component capable of making calls to load maps while authoring.

Although academic, this seems like an inappropriate use of this tag. This implementation is typically for static options of your component.

This could only be accomplished via an automated process that auto-generates the class definitions.

As in, you could call a service that writes the ActionScript class files populated with the enumerable values. Then, have automated builds that push new compiled components for update.

Beyond compiled assembly, there is no way to dynamically update these definitions realtime.

Jason Sturges
  • 15,855
  • 14
  • 59
  • 80