Handle<Value> TiMedia::_createControlHelper(void* userContext, CREATEOBJECTCALLBACK createCallback, const Arguments& args) { HandleScope handleScope; TiMedia* obj = (TiMedia*) userContext; Handle<ObjectTemplate> global = getObjectTemplateFromJsObject(args.Holder()); Handle<Object> result; result = global->NewInstance(); TiProxy* newControl = (createCallback)(obj->objectFactory_); newControl->setAttachedObject(obj); newControl->setValue(result); newControl->makeWeak(); if (args.Length() > 0) { newControl->applyProperties(args[0]); } setTiObjectToJsObject(result, newControl); return handleScope.Close(result); }