Initializing Components with Inspectable Properties

When you slap the [Inspectable] tag above a getter/setter pair in an ActionScript class you can then go and attach your class to a symbol in Flash (and tell it that the symbol is a component) and WHA-LA! you have a property that’s inspectable in the Component Inspector panel.

That’s all fine and good. The problem is when you’re trying to actually USE that property. The problem is that your component FIRST has it’s constructor called and THEN all of the properties that you set in the Component Inspector get set. Whoops.

What you need is some way of making sure that you have some code that runs AFTER all of your properties are set. Well, the easiest way to do this is to tap into the oft-ignored Event.EXIT_FRAME event as I explained in this answer I posted up on StackOverflow.

no comments

  • No comments yet.