Following code

there are various examples and tuts on this issue I suggest you search the forum and google the web