Hi All,
I write a actionscript fileIncludeMyFile.as :
package CustomComponent
{
public class IncludeMyFile extends Object
{
public function computeSum(a:int, a:int):Number
{
return a+b;
}
}
}
When i add package, i am getting Error: Package cannot be nested
And My Mxml file:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script source="CustomComponent/IncludeMyFile.as"/>
<mx:TextInput id="tinput1" width="40" height="40" textAlign="right"
x="100" y="100"/>
<mx:TextInput id="tinput2" width="40" height="40" textAlign="right"
x="100" y="100"/>
<mx:TextArea id="toutput" width="60" height="70" textAlign="right"
x="100" y="100"/>
<mx:Button id="myButton" label="chckSum"
click="toutput.text(String(computeSum(Number(tinput1.text),
Number(tinput2.text)));" x="130" y="140"/>
<mx:Label text="+" width="40" fontWeight="bold" fontSize="20" x="130"
y="140"/>
</mx:Application>
Actually here, i include the Actionscript file into MXML.
Please let me know where i did wrong.
Thanks, Ravi