Former Boston Ballet and New York City Ballet dancer Sophie Flack, now an English student at Columbia University, visited Porter Square Books on Tuesday night to read from her young adult novel, “Bunheads,’’ which was released last fall. The book is very loosely based on some of Flack’s own experiences in the world of dance. She got the publishing deal after an editor at Little, Brown read Flack’s quotes in The New York Times about what it felt like to be laid off from the New York City Ballet corps. The Watertown native’s visit here included a trip to the South Shore Ballet Theatre, where she spoke to young dancers, and some quality time with her mom, local artist Fran Forman. In Porter Square, Flack read to a packed house and fielded questions about dancing en pointe and her transition from ballet to writing. (Flack’s boyfriend, “The Good Wife’’ actor Josh Charles, was not spotted in the crowd.) Flack was also asked about the film “Black Swan’’ and whether it had any influence on her novel. Flack explained that the dance film didn’t affect what she wrote in her book but admitted that she did audition to be Natalie Portman’s trainer on the movie. That job wound up going to Mary Helen Bowers, with whom Flack danced at the New York City Ballet.