2008-11-20
Creating a Button with Alchemy!
Sure this makes less sense... however... The Alchemy API offers lots of functions that I need to understand. And after my first attempts yesterday I got inspired to go further.

The code snippet below does a lookup in the runtime for the named property in the specified namespace. In our case it returns the ButtonClass definition which then can be used to instantiate the Button object.
AS3_Val buttonClass = AS3_NSGet( AS3_String("mx.controls"), AS3_String("Button") ); AS3_Val emptyParams = AS3_Array(""); AS3_Val button = AS3_New(buttonClass, emptyParams);
The next snippets shows how to fetch the passed parameter (when calling the getButton-Method from Flex) and how to assign it to previously created Button object.
char* label = NULL; AS3_ArrayValue(args, "StrType", &label); AS3_Set(button, AS3_String("label"),AS3_String(label));
All sources of this simple example are here:
I think I will dive into AS3_ThunkProc soon - have fun!

