Плеар - започва автоматично, а не искам да е така!

boby7

Registered
Здравейте, може ли някой да ми помогне, като ми каже какво да променя в кода така че, когато се зареди страницата на сайта ми плеара да не тръгва автоматично, а да тръгва когато се натисне play? Това е кода:

// PLAYER CONTROL BUTTONS
//
// Rewind
doRewind = function () {
if (ID>0) {
ID--;
} else {
ID = total-1;
}
doHighlight();
loadTrack();

};
// Pause
doPause = function () {
my_sound.stop();
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);

};
// Play
doPlay = function () {
my_sound.start(my_sound.position/1000);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);

};
// Next track
doForward = function () {
if (ID<total-1) {
ID++;
} else {
ID = 0;
}
doHighlight();
loadTrack();
};
controls_mc.bttnPlay.bttn.onPress = function() {
if (controls_mc.bttnPlay.icon_mc._currentframe == 1) {
doPause();
} else {
doPlay();
}
};
controls_mc.bttnRewind.bttn.onPress = function() {
doRewind();
};
controls_mc.bttnForward.bttn.onPress = function() {
doForward();
};
//
// TRACK HIGHLIGHTING
//
doHighlight = function () {
for (n=0; n<total; n++) {
if (n != ID) {
menu_mc["bttn_mc"+n].gotoAndStop(1);
} else {
menu_mc["bttn_mc"+ID].gotoAndStop(2);
}
}
};
//
// LOAD SOUND
//
var my_sound:Sound = new Sound(this);
my_sound.onLoad = function(success:Boolean) {
if (success) {
totalSeconds = this.duration/1000;
minutes2 = Math.floor(totalSeconds/60);
if (minutes2<10) {
minutes2 = "0"+minutes2;
}
seconds2 = Math.floor(totalSeconds)%60;
if (seconds2<10) {
seconds2 = "0"+seconds2;
}
durationDisplay = minutes2+":"+seconds2;
menu_mc["bttn_mc"+ID].txt_mc.durationDisplay.text = durationDisplay;
}
};
my_sound.onSoundComplete = function() {
doForward();
};
//
// ON MENU PRESS
//
loadTrack = function () {
my_sound.start();
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
my_sound.loadSound(Path[ID], true);
doHighlight();
};
//
// BUILD PLAYER
//
buildPlayer = function () {
for (i=0; i<total; i++) {
// Get track name and path
Title = xmlNode.childNodes.attributes.Title;
Path = xmlNode.childNodes.attributes.Path;
// Build menu
menu_mc.bttn_mc.duplicateMovieClip("bttn_mc"+i, i);
menu_mc["bttn_mc"+i]._y = (menu_mc.bttn_mc._height+1)*i;
menu_mc["bttn_mc"+i].txt_mc.titleDisplay.text = Title;
if (i<9) {
num = "0"+(i+1);
} else {
num = i+1;
}
menu_mc["bttn_mc"+i].num_mc.numDisplay.text = num;
menu_mc["bttn_mc"+i].ID = i;
}
ID = 0;
loadTrack();
menu_mc.bttn_mc._visible = false
};
//
// LOAD XML
//
loadXML = function (loaded) {
if (loaded) {
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
Title = [];
Path = [];
buildPlayer();
} else {
trace("Error loading XML");
}
};
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("audioplayer/playlist.xml");
stop();
 
furaj1 каза:
дай кода на страницата където е embed или object кода!



//
// INITIAL SETTINGS
//
stageW = 800;
stageH = 600;
Stage.scaleMode = "noScale";
Stage.align = "TL";
preloaderXML_mc._visible = false;
nav_mc._visible = false;
footer_mc._visible = false;
soundControl_mc._visible = false;
holder_mc._alpha = 0;
import mx.transitions.Tween;
import mx.transitions.easing.*;
//
// STAGE ALIGN
//
stageListener = new Object(this);
Stage.addListener(stageListener);
alignObjects = function () {
// Align bg
scalebg_mc();
// Align footer
footer_mc._y = Stage.height-footer_mc._height;
footer_mc.bg_mc._width = Stage.width;
// Align fullscreen
fullscreen_mc._x = Stage.width-30;
fullscreen_mc._y = Stage.height-30;
// Align soundcontrol
soundControl_mc._x = Math.round(Stage.width-150);
soundControl_mc._y = Math.round(Stage.height-30);
// Align nav
nav_mc.bg_mc._height = Stage.height-footer_mc._height;
nav_mc.txt_mc._y = (Stage.height-nav_mc.txt_mc._height)/2;
// Align holder
holder_mc._x = Math.round((Stage.width-stageW)/2);
holder_mc._y = Math.round((Stage.height-stageH)/2);
// Align preloader
preloader_mc._x = Math.round((Stage.width-preloader_mc._width)/2);
preloader_mc._y = Math.round((Stage.height-preloader_mc._height)/2);
preloaderXML_mc._x = Math.round(Stage.width/2);
preloaderXML_mc._y = Math.round(Stage.height-15);
// Align playlist
playlist_mc.bg_mc._width = Stage.width;
playlist_mc.bg_mc._height = Stage.height-30;
playlist_mc.player_mc._x = Math.round((Stage.width-playlist_mc.player_mc.bg_mc._width+10)/2);
playlist_mc.centreY = Math.round((Stage.height-playlist_mc.player_mc._height)/2)+65;
if (playlist_mc.bg_mc._alpha == 100) {
playlist_mc.player_mc._y = playlist_mc.centreY;
}
};
stageListener.onResize = function() {
alignObjects();
};
alignObjects();
//
// FULLSCREEN MODE BUTTON
//
fullscreen_mc.bttn.onPress = function() {
if (this._parent.icon_mc._currentframe == 1) {
// Go fullscreen
Stage["displayState"] = "fullScreen";
this._parent.icon_mc.gotoAndStop(2);
} else {
// Go normal
Stage["displayState"] = "normal";
this._parent.icon_mc.gotoAndStop(1);
}
};
//
// SCALE FULLSCREEN BACKGROUND
//
function scalebg_mc() {
// Original values
originBgWidth = bg_mc.imageWidth;
originBgHeight = bg_mc.imageHeight;
// Get different
widthDiff = (Stage.width-bg_mc._width)/originBgWidth;
heightDiff = (Stage.height-bg_mc._height)/originBgHeight;
// Scale bg
if (widthDiff>=heightDiff) {
bg_mc._width = Stage.width;
scaleRatio = (bg_mc._width*100)/originBgWidth;
bg_mc._yscale = scaleRatio;
} else {
bg_mc._height = Stage.height;
scaleRatio = (bg_mc._height*100)/originBgHeight;
bg_mc._xscale = scaleRatio;
}
}
//
// LOAD CONTENT
//
_global.loadContent = function(object) {
if (currentID != object.bttn.ID) {
clearInterval(_global.timeInterval);
// You can use custom easing types such as: Back, Bounce, Elastic, Regular, Strong, None
var tweenAlphaPreloaderIn:Tween = new Tween(preloader_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);
var tweenAlphaContentOut:Tween = new Tween(holder_mc, "_alpha", Strong.easeOut, holder_mc._alpha, 0, 0.5, true);
tweenAlphaContentOut["onMotionFinished"] = function () {
toLoad = object.bttn.toLoad;
holder_mc.loadMovie(object.bttn.Link);
};
currentID = object.bttn.ID;
// Volume (for video mute)
if (_global.volPosition%1 == 0) {
_root.soundControl_mc.volume_mc.scrollBttn._x = _global.volPosition;
_global.volPosition = "";
}
}
};
//
// START UP LOAD
//
_global.loadStart = function(Link, toLoad, ID) {
_root.Link = Link;
_root.toLoad = toLoad;
_root.ID = ID;
onEnterFrame = function () {
if (_global.bgLoaded) {
if (currentID != ID) {
holder_mc.loadMovie(Link);
currentID = ID;
}
nav_mc._visible = true;
footer_mc._visible = true;
soundControl_mc._visible = true;
if (_root.showNav == "true") {
trace('showNav');
nav_mc.openMenu();
}
delete onEnterFrame;
}
};
};
// You can use custom easing types such as: Back, Bounce, Elastic, Regular, Strong, None
var tweenAlphaPreloader:Tween = new Tween(preloader_mc, "_alpha", Strong.easeIn, 100, 0, 1, true);
tweenAlphaPreloader.stop();
contentLoaded = function () {
tweenAlphaPreloader.start();
tweenAlphaPreloader["onMotionFinished"] = function () {
holder_mc._alpha = 100;
};
};
stop();


И това е някакъв друг код:

//
// INITIAL SETTINGS
//
boundryWidth = mask_mc._width;
boundryHeight = mask_mc._height;
buffer = (menu_mc.bttn_mc._height)*2;
// Set tween speed of menu here
tweenSpeed = 5;
//
// MENU SCROLLING
//
onMouseMove = function () {
if (this._xmouse>0 && this._xmouse<(boundryWidth)) {
if (this._ymouse>0 && this._ymouse<(boundryHeight)) {
ratio = this._ymouse/boundryHeight;
diff = menu_mc._height-boundryHeight+buffer;
destY = Math.floor(-ratio*diff)+buffer/2;
}
}
};
//
// PRELOADER, TIME, MENUSCROLLING SCRIPT
//
onEnterFrame = function () {
// Loading bar
loading = my_sound.getBytesLoaded();
filesize = my_sound.getBytesTotal();
percentage = Math.round((loading/filesize)*100);
controls_mc.progress_mc.buffer_mc._xscale = percentage;
controls_mc.progress_mc.played_mc._xscale = (my_sound.position/my_sound.duration)*percentage;
// Get current time
seconds = my_sound.position/1000;
minutes = Math.floor(seconds/60);
if (minutes<10) {
minutes = "0"+minutes;
}
seconds = Math.floor(seconds%60);
if (seconds<10) {
seconds = "0"+seconds;
}
if (durationDisplay == undefined) {
durationDisplay = "-----";
}
controls_mc.time_txt.text = minutes+":"+seconds+" / "+durationDisplay;
// Menu scrolling
if (menu_mc._height>boundryHeight) {
menu_mc._y += Math.floor((destY-menu_mc._y)/tweenSpeed);
if (menu_mc._y>0) {
menu_mc._y = 0;
} else if (menu_mc._y<(boundryHeight-menu_mc._height)) {
menu_mc._y = boundryHeight-menu_mc._height;
}
}
//
};
//
// PLAYER CONTROL BUTTONS
//
// Rewind
doRewind = function () {
if (ID>0) {
ID--;
} else {
ID = total-1;
}
doHighlight();
loadTrack();
};
// Pause
doPause = function () {
my_sound.stop();
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
};
// Play
doPlay = function () {
my_sound.start(my_sound.position/1000);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
};
// Next track
doForward = function () {
if (ID<total-1) {
ID++;
} else {
ID = 0;
}
doHighlight();
loadTrack();
};
controls_mc.bttnPlay.bttn.onPress = function() {
if (controls_mc.bttnPlay.icon_mc._currentframe == 1) {
doPause();
} else {
doPlay();
}
};
controls_mc.bttnRewind.bttn.onPress = function() {
doRewind();
};
controls_mc.bttnForward.bttn.onPress = function() {
doForward();
};
//
// TRACK HIGHLIGHTING
//
doHighlight = function () {
for (n=0; n<total; n++) {
if (n != ID) {
menu_mc["bttn_mc"+n].gotoAndStop(1);
} else {
menu_mc["bttn_mc"+ID].gotoAndStop(2);
}
}
};
//
// LOAD SOUND
//
var my_sound:Sound = new Sound(this);
my_sound.onLoad = function(success:Boolean) {
if (success) {
totalSeconds = this.duration/1000;
minutes2 = Math.floor(totalSeconds/60);
if (minutes2<10) {
minutes2 = "0"+minutes2;
}
seconds2 = Math.floor(totalSeconds)%60;
if (seconds2<10) {
seconds2 = "0"+seconds2;
}
durationDisplay = minutes2+":"+seconds2;
menu_mc["bttn_mc"+ID].txt_mc.durationDisplay.text = durationDisplay;
}
};
my_sound.onSoundComplete = function() {
doForward();
};
//
// ON MENU PRESS
//
loadTrack = function () {
my_sound.start();
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
my_sound.loadSound(Path[ID], true);
doHighlight();
};
//
// BUILD PLAYER
//
buildPlayer = function () {
for (i=0; i<total; i++) {
// Get track name and path
Title = xmlNode.childNodes.attributes.Title;
Path = xmlNode.childNodes.attributes.Path;
// Build menu
menu_mc.bttn_mc.duplicateMovieClip("bttn_mc"+i, i);
menu_mc["bttn_mc"+i]._y = (menu_mc.bttn_mc._height+1)*i;
menu_mc["bttn_mc"+i].txt_mc.titleDisplay.text = Title;
if (i<9) {
num = "0"+(i+1);
} else {
num = i+1;
}
menu_mc["bttn_mc"+i].num_mc.numDisplay.text = num;
menu_mc["bttn_mc"+i].ID = i;
}
ID = 0;
loadTrack();
menu_mc.bttn_mc._visible = false
};
//
// LOAD XML
//
loadXML = function (loaded) {
if (loaded) {
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
Title = [];
Path = [];
buildPlayer();
} else {
trace("Error loading XML");
}
};
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("playlist/content.xml");
stop();
 

Back
Горе