PDA

View Full Version : new to flex


rkcy81
10-06-2008, 08:28 AM
Hi All,

I am new to Flex. Now i ma learning Flex 3 with ActionScript 3.0.

I have written one basic programe for my practise.

But i struct some where..i could not find the exactly what to do.

I have forwarded my code also..pls find the code and suggest me.

MXML file
----------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp(),initApp1()">

<mx:Script>
<![CDATA[



private var theResults:ASResults = new ASResults();

public function initApp():void
{
displayText.text=theResults.calculateString();
}
]]>

</mx:Script>

<mx:Script>
<![CDATA[

public function initApp1():void
{

displayText.text=theResults.calculateString1();

}
]]>
</mx:Script>

<mx:TextArea x="10" y="10" id="displayText"/>

</mx:Application>


ActionScript file
------------------

// ActionScript file
package

{
public class ASResults
{
public function calculateString():String
{
var greeting:String = "Hello World";

return greeting;


}

public function calculateString1():String
{
var nums:String=" welcome to new joiners";

return nums;
}

}
}

After run this programe.. it is displaying " welcome to new joiners" only but not displayed "Hello World" .

cAn any one pls suggest me how to display two strings in the browsers.


Regards,

Ravi

rawmantick
10-06-2008, 12:12 PM
It shouldn't. If several function calls are performed sequentially - you will only see the result of the last one. Since the display is updated after function returns.

Even if it did every time you change the the display info - your eye is doubtely faster than your CPU.