In order to handle the current user, we will first need to open up the
main.as file, where we will build the business logic behind the Flash objects we created in the previous section. Since each of these objects was given an instance name, they can now be referenced within our ActionScript code. Looking at the
main.as file, our first task will be to instantiate our user login block by hiding the welcome movie clip.
// Hide the welcome message. login.welcome.visible = false; // Declare our Drupal connection var drupal:NetConnection = new NetConnection(); drupal.objectEncoding = ObjectEncoding.AMF3; // Connect to the Drupal gateway drupal.connect( gateway );
Our next task is to show the correct login block depending on whether the user is logged in or not. This can be determined from the user object passed to us after we connect to our Drupal system. If the user is defined and the user ID is not 0, then this means that we are logged in, and should show the welcome...