9 Replies Latest reply on Oct 24, 2007 3:13 AM by FlexPrashant

    resize

    FlexPrashant Level 1
      hey i am developing a application like scarpblog please help me
      i am unable to find the solution for right click as well as image resize at runtime
        • 1. Re: resize
          ntsiii Level 3
          Go to Adobe livedocs and search for "contextMenu".
          http://livedocs.adobe.com/flex/2/

          You will need to be more specific on question two.

          Tracy
          • 2. Re: resize
            FlexPrashant Level 1
            How to set right click functionality in adobe flex 2....
            Simply whenever we run a MXML we got setting , print and about flash player ......

            I want to set some other function ,,,,,,,,,,, Please help me Wink
            • 3. Re: resize
              atta707 Level 2
              So, you're saying you followed Tracy's advice:

              Go to Adobe livedocs and search for "contextMenu".
              http://livedocs.adobe.com/flex/2/

              and something still is not working?

              ATTA
              • 4. Re: resize
                FlexPrashant Level 1
                dear i want to set cut , copy ,paste , undo , redo option on right click , mean to say if user is right clicking of mouse use will get the option okay . is it possible in flex
                please help me
                • 5. Re: resize
                  atta707 Level 2
                  Yes. Context menu, that's right click, is avaialable in Flex. However, copy, paste, undo, redo... are not built-in. As a matter of these strings aren't allowed in the as context menu titles "Paste rows" is allowed while "Paste" is NOT allowed as a title.

                  Context menus are available only for the "top level" components: components that are directly inside <application> tag.

                  You would need to build all these functionalities all by yourself!

                  ATTA
                  • 6. Re: resize
                    Gregory Lafrance Level 6
                    Excerpt from the FB 2 help on contextMenu:

                    The ContextMenu class provides control over the items in the Flash Player context menu. You can add custom menu items, control the display of the built-in context menu items (for example, Zoom In and Print), or create copies of menus.

                    You can attach a ContextMenu object to a specific button, movie clip, or text field object, or to an entire movie level. You use the menu property of the Button, MovieClip, or TextField class to do this.

                    In Flex, only top-level components in the application can have context menus. For example, if a DataGrid control is a child of a TabNavigator or VBox container, the DataGrid control cannot have its own context menu.

                    To add new items to a ContextMenu object, you create a ContextMenuItem object, and then add that object to the ContextMenu.customItems array.

                    Flash Player has three types of context menus, but only the standard and edit menus can be modified with the ContextMenu class.:

                    - the standard menu (which appears when you right-click in Flash Player)
                    - the edit menu (which appears when you right-click a selectable or editable text field)
                    - error menu (which appears when a SWF file has failed to load into Flash Player).

                    Custom menu items always appear at the top of the Flash Player context menu, above any visible built-in menu items; a separator bar distinguishes built-in and custom menu items. You can add no more than 15 custom items to a context menu. You cannot remove the Settings menu item from the context menu. The Settings menu item is required in Flash so that users can access the settings that affect privacy and storage on their computers. You also cannot remove the About menu item, which is required so that users can find out what version of Flash Player they are using.

                    You must use the ContextMenu() constructor to create a ContextMenu object before calling its methods.

                    • 7. Re: resize
                      FlexPrashant Level 1
                      suppose i have a image then when we rightclick on the image i set cut copy paste undo & redo in context menu
                      then how do i cut an image and paste it on another place
                      • 8. Re: resize
                        Karl_Sigiscar_1971 Level 3

                        // WITHIN THE SCRIPT TAGS OF THE MAIN MXML

                        import flash.ui.ContextMenu;
                        import flash.ui.ContextMenuItem;
                        import flash.ui.ContextMenuBuiltInItems;
                        import flash.events.ContextMenuEvent;

                        // Context menu
                        private var applicationContextMenu:ContextMenu = new ContextMenu();


                        private function removeDefaultItems():void
                        {
                        applicationContextMenu.hideBuiltInItems();
                        var defaultItems:ContextMenuBuiltInItems = applicationContextMenu.builtInItems;
                        defaultItems.print = true;
                        }

                        private function addCustomMenuItems(label:String, fcn:Function, separator:Boolean):void
                        {
                        var item:ContextMenuItem = new ContextMenuItem(label);
                        item.separatorBefore = separator;
                        applicationContextMenu.customItems.push(item);
                        item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, fcn);
                        }


                        // IN THE CREATION COMPLETE METHOD OF THE MAIN MXML

                        removeDefaultItems();
                        addCustomMenuItems("Cut", this.onCut, true);
                        addCustomMenuItems("Copy", this.onCopy, false);
                        addCustomMenuItems("Paste", this.onPaste, false);
                        this.contextMenu = applicationContextMenu;

                        // Where onCut, onCopy and onPaste are the event handlers for your custom context menu items, Cut , Copy and Paste respectively.

                        private function onCut(event:ContextMenuEvent):void
                        {
                        // Implement the Cut functionnality here
                        }

                        private function onCopy(event:ContextMenuEvent):void
                        {
                        // Implement the Copy functionnality here
                        }

                        private function onPaste(event:ContextMenuEvent):void
                        {
                        // Implement the Paste functionnality here
                        }
                        • 9. Re: resize
                          FlexPrashant Level 1
                          I know all this . If you have seen scrapblog.com , in this website when we create a new scrap we put some object
                          like square, rectangle etc then scrapblog is giving facilities of cut , paste , undo on the particular square, rectangle
                          in this way user can cut, paste the object as well as undo & redo the work .. I am giving same functionalities in my application
                          so how do it possible . in setclipboard method u can take only string not any object .... is there any solution
                          please help me