12 Replies Latest reply on Feb 12, 2007 1:15 PM by spookmc

    how to use mx components?

    spookmc Level 1
      I am very confused, trying to use the mx.components (e.g. mx.managers.PopUpManager).

      I cannot see in my Flash 8.0 Professional edition where to find the mx controls.
      Nor do I understand how to acces the controls for my applications.

      Undoubtly, this is a very trivial question, but I cannot find the answer :-(

      Can anyone help me with a little hint ?
        • 1. Re: how to use mx components?
          - Drag a component to the Layer
          - Select this component
          - Now go to the menu and choose Window > Properties > Parameter
          - Now you can see "parameter" for the component

          Drag ComboBox under User Interface to a Layer
          Select the ComboBox
          go to Window > Properties > Parameter
          You will find 4 options data, editable, labels, rowCount
          double-click on labels, add some labels and ..... good luck
          • 2. Re: how to use mx components?
            spookmc Level 1
            thanks for the answer.

            I tried to find the combobox elelemnt and I found it under the components panel.
            Now I want to add the mx.managers.PopUpManager.
            To be exact, I want to use the method: popupmanager.createPopUp
            I have Flash 8 professional, but I cannot figure out how to use this component / class?
            What is it?? is it a component?? It is not in the components panel.
            Where can I find it?? Everybody talks about it in forums like it is a very normal thing ot use, but I cannot find it ...
            • 3. Re: how to use mx components?
              Peter Lorent Level 2
              Attached code comes from the help-files.

              • 4. Re: how to use mx components?
                spookmc Level 1
                Thanks for your interest in my problem.
                I am beginning to get a grasp of what I need to do.
                (I have understood by now, that mx.managers.PopupManager is a Class, and I even located it on my harddisk as an .aso file)

                I created some working example from this code (shows two windows though)

                The code I want to replace by the CreatPopUP is:

                this.dialogClip = createEmptyMovieClip("dialogClip", this.getNextHighestDepth());{/I]

                Now I cannot have a window in the library because this code is in an as file (defining a Class in AS1.0)

                How should I change this line to be replaced by PopUpManager??
                • 5. Re: how to use mx components?
                  Peter Lorent Level 2
                  >>defining a Class in AS1.0
                  I think you mean AS2?
                  The PopUpManager controls popups of Window Components. Whether you write a class or code on the timeline doesn't make any difference for the items you have in the library. In your class you can reference the items in the library.

                  • 6. Re: how to use mx components?
                    spookmc Level 1
                    Thanks a lot for explaining the logic. that's what I was looking for.
                    Right now I use :
                    this.dialogClip = createEmptyMovieClip("dialogClip", this.getNextHighestDepth());

                    to create a container for ( code copied from the help-files):
                    drawRoundedRectangle(dialogClip, this.dialogClip.width, this.dialogClip.height, 20, 0xAA1199, 20);

                    function drawRoundedRectangle(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, cornerRadius:Number, fillColor:Number, fillAlpha:Number):Void {
                    with (target_mc) {
                    beginFill(fillColor, fillAlpha);
                    moveTo(cornerRadius, 0);
                    lineTo(boxWidth - cornerRadius, 0);
                    curveTo(boxWidth, 0, boxWidth, cornerRadius);
                    lineTo(boxWidth, cornerRadius);
                    lineTo(boxWidth, boxHeight - cornerRadius);
                    curveTo(boxWidth, boxHeight, boxWidth - cornerRadius, boxHeight);
                    lineTo(boxWidth - cornerRadius, boxHeight);
                    lineTo(cornerRadius, boxHeight);
                    curveTo(0, boxHeight, 0, boxHeight - cornerRadius);
                    lineTo(0, boxHeight - cornerRadius);
                    lineTo(0, cornerRadius);
                    curveTo(0, 0, cornerRadius, 0);
                    lineTo(cornerRadius, 0);

                    If I understand it right, this won't be possible using the PopUpManager, since it is not a Windows Component?
                    So I cannot dynamically create the MovieClip to be shown.
                    Am I right?
                    Can I really only use Window Components clips with the popup, or is there a workaround to fill in other MovieClips to be shown as popups?

                    Again, thanks a lot for teaching me the logic behind the trics :-)
                    • 7. Re: how to use mx components?
                      Peter Lorent Level 2
                      Yes, the PopUpManager works with Window Components to show and hide popups. For the content of the popup you can provide a movieclip in the library which has a linkage identifier.
                      When you don't want to use the Window Component you can write your own popupmanager class that creates modal and non-modal popups.
                      • 8. Re: how to use mx components?
                        spookmc Level 1
                        OK, now I understand the use of the popup manager; and now I am back where I started ...

                        To make my own popup functionality, I have to make all other classes stop to react to mouseclicks when the popup is open.

                        How can such a thing be done? I have to make adjsutments to all the other objects in my movie that react to mouseclicks...
                        What is the workaround to be used? Or in other words: how can i make the one movieclip be the only one to react to mouseclicks. (how can I make all the others stop 'listening'?)
                        • 9. Re: how to use mx components?
                          Peter Lorent Level 2
                          Nope. The trick is to draw a background right under the popup (which of course is at the highest depth) and then use assign an onRelease event for the background that does nothing. Then you have the equivalent of a modal popup.
                          • 10. Re: how to use mx components?
                            spookmc Level 1
                            OK, thanks a lot for teaching me :-D

                            If I understand you correctly: I should find a function to copy the whole stage into an image (jpg?) and have this copy placed in a new MC, to be shown directly below the popup.
                            This MC covers the rest of the objects on teh stage and so it prevents tehm from being clicked.

                            Can I easily perform this "print stage" to create a screengrab of the current background?
                            • 11. how to use mx components?
                              Peter Lorent Level 2
                              No, you just draw a shape with a black (or any other color) fill at the size of the stage and set the alpha to zero. An onRelease handler on that shape will still hide all other events handlers.
                              You might have seen the effect that when the popup pops up, the stage dimms a little. Well, that's that background shape that fades in over time to an alpha of about 30.
                              • 12. Re: how to use mx components?
                                spookmc Level 1
                                Thanks a lot for helping. I solved the problem almost now :-)

                                I created a MC: backGroundClip with the Stage-sizes, made it transparent and defined
                                backGoundclip.onPress = function(){}
                                Now I can only "click" the MC's in front of this backGroundClip.

                                Only problem left seems that I cannot use the Keys anyomore.
                                I used to have a spacebar interaction with the top-MC (the popup) to scroll through the options...

                                Can anyone reflect on this unexpected behavior??