myGully.com

myGully.com (https://mygully.com/index.php)
-   Programmierung (https://mygully.com/forumdisplay.php?f=67)
-   -   ActionsScript - Flash mp3-player (https://mygully.com/showthread.php?t=2363098)

ChrizBMX 11.07.11 13:56

ActionsScript - Flash mp3-player
 
Servus liebe Community!

Ich bin grad dabei einen mp3-player mit flash zu erstellen. grund dafür war, dass ich versuchen will, die meisten programme auf meinem rechner selbst zu erstellen. deshalb fang ich auch schon mit c und c++ an. aber erst mal braucht man ein bisschen musik, um dabei in die gänge zu kommen ;D

der layer wird mit adobe flash erstellt, das actions***** mit SEPY, einem editor für actions***** speziell (ich weiß, man kann es auch direkt in flash reinschreiben, aber ich leg nun mal wert auf übersichtlichkeit und ordnung...)

leider gibt mit flash beim testen vom player immer folgende meldung aus:

Code:

Fehler beim Öffnen der URL 'file:///C|/Users/Chriz/ActionS*****/MP3Player/undefined'
ich versteh nicht wieso da "undefined" stht... hab schon im internet nachgeschaut, aber keines der lösungen dort trifft zu...

Code der mp3Player.as:

Code:

var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);

var sa:Array = new Array();

var cps:Number = -1;

var pos:Number;

// xml datei mit songs
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
        var nodes:Array = this.firstChild.childNodes;
        for(var i = 0; i < nodes.lenght; i++)
        {
                sa.push(nodes[i].attributes.url);
        }
        playSong();
}

xml.load("songs.xml");

// datei abspielen
function playSong():Void
{
        s = new Sound();
        if(cps == sa.lenght - 1)
        {
                cps = 0;
                s.loadSound(sa[cps], true);
        }else
        {
                s.loadSound(sa[++cps], true);
        }
        playPause.gotoAndStop('pause');
}

// stop
function pauselt():Void
{
        pos = s.position;
        s.stop();
}

// stop
function unPauselt():Void
{
        s.start(pos/1000);
}

// start/stop
playPause.onRollOver = function()
{
        if(this._currentframe == 1) this.gotoAndStop('pauseOver');
        else this.gotoAndStop('playOver');
}

playPause.onRollOut = playPause.onReleaseOutside = function()
{
        if(this._currentframe == 10) this.gotoAndStop('pause');
        else this.gotoAndStop('play');
}

playPause.onRelease = function()
{
        if(this._currentframe == 10)
        {
                this.gotoAndStop('playOver');
                this._parent.pauselt();
        }else
        {
                this.gotoAndStop('pauseOver');
                this._parent.unPauselt();
        }
}

// nächstes lied
next.onRollOver = function()
{
        this.goto.AndStop('nextOver');
}

next.onRollOut = next.onReleaseOutside = function()
{
        this.gotoAndStop('next');
}

next.onRelease = function()
{
        this._parent.playSong();
}

dies wird mit

Code:

#include "mp3Player.as"
in den layer in flash included.

Danke schonmal im voraus!

ChrizBMX 14.07.11 18:12

hat sich zum glück schon erledigt, hat ein stop(); gefehlt...


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:44 Uhr.

Powered by vBulletin® (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.