Yes, Tara, you can use both "as" and "when" there.
The difference is that "as" indicates simultaneity, with both actions taking place in parallel.
Instead, "when" introduces the time when the main action took place.
In this case, the result is approximately the same. With another verb in the adverbial clause, "as" or "when" may be preferred:
- As she talked to me, I looked at the shop windows. ("as" here means "while")
The use of "when" in the sentence above would mean that every time she talked to me, I turned and looked at the shop windows. The use of "as" suggests that I looked at the shop windows throughout the time she talked to me.
- When I went to the mall, I looked at the shop windows. (Here we cannot use "as" because there is no simultaneity, with the adverbial providing the timeframe within which the main action occurred.)