2. The context is that of a theatrical production. When an actor takes a part in such, it is "as Hamlet" etc For example,"It is a Royal Shakespeare Production of Hamlet, with Laurence Olivier as Hamlet." We could also say (but this islonger and in speech, we tend to use the briefer version I've just mentioned): " ...taking the role of Hamlet/in the role of Hamlet."
I guess "as" serves the purpose as in, "In a play, people act as if they really are the character."
"Whilst the parents were so ill, he acted as the children's temporary guardian."
Student or Learner