我想学习Adobe Flex移动开发。如何将Java方法调用到Adobe Flex移动应用程序
我创建了一个名为SampleProject
的新项目,然后我在SampleProject.mxml
默认包和SampleProjectHomeView.mxml
。
我用一个脚本标记执行如下:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
// here I would like to call methods from java class
]]>
</fx:Script>
从上面的代码,我想打电话从一个Java类方法的脚本。我已经写Java代码如下:
public class Sample
{
public void add(int a,int b)
{
int c;
c=a+b;
System.out.println("addition of two"+c);
}
public void sub(int a,int b)
{
int c;
c=a+b;
System.out.println("subtraction of two"+c);
}
}
我怎样才能SampleProjectHomeView.mxml
拨打以上从类add
和sub
方法呢?
请有人帮助我。
您是否知道AIR移动版的扩展功能?我认为这可能是你正在寻找的。 – Ryan