I don’t know how to phrase this, but as you can see my code below I have 2 classes.
- wp_title
- 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?
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);
}
}
}
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);
}
}
}