Flash input text field to php

I have a login field for a site I am developing. The flash site sends the data to a php file and receives response. My problem is input text fields. If I hard code the values of the variables I am sending from flash to php, the whole thing works just fine, but if I try to set the value of the variables to what a user enters in input fields I have provided, then blank data is sent to PHP.

here is the as file


package
{
    import flash.display.MovieClip;
    import flash.display.DisplayObjectContainer;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import flash.net.URLVariables;
    import flash.events.IOErrorEvent;
    
    public class login extends MovieClip
    {
        private var loginConsole:MovieClip;
        private var stageIn:DisplayObjectContainer;
        private var variables:URLVariables = new URLVariables;

        private var request:URLRequest = new URLRequest("logintest/login.php");

        private var loader:URLLoader = new URLLoader();
        
        public function login(loginConsoleTemp:MovieClip, stageInTemp:DisplayObjectContainer):void
        {
            loginConsole = loginConsoleTemp;
            stageIn = stageInTemp;
            init();
        }
        
        private function init():void
        {
            loginConsole.logPass_txt.displayAsPassword = true;
            loginConsole.signIn_btn.addEventListener(MouseEvent.CLICK, handleSignIn);
        }
        
        private function handleSignIn(e:MouseEvent):void
        {
            var _username:String = loginConsole.logMail_txt.text;
            var _password:String = loginConsole.logPass_txt.text;
            
            variables.UserName = _username as String;
            variables.Password = _password as String;
            
            loader.dataFormat = URLLoaderDataFormat.VARIABLES;
            request.data = variables;
            request.method = URLRequestMethod.POST;
            loader.addEventListener(Event.COMPLETE, handleComplete);
            loader.addEventListener(IOErrorEvent.IO_ERROR, handleError);
            
            loader.load(request);
        }
        
        private function handleComplete(e:Event):void
        {
            var loader:URLLoader = URLLoader(e.target);
            loginConsole.display_txt.text = loader.data.msg;
        }
        private function handleError(e:IOErrorEvent):void
        {
            trace("not working");
        }
        
    }
}

Instead of doing
variables.UserName = _username as String;
variables.Password = _password as String;

if i assign hard coded values like this

variables.UserName = “something”;
variables.Password = “something”;

it works fine.

How do I get it to work with input text fields… please help