# Communication with classes

**URL:** <https://forum.kirupa.com/t/communication-with-classes/289623>\
**Category:** flash\
**Created:** [June 2, 2009, 4:33pm UTC](https://forum.kirupa.com/t/communication-with-classes/289623 "2009-06-02T16:33:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![youwh](https://avatars.discourse-cdn.com/v4/letter/y/82dd89/32.png) [@youwh](https://forum.kirupa.com/u/youwh)\
**Post date:** [June 2, 2009, 4:33pm UTC](https://forum.kirupa.com/t/communication-with-classes/289623/1 "2009-06-02T16:33:39Z")

</div>

I don’t know how to phrase this, but as you can see my code below I have 2 classes.

1. wp\_title
2. wp\_date

How can I let **wp\_date** to get the height of **wp\_title** ’s _contentText_?  
Currently I tried tracing _wp\_title.height_ from wp\_date but all I get was _0_, I guess it doesn’t get the height after **wp\_title** finish loaded.

Currently the classes will perform an action after I resize the stage.  
I assume if I’m able to get the classes to communicate with each other than I could have 1 main classes to control the actions perform in other class?

```auto
package {
    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.display.StageScaleMode;
    import flash.events.Event;

    public class wp_title extends Sprite {

        public function wp_title():void {
            addEventListener(Event.ADDED_TO_STAGE,detectStage);
        }

        private function detectStage(e:Event=null):void {
            addChild(contentTitle);
            contentTitle.x=0;
            contentTitle.y=30;

            stage.addEventListener(Event.RESIZE,stageResize);
            stage.dispatchEvent(new Event(Event.RESIZE));
        }
        private function stageResize(event:Event):void {
            var widthTween:Tween;
            var titleWidth=stage.stageWidth-570;
            trace (this.height)
            widthTween=new Tween(contentTitle,"width",Elastic.easeOut,contentTitle.width,titleWidth,2,true);
        }
    }
}

```

```auto
package {
    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.events.Event;

    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;

    public class wp_date extends Sprite {
        public var show_title:wp_title=new wp_title ;

        public function wp_date():void {
            addEventListener(Event.ADDED_TO_STAGE,detectStage);
        }

        private function detectStage(e:Event=null):void {
           
 addChild(contentDate);

            stage.addEventListener(Event.RESIZE,stageResize);
            stage.dispatchEvent(new Event(Event.RESIZE));
        }
        
private function stageResize(event:Event):void {
            var yTween:Tween;
            var dateY=show_title.y + show_title.height+180;
            yTween=new Tween(this,"y",Elastic.easeOut,this.y,dateY,2,true);
            
        }
    }
}

```
