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

    Richiamare una MovieClip con un pulsante e MouseEvent

    Buona Sera ragazzi sono alle prime armi con l'ActionScipt
    Sto cercando di creare un menu prodotti.
    Inizialmente ho creato una movie clip Maschera
    che dovrebbe essere richiamata quando schiaccio il bottone
    del prodotto.
    E' una clip contenente una forma che fa da transizione tra un prodotto e l'altro!

    Al primo frame ho dato uno

    stop();

    al10'

    parent.gotoAndStop(parent.Sezione);


    Nella linea temporale ho creato sei livelli
    • 2 dedicati alla maschera
    • uno dedicato alle movieclip che sono i miei prodotti e devono comparire
    nello stage.

    A ogni BTN corrispondete ai prodotti ho dato un numero da (1 a 19).
    Premetto che questo codice l'avevo utilizzato per richiamare testi dinamici e (FUNZIONAVA) ora il mio intento è riutilizzarlo per richiamare le singole movie clip nominate contenenti i prodotti.

    Nel livello azioni sulla root ho scritto così:


    stop();
    //* questo stop non funziona perchè appena faccio command+invio le clip vanno ininterrottamente

    var Sezione:Number

    function Change_Prodotto1 (evt:MouseEvent):void{
    Sezione = 1;
    Maschera.play();

    //gotoAndStop(1);
    }

    BTN1.addEventListener(MouseEvent.CLICK, Change_Prodotto1);

    function Change_Prodotto1(evt:MouseEvent):void{
    Sezione = 1;
    Maschera.play();
    //gotoAndStop(1);
    }

    BTN2.addEventListener(MouseEvent.CLICK, Change_Prodotto2);

    function Change_Prodotto3(evt:MouseEvent):void{
    Sezione = 2;
    Maschera.play();
    //gotoAndStop(2);

    }

    BTN3.addEventListener(MouseEvent.CLICK, Change_Prodotto3);

    function Change_Prodotto4(evt:MouseEvent):void{
    Sezione = 3;
    Maschera.play();
    //gotoAndStop(3);

    }

    BTN4.addEventListener(MouseEvent.CLICK, Change_Prodotto4);

    function Change_Prodotto5(evt:MouseEvent):void{
    Sezione = 4;
    Maschera.play();
    //gotoAndStop(4);

    }

    BTN5.addEventListener(MouseEvent.CLICK, Change_Prodotto5);

    function Change_Prodotto6(evt:MouseEvent):void{
    Sezione = 5;
    Maschera.play();
    //gotoAndStop(5);

    }

    BTN6.addEventListener(MouseEvent.CLICK, Change_Prodotto6);

    function Change_Prodotto7(evt:MouseEvent):void{
    Sezione = 6;
    Maschera.play();
    //gotoAndStop(6);

    }

    BTN7.addEventListener(MouseEvent.CLICK, Change_Prodotto7);

    function Change_Prodotto8(evt:MouseEvent):void{
    Sezione = 7;
    Maschera.play();
    //gotoAndStop(7);

    }

    BTN8.addEventListener(MouseEvent.CLICK, Change_Prodotto8);

    function Change_Prodotto9(evt:MouseEvent):void{
    Sezione = 8;
    Maschera.play();
    //gotoAndStop(8);

    }

    BTN9.addEventListener(MouseEvent.CLICK, Change_Prodotto9);

    function Change_Prodotto10(evt:MouseEvent):void{
    Sezione = 9;
    Maschera.play();
    //gotoAndStop(9);

    }

    BTN7.addEventListener(MouseEvent.CLICK, Change_Prodotto10);

    function Change_Prodotto11(evt:MouseEvent):void{
    Sezione = 10;
    Maschera.play();
    //gotoAndStop(10);

    }

    BTN10.addEventListener(MouseEvent.CLICK, Change_Prodotto11);

    function Change_Prodotto12(evt:MouseEvent):void{
    Sezione = 11;
    Maschera.play();
    //gotoAndStop(11);

    }

    BTN11.addEventListener(MouseEvent.CLICK, Change_Prodotto12);

    function Change_Prodotto13(evt:MouseEvent):void{
    Sezione = 12;
    Maschera.play();
    //gotoAndStop(12);

    }

    BTN12.addEventListener(MouseEvent.CLICK, Change_Prodotto13);

    function Change_Prodotto14(evt:MouseEvent):void{
    Sezione = 13;
    Maschera.play();
    //gotoAndStop(13);

    }

    BTN13.addEventListener(MouseEvent.CLICK, Change_Prodotto14);

    function Change_Prodotto15(evt:MouseEvent):void{
    Sezione = 14;
    Maschera.play();
    //gotoAndStop(14);

    }

    BTN14.addEventListener(MouseEvent.CLICK, Change_Prodotto15);

    function Change_Prodotto16(evt:MouseEvent):void{
    Sezione = 15;
    Maschera.play();
    //gotoAndStop(15);

    }

    BTN15.addEventListener(MouseEvent.CLICK, Change_Prodotto16);

    function Change_Prodotto17(evt:MouseEvent):void{
    Sezione = 16;
    Maschera.play();
    //gotoAndStop(16);

    }

    BTN16.addEventListener(MouseEvent.CLICK, Change_Prodotto17);

    function Change_Prodotto18(evt:MouseEvent):void{
    Sezione = 17;
    Maschera.play();
    //gotoAndStop(17);

    }

    BTN17.addEventListener(MouseEvent.CLICK, Change_Prodotto18);

    function Change_Prodotto19(evt:MouseEvent):void{
    Sezione = 18;
    Maschera.play();
    //gotoAndStop(18);

    }

    BTN18.addEventListener(MouseEvent.CLICK, Change_Prodotto19);

    function Change_Prodotto20(evt:MouseEvent):void{
    Sezione = 19;
    Maschera.play();
    //gotoAndStop(19);

    }

    BTN19.addEventListener(MouseEvent.CLICK, Change_Prodotto20);

    function Change_Prodotto21(evt:MouseEvent):void{
    Sezione = 20;
    Maschera.play();
    //gotoAndStop(20);

    }


    Se mi potete aiutare Vi ringrazio anticipatamente!
    CIAO!!!

  2. #2
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    Fammi capire, in pratica quello che chiedi è di comprimere un po' il codice, in modo da usare una sola funzione per tutti i pulsanti?
    Se è come dico, dovresti dirmi se i pulsanti sono dei "SimpleButton" o dei "MovieClip".

  3. #3
    Grazie and80!
    In pratica è un simbolo Pulsante ripetuto.
    Ognuno ha un nome istanza (BTN1,BTN2,BTN3,BTN4...)
    e vorrei che al suo:

    on(release)

    richiami l'evento che ho messo al frame 10' dell'animzione maschetata di transizione

    parent.gotoAndStop(parent.Sezione)

    e mi mandi alla Movie Clip relativa ad esso.


    BTN1 => Prodotto1
    BTN2 => Prodotto2
    ecc...

    Grazie per avermi risposto alla segnalazione
    sono felice di aver trovato un forum così!
    Mille Grazie Ancora!
    :-)

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.