When the amber is rubbed, electrons are transfered from the wool or flannel to the amber, which becomes negatively charged. This negative charge attracts the piece of paper until electrons have moved to it and it too becomes negatively charged. Since like charges repel the paper is now repelled from the amber.