Using methods from another SWF

Okay, so I am testing interaction between two swf’s on one web page so that I can understand how it all works before starting development.

I have two classes: the actual program (called AdminTool) and a navigation swf (called Navigation).

Here is my code for the actual tool:


package {
    
    import flash.display.MovieClip;
    import flash.display.Sprite;
    
    public class AdminTool extends MovieClip {
        
        public function AdminTool(){}
        
        public function createTest():void {
            var shape:Sprite = new Sprite();
            shape.graphics.beginFill(0x00,1);
            shape.graphics.drawRect(10,10,10,10);
            shape.graphics.endFill();
            
            this.addChild(shape);
        }
        
        public function editTest():void {
            var shape:Sprite = new Sprite();
            shape.graphics.beginFill(0x00,1);
            shape.graphics.drawCircle(10,10,10);
            shape.graphics.endFill();
            
            this.addChild(shape);
        }
        
        public function deleteTest():void {
            var shape:Sprite = new Sprite();
            shape.graphics.beginFill(0x00,1);
            shape.graphics.drawRoundRect(100,10,20,20,3,3);
            shape.graphics.endFill();
            
            this.addChild(shape);
        }
        
        public function reports():void {
            var shape:Sprite = new Sprite();
            shape.graphics.beginFill(0x00,1);
            shape.graphics.drawRoundRect(20,100,20,20,5,5);
            shape.graphics.endFill();
            
            this.addChild(shape);
        }
    }
}

Real simple… just want a visual cue here that the methods are being run since I can’t see traces on the web page.

Here is the code for the navigation piece:


package {
    
    import flash.display.Sprite;
    import flash.events.*;
    
    public class Navigation extends Sprite {
        
        private var adminTool:AdminTool = new AdminTool();
        private var createButton:Sprite = new Sprite();
        private var editButton:Sprite = new Sprite();
        private var deleteButton:Sprite = new Sprite();
        private var reportsButton:Sprite = new Sprite();
        
        public function Navigation() {
            createButton.graphics.beginFill(0x00FF,1);
            createButton.graphics.drawRect(0,0,50,10);
            createButton.graphics.endFill();
            
            editButton.graphics.beginFill(0x00FF,1);
            editButton.graphics.drawRect(60,0,50,10);
            editButton.graphics.endFill();
            
            deleteButton.graphics.beginFill(0x00FF,1);
            deleteButton.graphics.drawRect(120,0,50,10);
            deleteButton.graphics.endFill();
            
            reportsButton.graphics.beginFill(0x00FF,1);
            reportsButton.graphics.drawRect(180,0,50,10);
            reportsButton.graphics.endFill();
            
            this.addChild(createButton);
            this.addChild(editButton);
            this.addChild(deleteButton);
            this.addChild(reportsButton);
            
            createButton.name = "create";
            editButton.name = "edit";
            deleteButton.name = "delete";
            reportsButton.name = "reports";
            
            createButton.buttonMode = true;
            editButton.buttonMode = true;
            deleteButton.buttonMode = true;
            reportsButton.buttonMode = true;
            
            createButton.addEventListener(MouseEvent.CLICK, clickListener);
            editButton.addEventListener(MouseEvent.CLICK, clickListener);
            deleteButton.addEventListener(MouseEvent.CLICK, clickListener);
            reportsButton.addEventListener(MouseEvent.CLICK, clickListener);
        }
        
        private function clickListener(e:MouseEvent):void {
            switch(e.target.name) {
                case "create":
                    adminTool.createTest();
                    break;
                case "edit":
                    adminTool.editTest();
                    break;
                case "delete":
                    adminTool.deleteTest();
                    break;
                case "reports":
                    adminTool.reports();
                    break;
            }
        }
    }
}

so this is executing the method’s from the first swf based on the button pressed… or at least it is supposed to…

So when I load the page, both swf’s appear and it looks like the buttons are taking the click event, but nothing is happening on the AdminTool swf.

Two questions:

[LIST=1]
[]What am I doing wrong?
[
]Is there a better way to test this sort of thing? (Where I can get trace messages, etc)
[/LIST]