Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2008
    Messaggi
    21

    Problema Codice Player musicale Errore 1152

    Ciao a tutti.
    è da stamattina che


    Ho recuperato un player che utilizzavo su un vecchio sito per un altro sito web.
    Il problema che ho è questo:

    Scena 1, livello ‘FlashAICB’, fotogramma 1, riga 41 1152: rilevato un conflitto nella definizione ereditata flash.display:MovieClip.isPlaying nello spazio dei nomi public

    La riga 41 è quella in grassetto, quindi la riga 3 qui sotto.

    Mi aiutate? Grazie a chi interverrà! Sono disperato!
    codice:
    //Player Musicalevar musicPiece:Sound = new Sound(new URLRequest("010.MP3")); 
    var mySoundChannel:SoundChannel; 
    var isPlaying:Boolean = false; 
    var pos:Number = 0; 
    
    
    function playMusic():void { 
         if (!isPlaying) {  
              mySoundChannel = musicPiece.play(pos);  
              mySoundChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); 
              isPlaying = true;  
         }  
    }
    
    
    function play_(event:MouseEvent):void {
         playMusic();
    }
    
    
    playMusic();
    
    
    mySoundChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
    
    
    function soundCompleteHandler(e:Event):void { 
         pos = 0;
         isPlaying = false;
         playMusic(); 
    }
    
    
    
    
    // First button we will make is a play button, add an eventlistener.
    play_btn.addEventListener(MouseEvent.CLICK, play_);
    
    
    // The pause button, here we will use the pos variable we made earlier.
    pause_btn.addEventListener(MouseEvent.CLICK, pause_);
    
    
    function pause_(event:Event):void {
    // if the music is player, save the current time and stop the playing.
    if (isPlaying) {
    pos = mySoundChannel.position;
    mySoundChannel.stop();
    isPlaying = false;
    }
    }
    
    
    // Now the final button is the stop button, allmost thet same as pause
    stop_btn.addEventListener(MouseEvent.CLICK, stop_);
    
    
    function stop_(event:Event):void {
    // First we check if there is anything to stop then make it stop, and reset the pos variable to 0 (start time)
    if (mySoundChannel != null) {
    mySoundChannel.stop();
    pos = 0;
    isPlaying = false;
    }
    }
    
    
    // this is a bit complicated, but I will try to explain anyway.
    // first we make a rectangle and set its width to 100.
    var rectangle:Rectangle = new Rectangle(0,0,100,0);
    
    
    // then we need a varible to check if the handle is being dragged.
    var dragging:Boolean = false;
    
    
    // the eventlistener for startdragging
    volume_mc.mySlider_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
    function startDragging(event:Event):void {
    
    
    // here we tell flash the margin on where it should be able to drag, (remember 100 pixels back and forth)
    volume_mc.mySlider_mc.startDrag(false,rectangle);
    dragging = true;
    
    
    // This is very important, an eventlistener so we can change the volume, not only make it look good.
    volume_mc.mySlider_mc.addEventListener(Event.ENTER_FRAME, adjustVolume);
    }
    
    
    // well here is the adjust volume function, its not that complicated
    function adjustVolume(event:Event):void {
    
    
    // we make a variable to calculate the volume from the slider handle position and divide it by 100
    var myVol:Number = volume_mc.mySlider_mc.x / 100;
    // then we set it with the mySoundTransform
    var mySoundTransform:SoundTransform = new SoundTransform(myVol);
    if (mySoundChannel != null) {
    mySoundChannel.soundTransform = mySoundTransform;
    }
    }
    
    
    // and of cause the stop draggin function, I dont feel the need to explain it.
    stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
    function stopDragging(event:Event):void {
    if (dragging) {
    dragging = false;
    volume_mc.mySlider_mc.stopDrag();
    }
    
    }


  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2008
    Messaggi
    21
    Nessuno mi può aiutare?

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Prova ad upare il player.

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2008
    Messaggi
    21
    Quote Originariamente inviata da randi Visualizza il messaggio
    Prova ad upare il player.

    Ciao intanto grazie mille per la risposta.

    ora: cosa devo uppare?

  5. #5
    Utente di HTML.it
    Registrato dal
    Feb 2008
    Messaggi
    21
    Quote Originariamente inviata da randi Visualizza il messaggio
    Prova ad upare il player.
    Ecco qui il player. Grazie mille per ora!
    File allegati File allegati

  6. #6
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Prova ora.Player2.rar

  7. #7
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Oltre che nel modo del mio link (cambiando isPlalyng con un altro nome) puoi risolvere il conflitto mettendo tutto il codice dentro una funzione così...
    codice:
    function Player_Musicale()
    {
    var musicPiece:Sound = new Sound(new URLRequest("010.MP3")); 
    var mySoundChannel:SoundChannel; 
    var isPlaying:Boolean = false; 
    var pos:Number = 0; 
    
    function playMusic():void { 
         if (!isPlaying) {  
              mySoundChannel = musicPiece.play(pos);  
              mySoundChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); 
              isPlaying = true;  
         }  
    }
    
    function play_(event:MouseEvent):void {
         playMusic();
    }
    
    playMusic();
    
    mySoundChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
    
    function soundCompleteHandler(e:Event):void { 
         pos = 0;
         isPlaying = false;
         playMusic(); 
    }
    
    
    // First button we will make is a play button, add an eventlistener.
    play_btn.addEventListener(MouseEvent.CLICK, play_);
    
    // The pause button, here we will use the pos variable we made earlier.
    pause_btn.addEventListener(MouseEvent.CLICK, pause_);
    
    function pause_(event:Event):void {
    // if the music is player, save the current time and stop the playing.
    if (isPlaying) {
    pos = mySoundChannel.position;
    mySoundChannel.stop();
    isPlaying = false;
    }
    }
    
    // Now the final button is the stop button, allmost thet same as pause
    stop_btn.addEventListener(MouseEvent.CLICK, stop_);
    
    function stop_(event:Event):void {
    // First we check if there is anything to stop then make it stop, and reset the pos variable to 0 (start time)
    if (mySoundChannel != null) {
    mySoundChannel.stop();
    pos = 0;
    isPlaying = false;
    }
    }
    
    // this is a bit complicated, but I will try to explain anyway.
    // first we make a rectangle and set its width to 100.
    var rectangle:Rectangle = new Rectangle(0,0,100,0);
    
    // then we need a varible to check if the handle is being dragged.
    var dragging:Boolean = false;
    
    // the eventlistener for startdragging
    volume_mc.mySlider_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
    function startDragging(event:Event):void {
    
    // here we tell flash the margin on where it should be able to drag, (remember 100 pixels back and forth)
    volume_mc.mySlider_mc.startDrag(false,rectangle);
    dragging = true;
    
    // This is very important, an eventlistener so we can change the volume, not only make it look good.
    volume_mc.mySlider_mc.addEventListener(Event.ENTER_FRAME, adjustVolume);
    }
    
    // well here is the adjust volume function, its not that complicated
    function adjustVolume(event:Event):void {
    
    // we make a variable to calculate the volume from the slider handle position and divide it by 100
    var myVol:Number = volume_mc.mySlider_mc.x / 100;
    // then we set it with the mySoundTransform
    var mySoundTransform:SoundTransform = new SoundTransform(myVol);
    if (mySoundChannel != null) {
    mySoundChannel.soundTransform = mySoundTransform;
    }
    }
    
    // and of cause the stop draggin function, I dont feel the need to explain it.
    stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
    function stopDragging(event:Event):void {
    if (dragging) {
    dragging = false;
    volume_mc.mySlider_mc.stopDrag();
    }
    }
    }
    Player_Musicale()

  8. #8
    Utente di HTML.it
    Registrato dal
    Feb 2008
    Messaggi
    21
    Guarda, funziona tutto egregiamente. Grazie mille davvero! Molto gentile.

  9. #9
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930

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.