I am using the MDIPanel created by Christophe Coenraets in the Sales
Builder demo code in Flex 2. However, this custom component (MDIPanel)
doesn't seem to receive regular events other than a handful of custome
events (min,max,close,restore). The MDI Panel source code is included
as entails. Since it extends Panel and called "super()" during
initialization, I assume that it would get all regular events coming
in but it is not. For example, I can't use resource bundle to change
the label text or I can't seem to get dataprovider to work within a
datagrid inside the MDIPanel. Any ideas on what's happening here?
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
package
{
import mx.core.UIComponent;
import flash.events.MouseEvent;
import flash.events.Event;
import mx.controls.Button;
import mx.events.ResizeEvent;
import flash.display.Graphics;
import mx.managers.CursorManager;
import mx.containers.Panel;
import mx.controls.Image;
import mx.controls.Label;
import mx.states.SetStyle;

public class MDIPanel extends Panel
{
// Constants for MDI panel event names
public static var MINIMIZE:String = "minimize";
public static var MAXIMIZE:String = "maximize";
public static var CLOSE:String = "close";
public static var RESTORE:String = "restore";

.....

                public function MDIPanel()
                {
                        super();
                }                               
                                        
                override protected function createChildren():void
                {
                        super.createChildren();
                        
                        minimizeButton = new Button();
                        minimizeButton.y = 6;
                        minimizeButton.setStyle("upSkin", null);
                        minimizeButton.setStyle("cornerRadius", 2);
                        minimizeButton.width = 18;
                        minimizeButton.height = 18;
                        minimizeButton.setStyle("icon", iconMinimize);
                        minimizeButton.addEventListener(MouseEvent.CLICK, 
minimizeHandler);

                        maximizeButton = new Button();
                        maximizeButton.y = 6;
                        maximizeButton.setStyle("upSkin", null);
                        maximizeButton.setStyle("cornerRadius", 2);
                        maximizeButton.width = 18;
                        maximizeButton.height = 18;
                        maximizeButton.setStyle("icon", iconMaximize);
                        maximizeButton.addEventListener(MouseEvent.CLICK, 
maximizeHandler);
                        
                        closeButton = new Button();
                        closeButton.y = 6;
                        closeButton.setStyle("upSkin", null);
                        closeButton.setStyle("cornerRadius", 2);
                        closeButton.width = 18;
                        closeButton.height = 18;
                        closeButton.setStyle("icon", iconClose);
                        closeButton.addEventListener(MouseEvent.CLICK, 
closeHandler);
                        
                        titleBar.addChild(closeButton);                 
                        titleBar.addChild(maximizeButton);                      
                        titleBar.addChild(minimizeButton);              
                        
                        grip = new UIComponent();
                        grip.width = 10;
                        grip.height = 10;               

                        var g:Graphics = grip.graphics;
            g.clear();
            g.beginFill(0xFFFFFF, 0);
            g.drawRect(0, 0, 10, 10);
            g.endFill();
            
                        g.lineStyle(1, 0x333333);
                        g.moveTo(2, 9);
                        g.lineTo(9, 2);
                        g.moveTo(5, 9);
                        g.lineTo(9, 5);
                        
                        grip.addEventListener(MouseEvent.MOUSE_OVER, 
                                function (event:MouseEvent):void
                                {
                                        CursorManager.setCursor(iconResize);
                                });
                        grip.addEventListener(MouseEvent.MOUSE_OUT, 
                                function (event:MouseEvent):void
                                {
                                        
CursorManager.removeCursor(CursorManager.currentCursorID);
                                });
                        grip.addEventListener(MouseEvent.MOUSE_DOWN, 
startResizing);

                        rawChildren.addChild(grip);

                        addEventListener(MouseEvent.MOUSE_DOWN, bringToTop);
                        parent.addEventListener(ResizeEvent.RESIZE, 
parentResizeHandler);
                        verticalScrollPolicy = "off";
                        horizontalScrollPolicy = "off";
                        
                        originalCornerRadius = getStyle("cornerRadius");
                }
                        



Reply via email to