frameOver MovieClip prototype          

Clasificado bajo: AS2 (deprecated), Prototipos — drus @ 4:43 pm


Este prototipo crea un marco del grosor y color definidos en sus parámetros sobre el movieClip en que se aplica. También asigna métodos onRollOver y onRollOut a dicho movieClip para escalar el grosor del marco.
Requiere la librería de Laco, Zeh, o similar.
Descargable frameOver prototype

Actionscript:
#include "lmc_tween.as"
MovieClip.prototype.frameOver = function(grosor,color) {
    var over:MovieClip = this.createEmptyMovieClip("over", 1);
    var l:MovieClip = over.createEmptyMovieClip("l", 1);
    var escalax = (this._width+grosor*2)/100*grosor;
    var escalay = this._height/100*grosor*2;
    var w:Number = this._width;
    var h:Number = this._height;
    l.lineStyle(0, 0x000000, 0);
    l.beginFill(color, 100);
    l.moveTo(0, -h/2);
    l.lineTo(grosor, -h/2);
    l.lineTo(grosor, h/2);
    l.lineTo(0, h/2);
    l.lineTo(0, -h/2);
    l.endFill();
    l._y = h/2;
    l._xscale = .1;
    var t:MovieClip = l.duplicateMovieClip("t", 2, {_x:w/2, _y:0, _rotation:90});
    var r:MovieClip = l.duplicateMovieClip("r", 3, {_x:w, _y:h/2, _rotation:180});
    var b:MovieClip = l.duplicateMovieClip("b", 4, {_x:w/2, _y:h, _rotation:270});
    t._yscale = b._yscale=w/h*100;
    this.onRollOver = function() {
        l.tween("_xscale", 100, 1);
        t.tween("_xscale", 100, 1);
        r.tween("_xscale", 100, 1);
        b.tween("_xscale", 100, 1);
    };
    this.onRollOut = function() {
        l.tween("_xscale", .1, .5);
        t.tween("_xscale", .1, .5);
        r.tween("_xscale", .1, .5);
        b.tween("_xscale", .1, .5);
    };
};
//Uso:
obj_mc.frameOver(15,0x666666);




entradilla String prototype          

Clasificado bajo: AS2 (deprecated), Prototipos, String — drus @ 3:32 pm

Prototipo que extrae una subcadena de palabras completas de la cadena sobre la que se aplica.
Útil para crear entradillas de artículos más extensos.

Actionscript:
String.prototype.entradilla = function(ini,fin) {
    var texto= this.substr(ini,fin);
    var palabras_ar = texto.split(" ");
    var entradilla = "";
    for(var i=0; i<(palabras_ar.length-1);i++) {
        entradilla += palabras_ar[i] + " ";
    }
    entradilla = entradilla.substr(0,entradilla.length-1);
    return entradilla;
};




cleanReturns String prototype          

Clasificado bajo: AS2 (deprecated), Prototipos, String — drus @ 3:32 pm

Con este sencillo prototipo eliminamos los molestos y habituales dobles retornos de carro de un archivo de texto externo cargado dinámicamente.

Actionscript:
String.prototype.cleanReturns = function() {
    return this.split("\n\r").join("\n");
};
//Uso:
textbox.text = this.txt.cleanReturns();

Enlaces relacionados: No related posts, | Tags: , , ,



push document.location toSwf          

Clasificado bajo: AS2 (deprecated), Html — drus @ 10:09 pm

Esta función javascript, llamada desde la película flash, empuja la variable "url" con el document.location del navegador a la película identificada como "flash". Muy útil para evaluar parámetros pasados como querys en la url.

JavaScript:
<script language="javascript">
<!--
    function getFlashMovieObject(movieName){
      if (window.document[movieName]) {
        return window.document[movieName];
      }if (navigator.appName.indexOf("Microsoft Internet")==-1) {
        if (document.embeds && document.embeds[movieName])
          return document.embeds[movieName];
      }else{ // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
        return document.getElementById(movieName);
      }
    }
    function flashLoad(){
        var flashMovie = getFlashMovieObject("flash");
        flashMovie.SetVariable("url", document.location);
        flashMovie.Play();
    }
-->
</script>

Actionscript:
//Uso
stop();
getURL("javascript:FlashLoaded()");




Siguiente página »

AS_toolKit | Powered by WordPress | Skinned by Drus Unlimited | RSS Feed | Copyleft