Do not ever use sessionIDs client side in javascript or applets! This is a security risk as makes your app sensitive for session hijacking trough XSS attacks.
You can use directly use mx.session to get session information.
mx.session.getUserAttribute()
from a widget. Use your own attribute.
Edit: See this for the sessions.