flex 使用RSL减小swf的体积,以及遇到的问题
在开发项目时,项目越大,swf生成的体积越大,对于局域网影响不大,但是对于互联网就很头疼了。
加载一个界面要很久。一般人根本没耐性等你加载完。
为了减小swf体积,个人总结了两个办法。办法如下:
第一,尽量使用module,少量使用自定义组件,这样可以减少加载的时间
第二,使用RSL,减小swf体积。RSL使用如下:
右击你的项目----->Properties------>flex Build Path----->Library Path---->Framework linkage:
选择RSL(Runtime Shared Library)----->确定
-------------------------------------------------------------------------
在使用RSL后,运行swf时出现了SecurityError: Error #2028
: 仅限于文件系统的 SWF 文件...
后来经过查询,终于有点眉目。RSL需要network权限,必需使用浏览器浏览。
如http://192.168.1.2:8080/project/bin/Main.html
相关文档:
package org.openscales.core.format
{
import flash.utils.getQualifiedClassName;
import flash.xml.XMLNode;
import org.openscales.core.Util;
import org.openscales.core.feature.Feature;
import org.openscales.core.geometry.Collection;
import org.openscales.core. ......
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:file="file.*">
<mx:Script>
<!--[CDATA[
import simPager.PagerEvent;
import mx.collections.ArrayCollection;
[Bindable]
priv ......
package
{
import mx.containers.Panel;
import mx.controls.Button;
import flash.events.Event;
import mx.events.FlexEvent;
import flash.events.MouseEvent;
import mx.controls.Alert;
/**
* This class is used to create a Custom Panel
* with Maximum, Minimum, close
* and also drag p ......
由于Flex只是一种客户端技术其本身并不能直接同数据库交互,在实际的应用开发过程中Flex提供了如URLRequest、HTTPService、RemoteObject、WebService等类以实现同服务器的通讯和数据交互,下面做一些介绍和实例解析:
1、使用URLRequest向服务器发送请求,使用URLLoader接收服务器返回的数据:
& ......
/*============使用==========*/
var contextmenu:ContextMenuManager=new ContextMenuManager();
contextmenu.add("最大化",menuHandle);//menuHandle处理函数
/**==================ContextMenuManager.as==========================*/
package file
{
import flash.display.Interact ......