Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [MX] aiuto su prototype

    Ciao a tutti ho la necessità di trasformare una funzione che utilizzo spesso in un prototype, chi mi puo' aiutare?

    codice:
    _root.barra_mc.fine = Math.round(_root.barra_mc._x);
    var accellerazione = 1.1;
    var inerzia = 3;
    _root.barra_mc.spostamento = 0;
    
    function movClip() {
    	this.spostamento = (this.spostamento+(this.fine-this._x)/_root.accellerazione)/_root.inerzia;
    	this._x += this.spostamento;
    }
    function barra(quanto) {
    	_root.barra_mc.fine = quanto;
    }
    _root.barra_mc.onEnterFrame = movClip;
    Vorrei creare un prototype per tutti i clip presenti nella _root, ma non mi è ancora ben chiaro come fare ...

    avevo pensato a qualcosa tipo

    codice:
    _root.movieclip.prototype.onEnterFrame = function() ...
    sono sulla strada giusta?

  2. #2
    credo di si

    una roba kosì

    codice:
    MovieClip.prototype.onEnterFrame= function() {
    this.useHandCursor = 0;
    };
    funziona su tutti i mc

  3. #3
    ci provo io

    codice:
    MovieClip.prototype.slowSetProperty = function(prop, newVal, b)
    {
    
    	this[prop + "_bb"] = (b == undefined) ? 5 : b;
    	this[prop + "_newVal"] = newVal;
    	clearInterval(this[prop + "_interval"])
    	this[prop + "_interval"] = setInterval(this, "slowChangeProperty", 20, prop);
    };
    MovieClip.prototype.slowChangeProperty = function(prop)
    {
    	this[prop] += (this[prop + "_newVal"] - this[prop]) / this[prop + "_bb"];
    	if (Math.abs(this[prop] - this[prop + "_newVal"]) < .01) {
    		this[prop] = this[prop + "_newVal"];
    		clearInterval(this[prop + "_interval"]);
    	}
    };
    mioClip.slowSetProperty("_x", 100);
    mioClip.slowSetProperty("_xScale", 200);

    stupendo chiaramente by Neg

  4. #4
    si si si funziona benissimo ...

    adesso mi cimento in un altro prototype, quello sulla funzione menu di negative ...

    poi posto.

  5. #5


    vai raffaeu :sexpulp:

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.