Custom components – order of parameters

A pain with parameters in custom components is that the order is set to alphabetical, and there’s nothing you can do about it. It’s a pain, because you might want better consistency to your parameters in different components, or to put the higher priority parameters first…

I’d already resigned myself to this fact when I happened upon a comment in a six year old blog post with a sneaky solution.

Add the unicode character \u200b to a parameter and it will come before the others. Add two of the same unicode characters and it will come before that one. And so on. It’s just like aaaa at the beginning of the phone book.
eg.

[Inspectable(name="\u200B\u200BItem no:")]
public var itemNo:int;
[Inspectable(name="\u200BXML tag:")]
public var xmlTag:String;
[Inspectable(name="Scale:")]
public var scale:Number;

will put the parameters in the order:
Item no:
XML tag:
Scale:

Interactive developer, Author - iOS development with Swift - book coming 2017 https://manning.com/books/ios-development-with-swift

Tagged with:
Posted in Flash

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: