The way I go about it is to tell the FA, in a nice way, that I know she cannot condone me getting out of the seat to use the lav, but it is an emergency and I will be careful.
That has always done the trick, though it is very rare that I cannot hold it till the light goes off. I make it a point to always hit the loo in the lounge prior to boarding. Who likes a dirty smelly onboard lav anyway? It's not like we are talking about EK F...