javaflex

java编程,flex是什么东西

简单的说一下,flex之所以出现,是应为编写flash对于编程人员来说太hard了,编写flash要用美术功底,还要一帧一帧的弄,对程序员来说太难,所以flex应运出世。flex就是以编程(程序员熟悉)的方式来实现flash功能,所用语言为actionscript语言,最后会编译出一个swf文件,也就是flash文件,这样对程序员来说就方便多了。听同事说google地图(网页)好像就是用flex做的。

javaflex

大学,C语言,数据结构,java,flex,应该沿着什么顺序学习,谢谢

先学C语言吧!如果有微机原理的话,先学微机原理,然后是汇编语言,再是C语言,接着是数据结构,然后是C++,再然后是JAVA和C#。flex放在后面,这时候你可以用java或c#开发服务器端程序了,用flex就可以跟他们通讯了,在接下来,看你兴趣了,想学什么就学什么吧!有编译原理的话,可以好好学学,学好了可以更好地理解程序是怎么编译的。希望对你有帮助,我没上过大学,也不太了解大学的课程。

flex项目如何运行

flash 的安全机制了,在控制面板中的 flash player 设置里。

高级页面内 有个 “授信位置” 制定某些目录里的 swf 可以访问远程数据之类的。

flex调用Java方法连接sqlserver

基于blazeDS的flex4与spring的程序实例步骤

环境:

jdk1.6

j2ee1.5

spring2.5.6

blazeDS3.3

tomcat6.0

flex4

myeclipse8.5

flashBuilder4

步骤:

一、 启动好blazeDS(即启动tomcat,在[tomcat]/webapps目录下产生一个blazeds文件夹(三个war包产生一个blazeds文件夹));

在myeclipse8.5新建一个web Project工程,工程名为webSpring;

把此工程加入blazeDS支持(即用blazeds下的WEB-INF文件夹替换掉web工程下的WEB-INF文件夹);

加入spring支持(把spring相关的jar包拷贝到webSpring/WebRoot/WEB-INF/lib目录下即可)。

二、 1. 在javaWeb工程webSpring的str目录下分别新建一下两个包:

cn.xuediit.myFactory、cn.xuediit.myService;

2. 在cn.xuediit.myFctory包下新建两个类:FlexFactoryImpl.java和SpringFactoryInstance.java

(1). FlexFactoryImpl.java:

package cn.xuediit.myFactory;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import flex.messaging.FactoryInstance;

import flex.messaging.FlexFactory;

import flex.messaging.config.ConfigMap;

public class FlexFactoryImpl implements FlexFactory {

private Log log = LogFactory.getLog(getClass());

/*override interface method*/

public void initialize(String id, ConfigMap configMap) {

System.out.println(“1—flex工厂实现类重写的方法initialize”);

}

/*override interface method*/

public FactoryInstance createFactoryInstance(String id, ConfigMap properties) {

System.out.println(“2—flex工厂实现类重写的方法createFactoryInstance”);

log.info(“Create FactoryInstance.”);

SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);

instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));

return instance;

}

/*override interface method*/

public Object lookup(FactoryInstance instanceInfo) {

System.out.println(“4—flex工厂实现类重写的方法lookup”);

log.info(“Lookup service object.”);

return instanceInfo.lookup();

}

}

(2).SpringFactoryInstance.java

package cn.xuediit.myFactory;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.springframework.beans.BeansException;

import org.springframework.beans.factory.NoSuchBeanDefinitionException;

import org.springframework.context.ApplicationContext;

import org.springframework.web.context.support.WebApplicationContextUtils;

import flex.messaging.FactoryInstance;

import flex.messaging.FlexContext;

import flex.messaging.FlexFactory;

import flex.messaging.config.ConfigMap;

import flex.messaging.services.ServiceException;

public class SpringFactoryInstance extends FactoryInstance {

private Log log = LogFactory.getLog(getClass());

SpringFactoryInstance(FlexFactory factory, String id, ConfigMap properties) {

super(factory, id, properties);

}

public Object lookup() {

System.out.println(“3—spring工厂类的方法lookup”);

ApplicationContext appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(FlexContext.getServletConfig().getServletContext());

String beanName = getSource();

try {

log.info(“Lookup bean from Spring ApplicationContext: ” + beanName);

return appContext.getBean(beanName);

} catch (NoSuchBeanDefinitionException nex) {

ServiceException e = new ServiceException();

String msg = “Spring service named ‘” + beanName + “‘ does not exist.”;

e.setMessage(msg);

e.setRootCause(nex);

e.setDetails(msg);

e.setCode(“Server.Processing”);

throw e;

} catch (BeansException bex) {

ServiceException e = new ServiceException();

String msg = “Unable to create Spring service named ‘” + beanName + “‘.”;

e.setMessage(msg);

e.setRootCause(bex);

e.setDetails(msg);

e.setCode(“Server.Processing”);

throw e;

} catch (Exception ex) {

ServiceException e = new ServiceException();

String msg = “Unexpected exception when trying to create Spring service named ‘” + beanName + “‘.”;

e.setMessage(msg);

e.setRootCause(ex);

e.setDetails(msg);

e.setCode(“Server.Processing”);

throw e;

}

}

}

3. 在cn.xuediit.myService包下新建两个类:FService.java和FServicesImpl.java

(1). FService.java

package cn.xuediit.myService;

public interface FService {

public String sayHello(String name);

}

(2). FServicesImpl.java

package cn.xuediit.myService;

public class FServicesImpl implements FService {

public String sayHello(String name) {

System.out.println(“5—服务层实现类(本质上的与flex交互的类)”);

return “我是服务层的服务实现类==” + name;

}

}

三、 1、 在javaWeb工程webSpring下,在文件webSpring/WebRoot/WEB-INF/web.xml的web-app标签下添加子节点:

listener

listener-class

org.springframework.web.context.ContextLoaderListener

/listener-class

/listener

2、 在javaWeb工程webSpring下,在webSpring/WebRoot/WEB-INF目录下新建一个文件:applicationContext.xml

?xml version=”1.0″ encoding=”UTF-8″?

beans xmlns=””

xmlns:xsi=””

xmlns:tx=””

xsi:schemaLocation=”

bean id=”fServiceImplBeanID” class=”cn.xuediit.myService.FServicesImpl”/bean

/beans

四、 1、 在javaWeb工程webSpring下,在WebRoot/WEB-INF/flex/remoting-config.xml文件中的service标签下添加:

destination id=”destinationID”

properties

factoryflexFactoryImplID/factory

sourcefServiceImplBeanID/source

scopeapplication/scope

/properties

/destination

2、 在javaWeb工程webSpring下,在WebRoot/WEB-INF/flex/services-config.xml文件中的services-config标签下添加:

factories

factory id=”flexFactoryImplID” class=”cn.xuediit.myFactory.FlexFactoryImpl”/

/factories

五、 给此javaWeb工程添加tomcat支持,启动tomcat(这个容易就不说了)。

六、 在flashBuilder下新建一个基于blazeDS的flex项目(以webSpring为后台工程),工程名为webFb;

webFb.mxml:

?xml version=”1.0″ encoding=”utf-8″?

s:Application xmlns:fx=””

xmlns:s=”library://ns.adobe.com/flex/spark”

xmlns:mx=”library://ns.adobe.com/flex/halo”

minWidth=”500″ minHeight=”200″

fx:Script

![CDATA[

import mx.core.Application;

import mx.rpc.events.FaultEvent;

import mx.collections.ArrayCollection;

import mx.rpc.remoting.mxml.RemoteObject;

import mx.controls.Alert;

import mx.rpc.events.ResultEvent;

public function submit(name:String):void{

var remote:RemoteObject = new RemoteObject();

remote.destination = “destinationID”;

remote.endpoint = “”;

remote.addEventListener(ResultEvent.RESULT, myResult);

remote.addEventListener(FaultEvent.FAULT,fault);

remote.sayHello(name);

}

private function myResult(evt:ResultEvent):void{

Alert.show(evt.result.toString());

}

private function fault(evt:FaultEvent):void{

Alert.show(evt.fault.message);

}

]]

/fx:Script

s:Button x=”240″ y=”11″ label=”要发送到” click=”submit(nameTxt.text)”/

s:Label x=”16″ y=”11″ text=”姓名”/

s:TextInput id=”nameTxt” x=”100″ y=”100″/

/s:Application

本文来自投稿,不代表【】观点,发布者:【

本文地址: ,如若转载,请注明出处!

举报投诉邮箱:253000106@qq.com

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2024年3月25日 06:43:08
下一篇 2024年3月25日 06:51:27

发表回复

登录后才能评论



关注微信