Visualizzazione dei risultati da 1 a 10 su 10

Discussione: onMotionFinished error

  1. #1

    onMotionFinished error

    scusate ma io proprio non riesco a trovare l'errore... non mi funziona il secondo Tween!!
    mi date un occhiata?

    MovieClip.prototype.rettDesMove = function (pos:Number, alt:Number) {
    var tx = new Tween (this, "_x", Strong.easeOut, this._x, pos, 30, false);
    tx.onMotionFinished = function () {
    var ry = new Tween (this, "_height", Strong.easeOut, this._height, alt, 30, false);
    };
    };

    grazieeeeeee!!!!

  2. #2
    Utente di HTML.it L'avatar di gobbo89
    Registrato dal
    Jun 2006
    Messaggi
    816
    Problema di percorsi...
    Così dovrebbe andare:

    codice:
    MovieClip.prototype.rettDesMove = function(pos:Number, alt:Number) {
    	var path:MovieClip = this;
    	var tx = new Tween(path, "_x", Strong.easeOut, path._x, pos, 30, false);
    	tx.onMotionFinished = function() {
    		var ry = new Tween(path, "_height", Strong.easeOut, path._height, alt, 30, false);
    	};
    };

  3. #3
    non riesco proprio a capire perche' non funziona...
    eppure mi restituisce la grandezza giusta nel trace

    MovieClip.prototype.barraBotMove = function (pos:Number, larg:Number) {
    var path:MovieClip = this;
    var ty:Tween = new Tween (path, "_y", Strong.easeOut, path._y, pos, 30, false);
    ty.onMotionFinished = function () {
    trace (larg);
    var rx = new Tween (path, "_width", Strong.easeOut, path._width, larg, 30, false);
    };
    };


  4. #4
    Utente di HTML.it L'avatar di gobbo89
    Registrato dal
    Jun 2006
    Messaggi
    816
    Molto strano.
    Facendo copia incolla del tuo codice, dopo aver aggiunto le importazioni delle classi [in rosso], tutto funziona correttamente.

    codice:
    import mx.transitions.*;
    import mx.transitions.easign.*;
    MovieClip.prototype.barraBotMove = function(pos:Number, larg:Number) {
    	var path:MovieClip = this;
    	var ty:Tween = new Tween(path, "_y", Strong.easeOut, path._y, pos, 30, false);
    	ty.onMotionFinished = function() {
    		trace(larg);
    		var rx = new Tween(path, "_width", Strong.easeOut, path._width, larg, 30, false);
    	};
    };
    mioClip.barraBotMove(0, 500);

  5. #5
    non mi funzionava perche' avevo diverse funzioni... se commento una allora l'atra va:

    MovieClip.prototype.barraBotMove = function (pos:Number, larg:Number) {
    var path:MovieClip = this;
    var ty:Tween = new Tween (path, "_y", Strong.easeOut, path._y, pos, 30, false);
    ty.onMotionFinished = function () {
    trace (larg);
    var rx = new Tween (path, "_width", Strong.easeOut, path._width, larg, 30, false);
    };
    };
    /*MovieClip.prototype.rettDesMove = function (pos:Number, alt:Number) {
    var path:MovieClip = this;
    var tx = new Tween (path, "_x", Strong.easeOut, this._x, pos, 30, false);
    tx.onMotionFinished = function () {
    var ry = new Tween (path, "_height", Strong.easeOut, this._height, alt, 30, false);
    };
    };*/

    come posso fare per farle andare tutte e due?
    grazie!

  6. #6
    Utente di HTML.it L'avatar di gobbo89
    Registrato dal
    Jun 2006
    Messaggi
    816
    Originariamente inviato da zoc
    come posso fare per farle andare tutte e due?
    grazie!
    Intendi per applicarle contemporaneamente allo stesso clip?

  7. #7
    no a due clip differenti....
    ho visto che chiamando una variabile path2 il problema e' risolto....
    ma non stava dentro alla funzione e basta? non e' mica una variabile globale no?

  8. #8
    Utente di HTML.it L'avatar di gobbo89
    Registrato dal
    Jun 2006
    Messaggi
    816
    Ho notato adesso che nel tuo penultimo messaggio la funzione rettDesMove aveva un errore:
    codice:
    MovieClip.prototype.rettDesMove = function(pos:Number, alt:Number) {
    	var path:MovieClip = this;
    	var tx = new Tween(path, "_x", Strong.easeOut, this._x, pos, 30, false);
    	tx.onMotionFinished = function() {
    		var ry = new Tween(path, "_height", Strong.easeOut, this._height, alt, 30, false);
    	};
    };
    Va sostituito con:
    codice:
    MovieClip.prototype.rettDesMove = function(pos:Number, alt:Number) {
    	var path:MovieClip = this;
    	var tx = new Tween(path, "_x", Strong.easeOut, this._x, pos, 30, false);
    	tx.onMotionFinished = function() {
    		var ry = new Tween(path, "_height", Strong.easeOut, path._height, alt, 30, false);
    	};
    };
    Per quanto riguarda l'applicazione a due clip, ho fatto una prova. I nomi istanza sono mioClip1 e mioClip2. Il codice usato è il seguente:
    codice:
    import mx.transitions.*;
    import mx.transitions.easign.*;
    MovieClip.prototype.barraBotMove = function(pos:Number, larg:Number) {
    	var path:MovieClip = this;
    	var ty:Tween = new Tween(path, "_y", Strong.easeOut, path._y, pos, 30, false);
    	ty.onMotionFinished = function() {
    		trace(larg);
    		var rx = new Tween(path, "_width", Strong.easeOut, path._width, larg, 30, false);
    	};
    };
    MovieClip.prototype.rettDesMove = function(pos:Number, alt:Number) {
    	var path:MovieClip = this;
    	var tx = new Tween(path, "_x", Strong.easeOut, this._x, pos, 30, false);
    	tx.onMotionFinished = function() {
    		var ry = new Tween(path, "_height", Strong.easeOut, path._height, alt, 30, false);
    	};
    };
    mioClip1.barraBotMove(0, 500);
    mioClip2.rettDesMove(0, 500);
    A me funziona tutto perfettamente

  9. #9
    grazie mille gobbo sei stato gentilissimo..... ora vedo di capire quale stupidata ho fatto...

  10. #10
    Utente di HTML.it L'avatar di gobbo89
    Registrato dal
    Jun 2006
    Messaggi
    816
    Va bene, figurati.
    Se hai altri problemi posta

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.