2014-11-24 48 views
0

我正在制作将放在Google广告网络上的横幅。但是,Google不接受在代码中使用math.random的广告。取代Google广告(Flash AS2)中的“Math.random”?

我发现了几个代码,但它不起作用。我发现的最相关的是这个,但仍然没有对我工作 http://wondergiant.com/2013/03/random-without-math-random/

任何人都可以帮助我在这如何在AS2上工作?

以下是原帖:

var pressed = false; 

    var go = function() { 

    width = 300; 
    height = 200; 
    max_snowsize = 20; 
    snowflakes = 15; 


for (i=0; i<snowflakes; i++) { 

    t = attachMovie("snow", "snow"+i, i); 
    t._alpha = 40+Math.random()*60; 
    t._x = -(width/2)+Math.random()*(1.5*width); 
    t._y = -(height/2)+Math.random()*(1.5*height); 
    t._xscale = t._yscale=50+Math.random()*(max_snowsize*10); 
    t.k = 1+Math.random()*2; 
    t.wind = -1.5+Math.random()*(1.4*3); 
    t.onEnterFrame = mover; 
} 
    }; 


    mover = function() { 
this._y += this.k; 
this._x += this.wind; 
if (this._y>height+10) { 
    this._y = -20; 
} 
if (this._x>width+20) { 
    this._x = -(width/2)+Math.random()*(1.5*width); 
    this._y = -20; 
} else if (this._x<-20) { 
    this._x = -(width/2)+Math.random()*(1.5*width); 
    this._y = -20; 
} 

if(pressed){ 
    this._alpha -= 1; 
} 
    } 

    // start snow 

    go();   
+0

不是'Google'在代码中接受'math.random'吗? – helloflash 2014-11-24 16:47:54

+0

不幸的是Google不接受这段代码,他们也没有说明原因。 – Button 2014-11-25 01:32:24

回答

0

如果你能找到一种方式来获得当前时间在这面旗帜,使用时间值作为种子来运行你的自定义算法。只有当你得到随机种子,甚至可以获得任何信息,页面浏览量,在线用户,系统处理器使用率(所有这些访问都是受限制的,我相信。 AS3),但OUH有捕获用户滚轮的使用方式ü可能找到一些孔也许:)

  1. sys

- 一个很好的种子,我相信,或者至少鼠标悬停事件可能是一种岸上的种子。