存档

作者存档

as3版翻页程序测试,支持多页连翻

2010年5月6日 1 条评论

RT,完全基于as3实现
内存管理方面有待继续优化,翻页静帧功能暂未实现。
测试页面的内容随便找来的~~~版权归原作者所有
测试方法:鼠标点击页面边缘或页脚,可连续点击实现连翻

分类: Computer 标签: ,

as3中的深度管理的利于弊

2010年5月5日 1 条评论

as3相比于as1和as2,引入了新的深度管理方法。从而抛弃了as1,as2时期的swapdepth和getnexthigherdepth的深度管理方法。
代替他们的是addChildAt,addChild,removeChild,removeChildAt,swapChildAt等。
广大as3爱好者无不拍手称快。
新的深度管理的方式,将深度管理的工作交给flash自身进行,提供给用户的child索引实际上是连续的,避免的as1,2时期深度不连续的问题。同时深度管理也更加直观。

但是,从我而言,这种新式的深度管理同样也带来了弊端。

以上一篇博文中提到的多页连翻中的深度管理为例,我们可以发现,在多页连翻的过程中实际上是需要不停的去创建页面,并指定z序,同时还需要不停的交换不同页面的z序。这在as3时期的新的深度管理方法下面,简直是噩梦。
此时,你就不得不单独先一个类,去实现类似于as2时期的深度管理方案。这也就要求被管理的对象必须给其重新附加一个depth属性。
以下为depthmanager类源代码。

package org.kingse.CFlipPage.Utilities {
    import flash.display.*;
 
    public class DepthManger {
 
        public function DepthManger(){
            throw (new Error("静态类,不能实例化。", 9999));
        }
        public static function getNextHighestDepth(container:DisplayObjectContainer):Number{
            throw (new Error("未实现!"));
        }
        public static function remove(container:DisplayObjectContainer, displayobj:DisplayObject):void{
            container.removeChild(displayobj);
        }
        public static function addAt(container:DisplayObjectContainer, displayobj:DisplayObject, depth:int):void{
            var i:int;
            var childrencount:int = container.numChildren;
	        if (childrencount == 0){
                container.addChild(displayobj);
                displayobj["depth"] = depth;
                return;
            }
            if (container.getChildAt(childrencount-1)["depth"]<depth){
                container.addChildAt(displayobj,childrencount);
                displayobj["depth"]=depth;
                return;
            }
            i = childrencount-1;
            var depth1:int;
            var depth2:int;
            while (i >=0) {
                depth1=container.getChildAt(i)["depth"];
                if (i-1>=0){
                    depth2=container.getChildAt(i-1)["depth"];
                }else{
                    depth2=-1;
                }
                if (depth==depth1){
                    container.removeChildAt(i);
                    container.addChildAt(displayobj,i);
                    displayobj["depth"]=depth;
                    return;
                }
                if ((depth<depth1)&&(depth>depth2)){
                    container.addChildAt(displayobj,i);
                    displayobj["depth"]=depth;
                    return;
                }
                i--;
            }
        }
        public static function swapDepths(container:DisplayObjectContainer, displayobj:DisplayObject, depth:Number):void{
            var tempdepth:int;
	        if ((container == null) || (displayobj == null)){
                return;
            }
            var nowindex:int;
            var nowdepth:int;
            var aimdepth:int=int(depth);
            try{
                nowindex = container.getChildIndex(displayobj);
                nowdepth = displayobj["depth"];
                if (nowdepth == aimdepth){
                    return;
                }
            }catch(err:Error){
                return;
            }
            var childrencount:int = container.numChildren;
            var depth1:int;
            var depth2:int;
            var i:int=childrencount-1;
            if (container.getChildAt(i)["depth"] < aimdepth){
                container.removeChild(displayobj);
                container.addChild(displayobj);
                displayobj["depth"]=aimdepth;
            }
            while (i>=0){
                depth1=container.getChildAt(i)["depth"];
                if (i-1>=0){
                    depth2=container.getChildAt(i-1)["depth"];
                }else{
                    depth2=-1;
                }
                if (aimdepth==depth1){
                    container.swapChildrenAt(i,nowindex);
                    displayobj["depth"]=aimdepth;
                    container.getChildAt(nowindex)["depth"]=nowdepth;
                    return;
                }
                if ((aimdepth<depth1)&&(aimdepth>depth2)){
                    container.removeChild(displayobj);
                    if (nowindex>=i){
                        container.addChildAt(displayobj,i);
                    }else{
                        container.addChildAt(displayobj,((i-1<0) ? 0 : (i-1)));
                    }
                    displayobj["depth"]=aimdepth;
                    return;
                }
                i--;
            }
        }
    }
}
分类: Computer 标签: ,

多页连翻型电子杂志组件原理简介

2010年5月4日 没有评论

电子杂志之风盛行于几年前,从最初的fflippage,pageflip,margpark等组件,到zinemaker,iebook等软件。相关应用层出不群。
但是就效果来说,大部分都基于国外开源的pageflip组件或者原理类似。

其中比较独特的是自在幻想(fictiony)的fflippage组件,该组件实现了多页连翻效果,在真实性上更加完善。

本文以简图探讨多页连翻型与单翻型究竟在架构上有什么不同。

先看下面的图

上图表面的是典型的电子杂志组件的层次安排图。

其中this为整个电子杂志组件,最下面两层为shadow和shadowmask,这两层在整个组件上创造出翻页是的书下面的光影效果。

再上一层是page,page就是页面内容的容器。在往上就是pagemask了,pagemask控制page容器整体的显示范围。

page这个容器里面包含最底层content,也就是内容,例如图片等,shade,中间缝隙的阴影等,contentmask是控制翻页过程中content能够够显示出来的部分。

那么这个体系结构中,page实际上是可以多个累加,进行深度管理的。每个page都有其自己的坐标,以及shade,和contentmask,这样每个就构成了多页连翻的显示结构,至于多页连翻的程序实现,就不在本文探讨范围之内了

分类: Computer 标签: , ,

不明白,我这歪脖也能被人看上?

2010年5月2日 没有评论

嘛也不说,直接上图

分类: Computer 标签:

Un ange frappe a ma porte

2010年4月21日 没有评论

很偶然的听到了这首歌。很伤感的一首歌。

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Un ange frappe a ma porte
歌手:Natasha st pier

Un signe, une larme,
面对暗示泪成行,
un mot, une arme,
斟词酌句心已伤,
nettoyer les etoiles
可怜春心枉陶醉,
a l’alcool de mon ame
清心拭泪抚情殇。
Un vide, un mal
阵阵空虚成悲伤,
des roses qui se fanent
朵朵玫瑰现凋相,
quelqu’un qui prend la place de
可叹帅哥做异梦,
quelqu’un d’autre
移情别处负心郎。
Un ange frappe a ma porte
天使欲敲我心房,
Est-ce que je le laisse entrer
是否开启费思量。
Ce n’est pas toujours ma faute
纵然往事消如烟,
Si les choses sont cassees
岂能怨错在我方。
Le diable frappe a ma porte
魔鬼亦敲我心房,
Il demande a me parler
信誓旦旦诉衷肠,
Il y a en moi toujours l’autre
在我眼中都一样,
Attire par le danger
皆如虚情负心郎。 阅读全文…

分类: Music&Movie 标签:

闪客精灵导出的Fla提示“无法将场景载入内存,您的文件可能已损坏”的解决方法

2010年4月18日 没有评论

用闪客精灵(SWF Decompiler)反编译swf,导出Fla时,得到的Fla用flash打开经常会出现“无法将场景载入内存,您的文件可能已损坏”的提示。尤其在源swf中含有嵌入的视频音频资源时,更是如此。本质上的原因是fla中部分资源发生了损坏,无法正常读取,所有修复这部分受损的资源即可

此种情况下,一般的解决步骤如下:

1、用flash打开fla,从库面板中找到所有损坏的资源(那些资源预览中提示无法预览的资源)

2、用swf decompiler打开原swf,单独导出这些损坏的资源

3、在flash中,用第二步导出的资源替换fla库中的资源。

解决,收工

分类: Computer 标签: ,

图解Origin 8.0科技绘图及数据分析

2010年4月10日 没有评论

好书分享。
附此书目录,下载地址见贴内
封面 -10
书名 -9
版权 -8
前言 -7
目录 -5
第1章 Origin基础 4
 1.1 Origin简介 4
  1.1.1 常用的科技绘图及数据处理软件 4
  1.1.2 Origin的主要功能 4
 1.2 Origin工作环境 5
  1.2.1 菜单(Menu) 5
  1.2.2 工具栏(Toolbar) 6
  1.2.3 项目管理器(Project Explorer) 8
  1.2.4 事件记录(Results Log) 9
  1.2.5 命令窗口(Command Window) 10
  1.2.6 编程环境(Code Builder) 10
 1.3 Origin子窗口 11
  1.3.1 Origin工作簿(Workbook) 11
  1.3.2 Excel工作簿 11
  1.3.3 图形(Graph) 11
  1.3.4 矩阵(Matrix)工作簿 12
  1.3.5 函数图(Function) 12
  1.3.6 版面布局(Layout Page) 13
  1.3.7 记事(Notes) 13
 1.4 Origin示例数据 13
 1.5 动手做一个简明例子 14 阅读全文…

分类: Computer, Study 标签:

国内、美国及香港对比 Zz from newsmth

2010年4月5日 没有评论

Author: kouros@newsmth

以下正文

————————————————————————————————————

根据个人经验,写一篇关于国内、美国与香港的对比文章,希望对国内想出国的、国外想回国的新人朋友有点帮助。文中的美国指美国的城市区,而国内专指北京、上海、广州、深圳四个一线城市。

工作及收入
美国本科生起薪在4万美元左右,硕士为5万,博士为6万。如果是名校毕业,可以在这个基础上加1到2万。顶级名校的博士可以拿到10万,超过10万的毫无疑问就属于高薪阶层了。
美国是工程师的天堂,搞工科的人在美国的起薪基本与金融界持平,差别只是分红少,升级慢。由于起薪是一个人挑选工作最重要的因素之一,而无论是香港还是国内,工程界的起薪都无法达到美国哪怕一半的水平,所以搞工科的人很少回国,是比较容易理解的。工科升职较慢,前几年都是在打杂,即使非常顺利,几年之后步入高职,也往往已娶妻生子,基本上在美国定居了。这种生活模式,是中国留学生最典型的模式。
虽然拥有世界上最发达的金融市场,但美国金融界的起薪并不明显高于工程界。不过,由于美国市场太大,钱太好赚,金融界的分红是其他行业无法相比的。在好的年景,即使刚刚加入公司的新员工也可以得到与年薪几乎相等的分红,而老员工的分红更是呈几何级数增长。对于美国非常普遍的hedge fund,proprietary trading,private equity等等小公司,模式更加灵活,还常有按照挣的钱提成百分比的模式,高可至50%。对这一行非常有天赋的人,第一年就可以拿到几百万的分红,这样的造富之梦是其他行业不可想象的。当然,必须指出,美国金融界并不好进,即使进去90%也只是打打杂,按部就班。所以,造福之梦对于绝大多数人也只是个梦而已。
阅读全文…

分类: Life 标签: , ,