As the question suggests, I am trying to find out a way to call a method/function by passing in the string of the function name, instead of the function itself. Reflect.callMethod
requires the function itself, but is it possible to call it some other way?
public static inline function colorByName(name:String):Color
{
}
//Colors taken from MSDN: https://msdn.microsoft.com/en-us/library/system.drawing.color%28v=vs.110%29.aspx
public static inline function aliceBlue() return new Color(0xF0, 0xF8, 0xFF);
public static inline function antiqueWhite() return new Color(0xFA, 0xEB, 0xD7);
public static inline function aqua() return new Color(0x00, 0xFF, 0xFF);
public static inline function aquamarine() return new Color(0x7F, 0xFF, 0xD4);
public static inline function azure() return new Color(0xF0, 0xFF, 0xFF);
public static inline function beige() return new Color(0xF5, 0xF5, 0xDC);
public static inline function bisque() return new Color(0xFF, 0xE4, 0xC4);
public static inline function black() return new Color(0x00, 0x00, 0x00);
Here is a small sample of a file I have in my openfl-gui API called Color.hx
including the function that would allow you to pass in a name for a color that returns that color by simply calling the static function. Is there a way to do this? So far, I have not found a way.