Yes, the NHL lockout affects the AHL, because they are related. If fewer people are supporting hockey in general, fewer people will support the AHL, if the NHL is on a lockout. Some people also probably do not know the difference between the NHL and the AHL, and will be confused as to what is happening in the world of hockey.
The NHL lockout will most definitely affect the AHL. If NHL players cannot play this year, they could possibly go to the AHL temporarily. Also, AHL rating will probably go out. NHL fans need their fix and will watch AHL games since it is an alternative to watching what they usually watch.
The NHL lockout is both hurting, and helping the AHL, especially in the United States. Many fans of the sport in America, are fans of teams that are in the NHL. This causes these fans to be unable to follow their favorite sport, thus they'll move on to others(football, basketball). On the other end of the spectrum, AHL fans are able to keep up with their teams, and can celebrate that they are AHL and not NHL. Hockey fans are forced to follow the AHL instead, causing them to get a leg up in the sport.
The NHL isn't a very popular sport here in the US. As this lockout continues, fewer and fewer people are able to enjoy the sport. Since very few people are emotionally attached to the sport (in contrast to say, baseball or football), the lockout is simply keeping the league from gaining a new fan base, ultimately hurting the sport.
Yes, the NHL lockout affects the AHL, but in a good way. With the NHL locked out the only game in town is the AHL. They get the revenue, the fans, the TV coverage, and even the hot dog sales. It's a great leg up for the AHL which wasn't always seen as the best. Now that they are the only one it's a snap to be considered the best.