Results 1 to 5 of 5
  1. #1
    Member Vulf's Avatar
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    9

    Question Creating a simple Login Form slot/module (input-text tf issue) ?

    Hello,

    I encountered some problems while creating a simple slot, with a TextField (Input type) added on. Any Input-text TextField I tried to create it remains locked. It acts more like a dynamic text (field can be created or changed via ActionScript during runtime), but no editing is possible using keyboard input while testing the project.
    I'm not using full-screen mode.

    I'm trying to do a simple "Login Form" slot/module (2 input-text TextFields and one Submit button).
    I looked over ContactFormModule classes but for me it's pretty hard to understand how should I use FormModule class just for this, having limited documentation (just API example)

    I'm using 34800 template.

    A simple example on how I could implement/use input-text TextField (creating slots, or modules) would be a great help!

    Or could I create a Login Form using moto classes?

    Thank you!

  2. #2
    Hello,

    It would be enough to inherit the AbstractMotoSlot class. Here is the tutorial on creating an abstract slot, where you can add any logic.

    As to the problems with text field, are you trying to create a textfield with the help of the code, or you have the field created in Flash and assign it to the variable in the code? Try creating it in Flash. Please note that no fonts should be embedded. The textfield must be dynamic.

    Best regards,

    Paul

  3. #3
    Member Vulf's Avatar
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    9

    Question

    I just want to create a login form .. (with two input text fields: username, password )
    The problem is that the textfield it's not editable. How can I make this input text field ?

    In my tests, text fields were created in Flash and assigned it to variable in the code ( using getChildByName() )
    I didn't embedded fonts. Text fields were both Input type, and dynamic type.

    Separately I created an external flash login.swf and added it as Flash SWF Movie, and it works good, but in this way it doesn't communicate with site, so it's useless...

    All I want is to create a simple slot (using AbstractMotoSlot class) with two editable text fields (Input Text) by site visitors - a simple input formular.
    Will be something VERY similar with SearchFieldSlot, but with two input text fields, and different functionality.

    Please help me with this. I'm stuck in this for over a month...
    I can provide code, screen captures, etc, if needed ...

    Thank you!

  4. #4
    Hello,

    Here is the way the text field is handled in the Search Widget:

                _tf.addEventListener(FocusEvent.FOCUS_IN, textFieldHandler);
                _tf.addEventListener(FocusEvent.FOCUS_OUT, textFieldHandler);
                _tf.addEventListener(KeyboardEvent.KEY_UP, textFieldHandler);

            private function textFieldHandler(event:Event):void
            {
                switch (event.type)
                {
                    case FocusEvent.FOCUS_IN:
     
                        if (_tf.text == MotoUtils.getTextFromHTML(_propertyTextToShow.value))
                        {
                            MotoUtils.setHTMLParametersFromPropertyVO(_tf, _propertyInputFormat);
                            MotoUtils.setHTMLTextFromPropertyVO(_sizeTF, _propertyInputFormat);
                            var textFormat:TextFormat = MotoUtils.getTextFormatFromXML(_propertyInputFormat.value);
     
                            _tf.setTextFormat(textFormat);
                            _sizeTF.setTextFormat(textFormat);
                            _tf.defaultTextFormat = textFormat;
                            _sizeTF.defaultTextFormat = textFormat;
     
                            _tf.text = "";
                            _sizeTF.text = "aZ";
     
                            _tf.height = _sizeTF.height;
                        }
     
                        stage.addEventListener(MouseEvent.MOUSE_DOWN, textFieldHandler);
                        updateSize();
                        break;
                    case FocusEvent.FOCUS_OUT:
                        if (_tf.text == "")
                        {
                            MotoUtils.setHTMLTextFromPropertyVO(_tf, _propertyTextToShow);
                            MotoUtils.setHTMLTextFromPropertyVO(_sizeTF, _propertyTextToShow);
                            _tf.height = _sizeTF.height;
                        }
                        if (stage)
                            stage.removeEventListener(MouseEvent.MOUSE_DOWN, textFieldHandler);
                        updateSize();
                        break;
                    case KeyboardEvent.KEY_UP:
                        if (KeyboardEvent(event).keyCode == Keyboard.ENTER)
                        {
                            clickHandler();
                        }
                        break;
                    case MouseEvent.MOUSE_DOWN:
                        if (event.target != _tf)
                        {
                            stage.focus = null;
                        }
                        break;
                }
            }

    Best regards,

    Paul

  5. #5
    Member Vulf's Avatar
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    9

    Wink Solved!

    Thank you Paul for your answer!

    The problem was that I was using mouseChildren = false; somethere just before _tf.addEventListener(..) , so I hadn't got any FOCUS event from any objects created there...
    With mouseChildren = false any Input Text Field acts like a dynamic one ... so this was confusing ...

    Thank you again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •