Flash是被誉为21世纪互联网时代富媒体的终结者(我这么认为的),百年后,我希望他依旧能如此小巧
Mar 6
今日重游了以前经常逛的flash技术论坛,结果让我很是伤心。最后不得不还是翻墙去谷歌论坛了。
国内的这些所谓的论坛功利性太强了,都TM只知道赚人气啊、广告、会员费啊之类的。
国外的那种纯分享怎么就不可以在国内出现呢?
今天见到一个技术贴,竟然还要什么鸡巴回复才能阅读。发这贴的人真是无聊至极,不知道是为了炫耀自己的学问和拷贝的手段还是别的什么,你不愿意拿出来就别出来丢人现眼就是了。
我的一位朋友很想学习下flex,结果整天却在天地会发水贴……
Tags:
Dec 23
function GC():void{                try{                (new LocalConnection).connect("foo");                (new LocalConnection).connect("foo");}catch(e){                        trace(System.totalMemory);                        }                }
这个是个很好的方法
但是见到了一位天地会的兄弟提出了轮询本地sharedobject对象的方法:
package {
        import flash.net.SharedObject;
        import flash.system.System;
        import flash.utils.clearInterval;
        import flash.utils.setInterval;        

        public class GCPlus {
                public static function clear(isTraceTM : Boolean = false) : void {
                        var time : int = 2;
                        var interval : int = setInterval(loop, 50);
                        function loop() : void {
                                if(!(time--)) {
                                        isTraceTM && trace(System.totalMemory);
                                        clearInterval(interval);
                                        return;
                                }
                                SharedObject.getLocal("bearjia", "/");
                        }
                }
        }
}

下面来画一个大大的图
package {
        import flash.display.MovieClip;
        import flash.display.Sprite;
        import flash.events.MouseEvent;
        import flash.system.System;        

        public class GC_Test extends Sprite {
                private static const NUM : int = 1000;
                private var num : int;

                public function GC_Test() {
                        init();
                }

                private function init() : void {
                        num = NUM;
                        stage.addEventListener(MouseEvent.CLICK, clickHandler);
                        while (num--) {
                                var mc : MovieClip = new MovieClip;
                                mc.graphics.beginFill(0);
                                mc.graphics.drawRect(0, 0, 100, 100);
                                mc.x = Math.random() * 500;
                                mc.y = Math.random() * 400;
                                addChild(mc);
                        }
                        
                        trace(System.totalMemory);
                }

                private function clickHandler(e : MouseEvent) : void {
                        clear();
                }

                private function clear() : void {
                        while (numChildren) {
                                removeChildAt(0);
                        }
                        GCPlus.clear(true);
                }
                /*function GC():void{//这是我们熟悉的方法
                try{
                (new LocalConnection).connect("foo");
                (new LocalConnection).connect("foo");}catch(e){
                        trace(System.totalMemory);
                        }
                }*/
        }
}


然后点击flash就可以看见输出显示的内存数了……
Dec 19
limo的系统内核毋庸置疑,是Linux。但是系统的表现层随着手机产商的不同而分别进行了定制,而我们悲剧的三星I8320的界面层大量的采用了flash技术。对于自定义rom已经自己DIY会很方便,但是令人吐血的就是暂时还只能通过反编译FLASH去找对应的接口。as2运行起来效率并不是很给力,但是无赖那个三星的类包限制了我们的想象力。毕竟是小众手机,而且很廉价。摸索摸索,耍耍
Tags:
Oct 15
花了一天时间完成了这个幸运大轮盘抽奖程序,最后还是把运算方面交给了后台程序。
flash来承载抽奖结果的计算是很错误的,对于一个对抽奖结果有些安全要求的项目来说,我们得最大限度的降低刷奖品的风险。
中的宗旨就是多进少出,来消耗会员手上的积分,但是极少数人却可以得到丰厚的奖励,达到宣传的目的。
点击在新窗口中浏览此图片
本来是想进行后台可以加入几率的,但是测试来测试去,php的rand这个函数很不可靠,所以在里面做了些小动作来控制几率。

附上这玩意的全部flash端代码,免得认为有炫耀之嫌,其实很TM简单的东西:
stop();
var myContextMenu:ContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
var item ="Dv9.org";
var gourl = "http://www.dv9.org";
var menu1:ContextMenuItem=new ContextMenuItem(item,true);
myContextMenu.customItems.push(menu1);
this.contextMenu=myContextMenu;
menu1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT ,mouseRelease1);
function mouseRelease1(event:ContextMenuEvent) {
  var url1:URLRequest=new URLRequest(gourl);
  navigateToURL(url1);
}

import fl.transitions.*;
import fl.transitions.easing.*;

var j:int=0;
var jg:Number;
look.visible=false;
zhen.rotation=0;
msg.scaleX=0;
msg.scaleY=0;


var my_date = new Date();
var loader1 = new URLLoader(new URLRequest("xxx.php?xx=" + my_date.getTime()));
loader1.dataFormat = URLLoaderDataFormat.VARIABLES;
loader1.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(e:Event):void{
bt.visible=true;
bt.addEventListener(MouseEvent.CLICK,replay);
var bearjia:* = URLLoader(e.target);
libi.text=bearjia.data.bear;
jihui.text=bearjia.data.water;
bearmsg.htmlText=bearjia.data.msgmsg;


look.close.addEventListener(MouseEvent.CLICK,look_close);
about.addEventListener(MouseEvent.CLICK,look_true);

function lun_zhuan(e:Event):void {
    j++;
    if (j==100) {
        bt.visible=true;
    var bear_msg=zhen.rotation+180;
    msg_true(bear_msg);
        zhen.removeEventListener(Event.ENTER_FRAME, lun_zhuan);
    }
    if (j<90) {
        zhen.rotation += 20;
    } else {

        zhen.rotation = bearjia.data.codecheck;

    }
}
function replay(e:MouseEvent) {
    j=0;
  jg=0;
    bt.visible=false;
    zhen.rotation=0;
    zhen.addEventListener(Event.ENTER_FRAME, lun_zhuan);
}
function msg_true(e) {
  var XTween:Tween = new Tween(msg, "scaleX", Elastic.easeOut, 0, 1, 1, true);
  var XTween1:Tween = new Tween(msg, "scaleY", Elastic.easeOut, 0, 1, 1, true);
if(e<46){msg.bear.text="恭喜!您获得了三等奖,你还可以继续参与抽奖!";var bearnum="33";} else if(e<91){msg.bear.text="谢谢参与!加油!你还可以继续参与抽奖!";var bearnum="0";}else if(e<136){msg.bear.text="恭喜!您获得了四等奖,你还可以继续参与抽奖!";var bearnum="44";}else if(e<181){msg.bear.text="谢谢参与!加油!你还可以继续参与抽奖!";var bearnum="0";}else if(e<226){msg.bear.text="恭喜!您获得了一等奖,你还可以继续参与抽奖!";var bearnum="11";}else if(e<271){msg.bear.text="谢谢参与!加油!你还可以继续参与抽奖!";var bearnum="0";}else if(e<316){msg.bear.text="恭喜!您获得了二等奖,你还可以继续参与抽奖!";var bearnum="22";}else if(e<361){msg.bear.text="谢谢参与!加油!你还可以继续参与抽奖!";var bearnum="0";}else if(e="abc"){msg.bear.text="您已经用完今天的20次抽奖机会!明天再来吧!";var bearnum="0";};
msg_close(bearnum);
}
function look_close(e){
  look.visible=false;
}
function look_true(e){
  look.visible=true;
}
function msg_close(e){
  trace(e);
  var loader = new URLLoader();
    var url = new URLRequest("/pp.php");
    url.method = URLRequestMethod.POST;
    var values = new URLVariables();
    values.message = e;
    values.check = e;
    url.data = values;
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.addEventListener(Event.COMPLETE, loaded);
    loader.load(url);
}
function loaded(e){
    msg.close1.addEventListener(MouseEvent.CLICK,goblack);
}
function goblack(e){
    gotoAndPlay(1);
}
}

function EncodeUtf8(str:String):String
        {
            var oriByteArr : ByteArray = new ByteArray();
            oriByteArr.writeUTFBytes(str);
            var tempByteArr : ByteArray = new ByteArray();
            for (var i:int = 0; i<oriByteArr.length; i++) {

                 if (oriByteArr[i] == 194) {
                      tempByteArr.writeByte(oriByteArr[i+1]);
                      i++;
                } else if (oriByteArr[i] == 195) {
                    tempByteArr.writeByte(oriByteArr[i+1] + 64);
                    i++;
                } else {
                    tempByteArr.writeByte(oriByteArr[i]);
                  }

             }

             tempByteArr.position = 0;
             return tempByteArr.readMultiByte(tempByteArr.bytesAvailable,"chinese");
        }

好了,就这些,PHP那边无法给出。
2010.10.27更新
Oct 12
最近在做一个flash的转盘/轮盘游戏,问题很多,起初的中奖方法是用flash来计算得奖几率,只把中奖信息发给后台程序。
这样的程序是不安全的,最后改用由后台程序运算,得出结果来让flash来显示。
但是这样问题又来了,flash得到数据后转盘的指针的指向问题,我就用圆周率来计算,让他精确的指到我定义的12个点上,但是很明显,这样指定后,后台运行中的中奖几率无论怎样都会被平均成1/12,相当的高啊。
目前想的是不让她转动,直接得出结果。
看来得想想别的法子才行。
分页: 1/7 第一页 1 2 3 4 5 6 7 下页 最后页 [ 显示模式: 摘要 | 列表 ]