views:

27

answers:

1

I have 2 functions, 1 loaded before another. Some value are determine by the other function data, but since one of it has to load before the other 1, how should I get the data that is loaded after current function?

private function wMessage():void {
   Message.width=Name.width+20;
}

private function wName():void {
   Name.x=(Message.x+Message.textWidth)-Name.textWidth;
   Name.y=Message.y+Message.height;
}

I've taken out some other unnecessary codes, but as you can see Name position is set according by the position + width of Message, but I want Message's width to be not smaller than Name

+2  A: 

The way that I understand your question is that you need a value that is found in the first function to be used in the second function. To do this, you could prototype the functions at the beginning of the program and then call the first function within the second function.

Tar9etPractice