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

    AS3 listener in swf esterno non funziona.

    io ho una serie di swf che vengono caricati uno dentro l'altro... con questo ordine:

    swfgenerale che carica swf1
    swf1 carica swf2 all'interno di se.

    in swf2 ho questo codice che da solo funziona, cioè se lancio l'swf2 da solo il codice funziona.

    se invece viene caricato da swf1 secondo l'ordine di cui sopra, non funziona più. come mai? come risolvo?

    Codice PHP:
    stage.addEventListener(KeyboardEvent.KEY_DOWNgotostreet);
    stage.addEventListener(KeyboardEvent.KEY_UPstopstreet);

    function 
    stopstreet(event:KeyboardEvent):void{
        
    trace("hai rilasciato il tasto:"+event.keyCode);
    }

    function 
    gotostreet(event:KeyboardEvent):void {
        
    trace("You pressed key: "+event.keyCode);    

    Ho provato a scrivere il tutto con this come da esempio sottostante... ma nemmeo funziona... e anzi così nemmeno se lancio l'swf2 da solo...
    Codice PHP:
    this.addEventListener(KeyboardEvent.KEY_DOWNgotostreet);
    this.addEventListener(KeyboardEvent.KEY_UPstopstreet);

    function 
    stopstreet(event:KeyboardEvent):void{
        
    trace("hai rilasciato il tasto:"+event.keyCode);
    }

    function 
    gotostreet(event:KeyboardEvent):void {
        
    trace("You pressed key: "+event.keyCode);    

    Rey
    La vita è un panaro, non sai mai quello che ti esce!
    photorealistic 3D rendering and animations and WEB Design

  2. #2
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    Prova così:

    Codice PHP:
    if (stageinit();
    else 
    addEventListener(Event.ADDED_TO_STAGEinit);

    function 
    init (evt:Event=null):void {
        
    removeEventListener(Event.ADDED_TO_STAGEinit);
        
    stage.addEventListener(KeyboardEvent.KEY_DOWNgotostreet);
        
    stage.addEventListener(KeyboardEvent.KEY_UPstopstreet);
    }

    function 
    stopstreet(event:KeyboardEvent):void{
        
    trace("hai rilasciato il tasto:"+event.keyCode);
    }

    function 
    gotostreet(event:KeyboardEvent):void {
        
    trace("You pressed key: "+event.keyCode);    


  3. #3
    mitico!! grazie!!!
    Rey
    La vita è un panaro, non sai mai quello che ti esce!
    photorealistic 3D rendering and animations and WEB Design

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 © 2024 vBulletin Solutions, Inc. All rights reserved.