PHP documentor for Flash ActionScript
| From: | Marcos Neves | Date: | Thu, 11 Sep 2003 20:42:23 +0000 |
| Subject: | PHP documentor for Flash ActionScript | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-21410@lists.php.net to get a copy of this message | ||
Macromedia release the new Macromedia Flash 2004. Looking at the code, is
almost the same as java. What about the possible of PHPdocumentor support
Flash too?
Here is a sample of a class in actionscript 2:
/* ========== ========== ========== ========== ==========
Implementa uma matriz de duas dimensões
onde o ponto inicial é 0,0
========== ========== ========== ========== ========== */
class Matriz2d {
// {{{ properties
// largura da matriz
// @var Number
// @access private
private var _w:Number;
// altura da matriz
// @var Number
// @access private
private var _h:Number;
// vetor linear interno
// @var Array
// @access private
private var _v:Array;
// }}}
// {{{ constructor
// Constructor. Inicializa o vetor interno e preenche com 0
// @param Number w largura da matriz
// @param Number h altura da matriz
// @access public
// @return void
function Matriz2d(w:Number, h:Number) {
_w = w == undefined ? 10 : w;
_h = h == undefined ? 10 : h;
_v = new Array(_w*_h);
fill(0);
}
// }}}
// {{{ fill()
// preenche o vetor com o valor indicado
// @param Number valor
// @param Number h altura da matriz
// @access public
// @return void
function fill(valor:Number) {
for (var i = 0; i<_w*_h; i++) {
_v[i] = 0;
}
}
// {{{ get()
// retorna a largura da matriz
// @access public
// @return Number
function get w():Number {
return _w;
}
// }}}
// {{{ get()
// retorna a altura da matriz
// @access public
// @return Number
function get h():Number {
return _h;
}
// }}}
// {{{ set()
// seta a largura da matriz
// @param Number w
// @access public
function set w(w:Number) {
if (w>0) {
_w = w;
} else {
throw new Error("w não pode ser 0");
}
}
// }}}
// {{{ set()
// seta a altura da matriz
// @param Number h
// @access public
function set h(h):Number {
if (h>0) {
_h = h;
} else {
throw new Error("h não pode ser 0");
}
}
// }}}
// {{{ set()
// seta o valor para a posição x,y
// @param Number x posição x na matriz
// @param Number y posição y na matriz
// @param Number valor valor para a posicao x,y na matriz
// @access public
function set(x:Number, y:Number, valor:Number) {
testRange(x, y);
_v[y*_w+x] = valor;
}
// }}}
// {{{ get()
// retorna o valor da posição x,y
// @param Number x posição x na matriz
// @param Number y posição y na matriz
// @access public
// @return mixed
function get(x:Number, y:Number) {
testRange(x, y);
return _v[y*_w+x];
}
// }}}
// {{{ testRange()
// testa se existe o valor tentado ser acessado
// @param Number x posição x na matriz
// @param Number y posição y na matriz
// @access private
private function testRange(x:Number, y:Number) {
if (x>=_w || x<0) {
throw new Error("índice x: "+x+" fora do escopo _w de 0 até "+(_w-1));
}
if (y>=_h || y<0) {
throw new Error("índice y: "+h+" fora do escopo _h de 0 até "+(_h-1));
}
}
// }}}
}