7 Replies Latest reply on Jun 17, 2007 11:11 AM by acelxix

    Using the Window component

      Could someone help me out with the code for the Window component in as 2.0 plz?
      For example if my button name is "win_btn" and the window is named "window".
        • 1. Re: Using the Window component
          vedtam Level 1
          plz help...
          • 2. Re: Using the Window component
            SymTsb Level 2
            what exactly do you want? your post is very vague and doesn't tell us anything.
            • 3. Re: Using the Window component
              vedtam Level 1
              hehe, you are absolutley right, but after all I am searching still for the solution.So what I am talking about is a component called "Window" that can be found under the menu Window > Comonents in Flash cs3, of course when I am working in as 2.0.As above mentioned this is a window in wich you can place your information (e.g picture, txt) and with the help of a button_btn can be opened, and using the "X" in the upper right corner of the window can be closed.So I am asking if someone could help me out with the code in as 2.0 so i could use this component in my Flash website.
              I hope this time I have made my self clear...:)
              • 4. Re: Using the Window component
                The best advice I can give you is to read the help file. In the Component section there is verry good help about the window component. There is examples how to use it.

                Basically the Window component hold an instance of movie clip. So you create a movie clip and attach it to to window component - of course this is very basic explanation. Read the help and if you have questions feel free to ask
                • 5. Re: Using the Window component
                  vedtam Level 1
                  I have found a working code...:)
                  I have enabled the close button.But it is not working.Could someone complet this with the handler (code in as 2.0) for the close button, and a vertical scrollbar?PLZZZ

                  - Button component on Stage (instance name: my_button)
                  - Window component in library
                  import mx.containers.Window;

                  var my_button:mx.controls.Button;

                  System.security.allowDomain(" http://www.helpexamples.com");

                  // Create listener object.
                  var buttonListener:Object = new Object();
                  buttonListener.click = function(evt_obj:Object) {
                  // Instantiate Window.
                  var my_win:MovieClip = mx.managers.PopUpManager.createPopUp(evt_obj.target, Window, true, {closeButton:true, title:"Sample Image", contentPath:" http://www.helpexamples.com/flash/images/image1.jpg"});
                  my_win.setSize(640, 480);
                  // Add listener.
                  my_button.addEventListener("click", buttonListener);


                  • 6. Using the Window component
                    You need to register the click event for the window itself. Additionally, you need to call the deletePopUp method in the event handler for that click event:

                    var formCloseListener = new Object();
                    formCloseListener.click = function(evt_obj:Object){
                    //Close the window that sent the click event

                    //Add the formCloseListener event to my_win
                    my_win.addEventListener("click", formCloseListener);


                    The event object (evt_obj) contains a property (target) which references the object broadcasting the event, so you can use that to delete the window. You could alternatively call my_win.deletePopUp within the click event handler, but the code above could be used for any popup. I hope this helps.
                    • 7. Re: Using the Window component
                      acelxix Level 1
                      I'm having a problem with the Window content. What I'm trying to do is create a registration pop-up for a game, and I want to pre-populate the user name entered in the login screen on the registration pop-up. However, I can't seem to access a TextInput component within the content of the pop-up. Below is my "complete" event handler for the registeration pop-up:

                      register.complete = function(registerForm) {
                      // test is an instance of Text Field
                      registerForm.target.content.test.text = "OMG";

                      //userName is an instance of a TextInput component
                      registerForm.target.content.userName.text = "testing";

                      When the pop-up displays, the TextInput component (userName) text does not change, but the text field (test) does change! I read here ( http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00003039.html) that you may not have access to the content of a component on initialization, so I tried to do it in the complete event, but I still couldn't get the TextInput to update. Out of curiosity I added the text field, and it updated with no problem. Is this a known bug with the TextInput component? Or do I need to do something aditional to use the TextInput component within a Window component?