The difference with Affleck now is that his career is on the right track and he doesn't want to mess that up again, he is simply a much smarter now and he initially said no to the part until he read it and was impressed enough tot ake on the role.
AFFLECK: When they asked if I would be Batman, I told them I don’t see myself in the role and I was going to have to beg off. They said I’d fit well into how they were going to approach the character and asked me to look at what the writer-director, Zack Snyder, was doing. The stuff was incredible.
Back then, when he did Daredevil, he was a rising star and mostly did it for the money. They also got Clooney to do a crappy Batman film and he now has a reminder framed up in his office to remind him to avoid high budget films just to get paid. These days, Affleck is just too careful to do anything that he would think would destroy his career a second time around.
As for a Shazam film, they definitely considered it and even got writers to write scripts (plenty of) for it: http://www.comicvine.com/articles/writer-bill-birch-talks-about-shazam-movie/1100-139738/
That was in 2009 and the writer (Birch) along with Geoff Johns admitted that they had to start all over instead of pulling from past scripts, they also mention the Rock for the role:
In an interview with Cinefools, Bill Birch gives a little update on the movie. He mentions that he and Geoff are in the midst of "creating a kickass update that still honors the lore that's been created in over 50 years of [Captain] Marvel storylines." Despite the previous starts on the movie, the decision was made to simply start over rather than pull elements from previous scripts. Birch and Johns are not planning on taking the 'dark' route that many adaptions lean towards.
What about Dwayne "The Rock" Johnson? He's long been associated as a favorite for either Captain Marvel or Black Adam. Birch says that the way he sees things, an actor is not committed until the first day of shoot is over. Despite Johnson's relationship with Peter Segal (who has long been working on the movie), Birch does not write to any particular actor when coming up with a script. Rewrites can occur after to lean towards an actor's strengths if necessary.
Here's a review of the script of a Shazam film that was drafted in 2003 (suppose to release in 2005?) that went nowhere written by Goldman: http://scriptshadow.net/screenplay-review-shazam/
Premise: An 11 year old boy meets a man who gives him the power to turn into a superhero.
About: This was written by William Goldman, he who wrote “Butch Cassidy and The Sundance Kid,” “Misery,” “The Princess Bride,” “All The President’s Men,” and some would even say “Good Will Hunting.” For those who have just started in this career and find yourself struggling, it should be noted that Goldman received horrible grades in his first creative writing class in college. He was also an editor at the college newspaper, and used to anonymously submit his short stories in hopes of being published in the newspaper. He then had to stand by and listen to his co-workers talk about how ****** his stories were. That’s how you earn some thick skin! Later, he would research Butch Cassidy and the Sundance Kid for eight years before writing the script and earning a then record $400,000 paycheck for it. Break out the inflation calculator and you’ll see that translates to a 2.7 million dollar sale in today’s money.
Writer: William Goldman
Details: 141 pages (September 15, 2003 draft)
Here's 2 more writers tapped to write a script for Shazam in 2004 as well: http://www.superherohype.com/news/articles/84433-cohen--sokolow-adapting-new-lines-shazam
According to The Hollywood Reporter, "Cheaper by the Dozen" writers Joel Cohen and Alec Sokolow have been tapped for writing duties on New Line Cinema's adaptation of DC Comics' Shazam!.