0 Replies Latest reply on Nov 14, 2006 8:07 PM by alewis2006

    Flex 2 XML Namespaces and Action Script

      Ok I have a couple of custom Componenets that reside in my Components folder in my flex project.
      I tried the example of lets say a modal title window....file named MyLoginForm.mxml

      <code for MyLoginForm component in the Componenets Directory>

      <?xml version="1.0"?>
      <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="doInit();">
      import mx.managers.PopUpManager;

      private function doInit():void {
      // Center the TitleWindow container
      // over the control that created it.

      private function processLogin():void {
      // Check credentials (not shown) then remove pop up.
      <mx:FormItem label="User Name">
      <mx:TextInput id="username" width="100%"/>
      <mx:FormItem label="Password">
      <mx:TextInput id="password" displayAsPassword="true" width="100%"/>
      <mx:Button click="processLogin();" label="OK"/>
      <mx:Button click="PopUpManager.removePopUp(this);" label="Cancel"/>

      </END CODE>

      From the application file MySystem.mxml I can get this to work if I put my componenet in the root of the application
      however it does not work if MyLoginForm component is where it should be in the componenets folder.Question is if I create a reference variable lets say var _myform=MyLoginForm;I get the same error as with the MyLoginForm not being in the root of the app.MyLoginForm not found.How do I refernce this file if it is in another directory.I know how xmlns work .If I hade a compnenet lets say Test.mxml in the components folder I could refernce it on this main app like xmlns:MyNamespace="Componenets.*" and then a control like <MyNamespace:Test />
      So how do I do this issue????


      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      // Import the PopUpManager.
      import mx.managers.PopUpManager;
      import mx.core.IFlexDisplayObject;

      private function showLogin():void {
      // Create a non-modal TitleWindow container.
      var helpWindow:IFlexDisplayObject =
      PopUpManager.createPopUp(this, MyLoginForm, false);

      <mx:VBox width="300" height="300">
      <mx:Button click="showLogin();" label="Login"/>