build event function