As, when and while are conjunctions that are used to talk about simultaneous actions. But it doesn't mean that they have absolutely the same meaning. It's not a big difference between them but you should know about it.
At first, in general. We use these conjunctions interchangeably to speak about a longer action that is/was in progress when a shorter action occurs/occured.
When/as/while I was writing, he entered the room.
Mother was cooking when/as/while the phone rang.
While or as
We can use 'while' and 'as' to speak about longer simultaneous actions that happen together at the same time. But generally, we prefer to use 'while' rather than 'as' in these cases.
I was reading while/as my husband was working.
He played the piano every evening while/as she read books.
As or when
We can use 'as' or 'when' to speak about short actions that occur at the same time. And we can't use 'while' in these cases. Also, we prefer to use 'as' when we talk about changes.
It started to rain as/when/while I was going to walk with the dog.
As/when/while you get older, you become more and more aware that your family is the biggest treasure.
When or while
It is possible to omit subject and verb be if in 'when' or 'while' clauses in cases when main and subordanate clauses refer to the same subject. But we do not use 'as' here.
When/while/as in Germany, Carol learnt much about football.
When/while/as cooking an apple cake, don't forget to use baking powder.