wenn sound fertig, dann zurück auf play button [Flash 10]
| Beiträge: 5 Registriert: Mar 2010
| 06.03.2010, 19:17
Hallo zusammen
Ich versuche seit Tagen das Script meines SoundButtons so zu ändern, dass wenn der Song fertig gespielt ist, der Button zurück auf seinen Normalzustand ändert.
Bis jetzt bleibt er im Playmodus.
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | package
{
import flash.media.SoundChannel;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.media.Sound;
public class SoundButton extends MovieClip
{
public var sound:Sound;
private var _channel:SoundChannel = new SoundChannel();
public function SoundButton()
{
stop();
useHandCursor = true;
addEventListener(MouseEvent.CLICK, onMouseClick, false, 0, true);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver, false,0, true);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut, false,0, true);
}
private function onMouseOut(event:MouseEvent):void
{
if (currentLabel == "playing") gotoAndStop("playing")
if (currentLabel == "normal") gotoAndStop("normal")
if (currentLabel == "hover") gotoAndStop("normal")
}
private function onMouseOver(event:MouseEvent):void
{
if (currentLabel == "playing") gotoAndStop("playing")
if (currentLabel == "normal") gotoAndStop("hover")
if (currentLabel == "hover") gotoAndStop("hover")
}
private function onMouseClick(event:MouseEvent):void
{
if (currentLabel == "hover" || currentLabel =="normal")
{
// play
gotoAndStop("playing");
_channel.stop();
_channel = sound.play(0, 1);
// stop all sounds
var n:int = parent.numChildren, i:int = 0, sibling:DisplayObject;
for (i;i < n;i++)
{
sibling = parent.getChildAt(i);
if (sibling != this && sibling is SoundButton) (sibling as SoundButton).reset();
}
}
else
{
reset();
}
}
public function reset():void
{
gotoAndStop(1);
_channel.stop();
}
}
}
|
Bitte helft mir, ich bin ganz neu im Flash und völlig verzweifelt! | |
| Ähnliche Beiträge zum Thema | 13.09.2022 - Rennier 28.07.2022 - TateBauch |
|
Flashhilfe.de Flash Platform Tipps & Tutorials Flash Platform Andere Programmiersprachen Jobangebote Diskussionen
Flashhilfe News
Regeln & Bedingungen
|