Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Audio player

  1. #1

    Audio player

    Ciao,sono nuovo del forum e inizio con una domanda che per la maggior parte di voi sarà sicuramente di una banalità esasperante: devo creare un player mp3 in AS3 in cui posso ascoltare più canzoni...
    ne ho gia preparato uno con una sola canzone ma non riesco a far andare le altre...HELP

    ecco il codice del player che ho già fatto

    codice:
    var music:Sound = new Sound(new URLRequest("song1.mp3")); var sc:SoundChannel; var isPlaying:Boolean = false;  stop_btn.addEventListener(MouseEvent.CLICK, stopMusic);  function stopMusic(e:Event):void { 	if(sc != null) 	{ 		sc.stop(); 		isPlaying = false; 	} }  play_btn.addEventListener(MouseEvent.CLICK, playMusic);  function playMusic(e:Event):void { 	if (!isPlaying) 	{ 		sc = music.play(); 		isPlaying = true; 	} }  //---VOLUME SLIDER---// var dragging:Boolean = false; var rectangle:Rectangle = new Rectangle(0,0,100,0); volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragIt); stage.addEventListener(MouseEvent.MOUSE_UP, dropIt);  function dragIt(e:Event):void { 	volume_mc.slider_mc.startDrag(false,rectangle); 	dragging = true; 	volume_mc.slider_mc.addEventListener(Event.ENTER_FRAME, adjustVolume); }  function dropIt(e:Event):void { 	if (dragging) 	{ 		volume_mc.slider_mc.stopDrag(); 		dragging = false; 	} }  function adjustVolume(e:Event):void { 	var vol:Number = volume_mc.slider_mc.x / 100; 	var st:SoundTransform = new SoundTransform(vol); 	if (sc != null) 	{ 		sc.soundTransform = st; 	} }

  2. #2
    scusate il codice l'ho inserito malissimo



    var music:Sound = new Sound(new URLRequest("song1.mp3"));
    var sc:SoundChannel;
    var isPlaying:Boolean = false;

    stop_btn.addEventListener(MouseEvent.CLICK, stopMusic);

    function stopMusic(e:Event):void
    {
    if(sc != null)
    {
    sc.stop();
    isPlaying = false;
    }
    }

    play_btn.addEventListener(MouseEvent.CLICK, playMusic);

    function playMusic(e:Event):void
    {
    if (!isPlaying)
    {
    sc = music.play();
    isPlaying = true;
    }
    }

    //---VOLUME SLIDER---//
    var dragging:Boolean = false;
    var rectangle:Rectangle = new Rectangle(0,0,100,0);
    volume_mc.slider_mc.addEventListener(MouseEvent.MO USE_DOWN, dragIt);
    stage.addEventListener(MouseEvent.MOUSE_UP, dropIt);

    function dragIt(e:Event):void
    {
    volume_mc.slider_mc.startDrag(false,rectangle);
    dragging = true;
    volume_mc.slider_mc.addEventListener(Event.ENTER_F RAME, adjustVolume);
    }

    function dropIt(e:Event):void
    {
    if (dragging)
    {
    volume_mc.slider_mc.stopDrag();
    dragging = false;
    }
    }

    function adjustVolume(e:Event):void
    {
    var vol:Number = volume_mc.slider_mc.x / 100;
    var st:SoundTransform = new SoundTransform(vol);
    if (sc != null)
    {
    sc.soundTransform = st;
    }
    }

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.