- easyLoader可以加载自定义的文件类型!简单、易用、强大一看就会 [返回文章列表]
发表于: 2010-3-17 76人(次)浏览
- 下载最新的类、例子以及文档:https://code.google.com/p/easyloader/
非常高兴easyLoader 这个项目终于发布了。现在的最新版本是1.011;它可以用来干不少事情,比如说加载声音、视频、XML、TXT文本、DAE的模型,玩家还可以自己定义要加载的文件类型。
比如你有个新的文件类型,或想将要Load进来的FLASH改成其他的名字比如说:myswf.cc等.
希望大家可以喜欢。
作者:刘毅
可能会有朋友要问什么是easyLoader?
easyLoader 是我自己在工作中一直使用的一个资源加载类,每个项目都会用它来加载网站或游戏需要的各种资源文件,比如SWF、图片、XML、TXT文档、DAE模型、视频流等。
也可以单单用来做预加载的工具。。。
为什么我需要它呢?理由如下:
-非常非常容易使用;
每个方法的名字都写的通俗易懂,一看名字就知道是干什么的。而且需要用到的方法就几个,几乎不用学,看到例子就会用了。
-不会有丢失下载内容的现象
因为是一个下载完再去下载另外一个的,所以不会发生一次加载N多个,然后偶尔会出现某些资源丢失的诡异现象。
-优秀的内存管理
每个被指定的资源都可以完全被摧毁掉干净,整个easyLoader对象也是。不会再反复持续的使用中增加内存的使用。
-更富有弹性
使用者可以使用自定义的文件后缀名,并进行加载;不止是这样,用户还可以选择自己想要的加载模式。比如说 bytes/variables 等;
-动态增加新需要加载的文件
EasyLoader可以随时增加需要加载的资源文件并开始加载,即使已经刚刚从写好的XML文件里加载好了其他的文件。只需要addFile()就可以了。
-更新及时和实用
将及时更新新的实用版本,但不会去改变接口,使新旧版本可以平滑过渡。并且根据用户的需求来决定加入或移除某些不必要的功能。
大家如果有作品使用了这个类,如果愿意的话可以将网站链接发给我吗?然后分享给大家。谢谢了。
如何使用?
真的只需要几行代码就可以了:
第一步:
先实例化一个 easyLoader 对象
line1: var _assetsManager = new EasyLoader();
第二步:
增加必须要的事件侦听
line2: _assetsManager.addEventListener(EasyLoaderEvent.COMPLETED,assetsLoaded)
第三步:增加一个加载完事件相对应的方法
line2:private function assetsLoaded(e:EasyLoaderEvent) {
line3: //put some code to here like init()
line4:}
第四部:开始根据XML配置文件来加载资源吧!
line5:_assetsManager.loadConfig("assets.xml")
ok,this is all!
Hi,guys!Very happy to announce to the world,my easyLoader project was updated to 1.01.
this class can be used to load sound,video,txt,xml,image,swf,event dae and on.and you guys can add custom file type for easyLoader.
author :liuyi email:luckliuyi@163.com, blog:;
What is easyLoader?
This work is use load all the assets of website or game,it is an good assets manager.
People can use it to load sound,video,txt,xml,image,swf,dae and so on.
Why we need it?
-easy of use
Every method have a good naming,you can use it likes speak to an friend.Only need several lines to complete the work.
-never be lost items
load items one by one.
-excellent memory manage
Using it continually more than 24 hours,memory do not increase without limit.item can be destoried,easyLoader Object(include all assets) too.
-flexible
User can add custom file type to loading.
-dynamic add items for easyLoader
EasyLoader can add and load new assets anytime and anywhere,although all the items were loaded.
-Updates
will updates according to user's requirements.
How to use?
Realy only need several lines:
step1:
new a easyLoader Object
line1: var _assetsManager = new EasyLoader();
step2:
add some necessary event Listener
line2: _assetsManager.addEventListener(EasyLoaderEvent.COMPLETED,assetsLoaded)
step3:add the assetsLoaded function
line2:private function assetsLoaded(e:EasyLoaderEvent) {
line3: //put some code to here like init()
line4:}
step4:load assets according to config xml
line5:_assetsManager.loadConfig("assets.xml")
ok,this is all!
Public Methods
EasyLoader()
addFile(path:String, alias:String = "", loadTip:String = "", autoRemove:Boolean = false, method:String = "text"):void
addType($type:String, $name:String):Boolean
dispose():void
disposeFileByAlias(alias:String):Boolean
disposeFileByName(name:String):Boolean
getFileByAlias(alias:String):LoadedItem
getFileByIndex(number:uint):LoadedItem
getFileByName(name:String):LoadedItem
init(obj:* = null, $autoLoad:Boolean = true, $ignoreError:Boolean = true):Boolean
loadConfig(str:String):void
pause():void
removeFileByAlias(alias:String):Boolean
removeFileByName(name:String):Boolean
start():void
unPause():void
下载最新的类、例子以及文档:https://code.google.com/p/easyloader/
更多详细中英文文档最近将会放出。工作太忙了。。。不好意思
easyLoader可以加载自定义的文件类型!简单、易用、强大一看就会
[返回文章列表]