develop's blog,about web&game&mobile&so on!
标签 Tag : flash

LoaderMax – Smart AS3 Loading

<Category: flash> 1 条评论

LoaderMax is a new AS3 loading system that does much more than just get swf, mp3, css, video, image, text, binary, and xml files into your Flash application. It eats files for dinner, burps, and then asks for 2nds. And 3rds. Yet it’s surprisingly thin. In fact, it can be half the size of most other loading systems even though it delivers a bunch of unique capabilities, some of which you probably never knew you needed but won’t want to live without. Here are a few of the noteworthy features:

http://www.LoaderMax.com

  • Integration of loaders inside subloaded swfs – with most other systems, if you subload a swf, the loader will only concern itself with the swf file’s bytes but what if that swf must subload other content like XML, images, and/or other swf files before it should be considered fully loaded? LoaderMax can elegantly handle the sub-subloads as deep as they go. You can link any loader and/or LoaderMax with a swf’s root (using the requireWithRoot vars property) so that when you subload it into another Flash application, the parent SWFLoader automatically factors the nested loaders into its overall loading progress! It won’t dispatch its COMPLETE event until they have finished as well.
  • Automatic parsing of LoaderMax-related nodes inside XML – The XMLLoader class automatically looks for LoaderMax-related nodes like <LoaderMax>, <ImageLoader>, <SWFLoader>, <XMLLoader>, <VideoLoader>, <DataLoader>, <CSSLoader>, <MP3Loader>, etc. in XML files that it loads, and if any are found it will create the necessary instances and then begin loading the ones that had a load=”true” attribute, automatically integrating their progress into the XMLLoader’s overall progress and it won’t dispatch a COMPLETE event until the XML-driven loaders have finished as well. See XMLLoader’s ASDocs for details.
  • Tight file size – Many other systems are 16-24k+ even if you’re just loading text, but LoaderMax can be as little as 7k (depending on which loader types you use).
  • Define an alternateURL for any loader – If the original url fails to load, it will automatically switch to the alternateURL and try again.
  • A common set of properties and methods among all loaders – All loader types (XMLLoader, SWFLoader, ImageLoader, MP3Loader, CSSLoader, VideoLoader, LoaderMax, etc.) share common properties like: content, name, status, loadTime, paused, bytesLoaded, bytesTotal, and progress as well as methods like: load(), pause(), resume(), prioritize(), unload(), cancel(), auditSize() and dispose() delivering a touch of polymorphism sweetness.
  • Nest LoaderMax instances inside other LoaderMax instances as deeply as you want. – A LoaderMax instance is basically a queue of loaders which makes it simple to control them as a whole and get the overall progress, bytesLoaded, and/or bytesTotal. You can put a queue into another – group and nest them however you want. This makes complex queues simple. Need to know when the first 3 loaders have finished loading inside a 10-loader queue? Just put those 3 into their own LoaderMax that has an onComplete and nest that LoaderMax inside your main LoaderMax queue.
  • Set a width/height for an ImageLoader, SWFLoader, or VideoLoader and when it loads, the image/swf/video will automatically scale to fit using any of the following scaleModes: “stretch”, “proportionalInside”, “proportionalOutside”, “widthOnly”, or “heightOnly”.
  • Conveniences like auto smoothing of images, centering their registration point, noCache, setting initial x, y, scaleX, scaleY, rotation, alpha, and blendMode properties, optional autoPlay for mp3s, swfs, and videos, and more.
  • Works around common Flash hassles/bugs – LoaderMax implements workarounds for things like garbage collection headaches with subloaded swfs, images, and NetStreams as well as other problems like the recently discovered issues with subloading swfs that use TLF.
  • Find loaders and content by name or url – Every loader has a name property which you can use to uniquely identify it. Feed a name or URL to the static LoaderMax.getLoader() or LoaderMax.getContent() methods to quickly get the associated loader or content.
  • A single loader can belong to multiple LoaderMax instances
  • Accurate progress reporting – For maximum performance, set an estimatedBytes for each loader or allow LoaderMax’s auditSize feature to automatically preload just enough of each child loader’s content to determine its bytesTotal, making progress reporting on large queues very accurate.
  • prioritize() a loader anytime – Kick an object to the top of all LoaderMax queues to which it belongs, immediately supplanting the top spot in each one.
  • A robust event system – events bubble up through LoaderMax hierarchies and carry a consistent target for easy identification
  • Set up multiple event listeners in one line – Add listeners like onComplete, onProgress, onError, etc. via the constructor like new LoaderMax({name:”mainQueue”, onComplete:completeHandler, onProgress:progressHandler, onError:errorHandler});
  • maxConnections – Set the maximum number of simultaneous connections for each LoaderMax instance (default is 2). This can speed up overall loading times.
  • pause()/resume() – no queue loading solution would be complete without the ability to pause()/resume() anytime.
  • Flex friendly – Simply change the LoaderMax.contentDisplayClass to FlexContentDisplay and then ImageLoaders, SWFLoaders, and VideoLoaders will return content wrapped in a UIComponent.

http://www.LoaderMax.com

本文来自: LoaderMax – Smart AS3 Loading

Adobe Flash Builder 4 Premium 正式版下载地址+序列号

<Category: flash> 2 条评论

http://trials.adobe.com/AdobeProducts/FLBR/4/win32/FlashBuilder_4_LS10.exe

 安装序列号: 1424-4008-9664-3602-3439-1711

本文来自: Adobe Flash Builder 4 Premium 正式版下载地址+序列号

Adobe将在4月12日发布Creative Suite 5

<Category: flash> 发表评论

一名Adobe的发言人今天表示,他们将在4月12日上午11点发表最新的设计套件Creative Suite 5。新版套件带来了对高清视频的全面支持,一个新的名叫“水星”的渲染引擎被引入,它能够在Premiere Pro中有效利用图形处理器来实现高清编码和回放,但是只支持NVDIA的CUDA而忽视了OpenCL,此外,CS5套件还带来了一个Flash Catalyst — Flash应用的开发引擎,这相信是设计人员最为关注的一个项目,就让我们耐心等待吧。以下是发布会直播地址: http://cs5launch.adobe.com/

本文来自: Adobe将在4月12日发布Creative Suite 5

AS3 优化 之 FOR内循环

<Category: flash> 发表评论

转载自8ria
写游戏只要有思路,就能实现,但这也只是从功能角度出发,能不能有好的效率,才是关键,于是想积累一些关于优化方面的知识。

关于AS3 FOR内循环的优化

当我们遍历一个数组的时候 ,你可能会这样写

private function testFor() : void
{
var tmpVar:int;

for(var i:Number=0; i {
tmpVar = testArray[i];
}
}

执行这个函数50次,所用的时间是53.34毫秒。

如果我们将number类型改成int类型,如下

for(var i:int=0; i

这样所执行的时间是35.58毫秒。

如果先把数组的长度计算出来,速度会更快

var l:int = testArray.length;

for(var i:int=0; i

这个仅仅用了21.6毫秒

所以在for循环上int比number快,将length在循环外事先定义出来比直接写在for条件语句里面要快。

再看两段代码

var tmpVar:int;

for(var i:Number=0; i<100000; i++)
{
tmpVar = SomeClass.SOME_CONSTANT;
}

var tmpVar:int;
var myConstant:int = SomeClass.SOME_CONSTANT;

for(var i:Number=0; i<100000; i++)
{
tmpVar = myConstant;
}

前者的运行速度是34.08毫秒,后者的速度是 15.8毫秒

所以说 在FOR循环外先取到类属性,比拿到FOR循环内再去取类的属性的速度要快

变量在FOR内的定义
for(var i:int=0; i<100000; i++)
{
var v1:Number=10;
var v2:Number=10;
var v3:Number=10;
var v4:Number=10;
var v5:Number=10;
}
这个FOR需要用46.52毫秒,如果你用一个 var 去定义所有,将这些变量写成一行,像这样

for(var i:int=0; i<100000; i++)
{
var v1:Number=10, v2:Number=10, v3:Number=10, v4:Number=10, v5:Number=10;
}

执行之间缩短到 19.74

所以 在FOR循环内 尽量减少var这个关键字出现的次数,会提高效率

逻辑运算符的适当运用也会提高效率的

for(var i:int=0; i<100000; i++)
{
var val1:int = 4 * 2;
var val2:int = 4 * 4;
var val3:int = 4 / 2;
var val4:int = 4 / 4;
}

这段执行时间为 49.12 毫秒, 如果换成下面的代码,将会降到 35.56 毫秒

for(var i:int=0; i<100000; i++)
{
var val1:int = 4 << 1;
var val2:int = 4 << 2; var val3:int = 4 >> 1;
var val4:int = 4 >> 2;
}

本文来自: AS3 优化 之 FOR内循环

显示对象动态扩展属性

<Category: rayYee> 发表评论

Sprite是无法动态扩展属性的,因为Sprite是静态的。只有用MovieClip可以动态扩展属性!

本文来自: 显示对象动态扩展属性

令人拍案叫绝的flash 3D站点

<Category: rayYee> 发表评论

Flashstreamworks主要关注的是视频趋势,但是最近关注了一些最新开发出来的Flash 3D的空间。下面是收集的一些站点。

Bandit3 Most Wanted
令人印象深刻的站点,采用的是Away3D引擎。在这个复杂的世界里,可以环游街道,出入建筑,探索公司更多的东西。

Portfolio Nick Joore
Nick Joore的三维文件夹是必看无疑的。当驾驶着飞船巡游彩色世界,那种感觉很像是在玩wii游戏机,而实际这只是Papervision 3D渲染出来的效果

Papervision 3D showcase
如果你在寻找有趣的Papervision 3D例子,这里绝对是最合适的。这个站点包含了大量的例子,可以预览、描述和排名。

Alternativa3D V7 demo
Alternativa3D是一个针对flash player 10优化的第一人称射击演示。v7演示包含了很多的广告,虽然样子一般,但是执行效率确实令人惊叹。

本文来自: 令人拍案叫绝的flash 3D站点