Thursday, July 29th 2010, 1:34pm UTC+2
You are not logged in.
|
|
ActionScript-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
MovieClip.prototype.loadDynSound=function(sndO,sName,anz){
removeMovieClip (this.mySControl);
this.createEmptyMovieClip('mySControl',9999);
this['mySControl'][sndO]=new Sound(this);
this['mySControl'][sndO].loadSound(sName,true);
if(globalVolume==undefined){
_global.globalVolume=100;
}
this['mySControl'][sndO].setVolume(globalVolume);
var ziel =this['mySControl']._name;
this['mySControl'][sndO].onSoundComplete=function(){
this.loopy++;
if(this.loopy<anz){
this.loadSound(sName,true);
this.setVolume(globalVolume);
}else{
removeMovieClip (_root.mySControl);
delete this;
}
}
return _global.isRunning=[ziel,sndO,sName];
;
}
|
|
|
ActionScript-Quelltext |
1 |
_global.globalVolume=euer volume;
|
|
|
ActionScript-Quelltext |
1 |
this.loadDynSound('myS','mySound.mp3',2);
|
und abschauen ... (das ist hier auch kein Arschkriechen, ich bin nur eben echt begeistert) bringt mich schon ein Stück weiter dein Kram; da ich bisher nur relativ einfache Funktionen geschrieben habe hilft mir das verstehen deiner Codes bisher enorm ... wenn das so weitergeht habe ich wohl noch einiges vor mir
Hi miesel,
Quoted
Original von miesel
... wann kommt eigentlich dein Buch raus??
)
) LOL
sowas mal zu kaufen´
This post has been edited 2 times, last edit by "eisenhower" (May 5th 2003, 2:27pm)
This post has been edited 1 times, last edit by "psychoinca" (May 26th 2005, 3:55pm)
Quoted
Original von Neo
soa, ich krame mal wieder einen hübschen alten Thread raus, weil sich mir ein paar Probleme offenbarten.
Das Skript selbst, erste Sahne funktioniert soweit einwandfrei. Nur hab ich ein Problem beim Loop.
Ich hab ne Sounddatei so bearbeitet, dass sie in meinem Audioeditor (Steinberg's Wavelab) 1A geloopt wird, sprich keine Pausen oder ähnliches zwischen Ende und Anfang, wie man sich halt nen Loop so vorstellt.
Wende ich nun das Skript an (oder auch jedes x-beliebige andere Skript, oder importiere das ganze sogar in Flash) gibts immer so n leichten Knackser beim Loop und zwar immer an der Stelle, wo der Track zu Ende ist und von vorn beginnt. Lässt sich das Problem irgendwie beheben?
Desweiteren noch eine Frage zu Deinem Skript, kelor, was muss man tun, damit der Sound, wenn er das ERSTE Mal angespielt wird, eingefadet wird. Flash bietet ja die Option selbst an, bei importieren Sounds, wie jedoch macht man das bei dynamisch geladenen Sounds?
Würde mich über Hilfe und Co. freuen,
Gruß und Dank im Vorraus
Neo

This post has been edited 2 times, last edit by "dr_skin" (Sep 23rd 2005, 11:25am)
|
|
Source code |
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 |
this.onEnterFrame = function () {
sload = mySound.getBytesLoaded();
stotal = mySound.getBytesTotal();
percentload = (Math.round((sload/stotal) * 100)) + "%";
if (counter < 2) {
counter = counter + 1;
loadVariablesNum("flashmusic.txt", 0);
songtitle = musictitle.split(":");
count2 = 0;
songplaying = (count2+1) + " - " + songtitle[count2];
}
if (stopped!=true) {
mySoundDuration=Math.round(_root.mySound.duration/1000);
mySoundPosition=Math.round(_root.mySound.position/1000);
texttime = mySoundPosition;
timemin = 0;
if (texttime < 10) {
texttime = "0" + texttime;
}
while(texttime >= 60) {
texttime = texttime - 60;
timemin = timemin + 1;
if (texttime < 10) {
texttime = "0" + texttime;
}
}
}
timeformat = timemin + ":" + texttime;
//Reverse
if (REV==1 && mySoundPosition>0) {
_root.mySound.stop();
mySoundPosition=mySoundPosition-1;
_root.mySound.start(mySoundPosition,0);
}
revButton.onPress = function () {
REV=1;
mySoundPosition=Math.round(_root.mySound.position/1000);
//
}
revButton.onRelease = function () {
REV=0
}
//Fast Forward
if (FF==1 && mySound.position<mySound.duration) {
_root.mySound.stop();
mySoundPosition=mySoundPosition+1;
_root.mySound.start(mySoundPosition,0);
}
FFButton.onPress = function () {
FF=1;
mySoundPosition=Math.round(_root.mySound.position/1000);
}
FFButton.onRelease = function () {
FF=0
}
_root.mySound.setVolume(20);
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
on (release) {
if (mySoundPosition > 0) {
_root.mySound.stop();
_root.mySound.start(mySoundPosition, 0);
stopped=false;
}
else {
_root.mySound.stop();
_root.mySound = new Sound();
_root.mySound.loadSound(songtitle[count2], true);
_root.mySound.start();
stopped=false;
}
}
|
|
|
ActionScript-Quelltext |
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
var itemNo = 3;
var posX = 100;
var posY = 100;
var colorOver = 0xFF0000;
var colorOut = 0x000000;
var mwidth = 200;
// ==========
MovieClip.prototype.loadDynSound=function(sndO,sName,anz){
removeMovieClip (this.mySControl);
this.createEmptyMovieClip('mySControl',9999);
//
this.mySControl.createTextField("lStatus_txt", this.getNextHighestDepth(),100, 70, 100, 22);
this.mySControl.lStatus_txt.autoSize = true;
this.mySControl.lStatus_txt.border = true;
this.mySControl.lStatus_txt.text = "Ladeanzeige / Dauer / Zeit";
//
this['mySControl'][sndO]=new Sound(this);
this['mySControl'][sndO].loadSound(sName,true);
if(globalVolume==undefined){
_global.globalVolume=100;
}
this['mySControl'][sndO].setVolume(globalVolume);
var ziel =this['mySControl']._name;
this['mySControl'][sndO].onSoundComplete=function(){
this.loopy++;
if(this.loopy<anz){
this.loadSound(sName,true);
this.setVolume(globalVolume);
}else{
removeMovieClip (_root.mySControl);
delete this;
}
}
return _global.isRunning=[ziel,sndO,sName];
;
}
// ==========
menuXML = new XML();
menuXML.ignoreWhite = true;
menuXML.onLoad = function() {
var items, itemName, itemTitle, itemPath;
items = this.firstChild;
if (items.hasChildNodes()) {
for (var i = 0; i<itemNo; i++) {
itemTitle = items.childNodes[i].attributes.title;
itemPath = items.childNodes[i].attributes.path;
itemName = 'm_item_'+i;
var mc = _root.createEmptyMovieClip(itemName, i);
mc.itemPath = itemPath;
mc.onRelease = onReleaseHandler;
mc.onReleaseOutside = mc.onRollOut=onRollOutHandler;
mc.onRollOver = onRollOverHandler;
mc._x = 0;
mc._y = 0 + m_item_0._height * i * 1.1;
mc.createTextField("theText", 1, posX, posY, mwidth, 25);
mc.theText.multiline = false;
mc.theText.wordWrap = false;
mc.theText.border = false;
mc.theText.selectable = false;
txtFormat = new TextFormat();
txtFormat.bullet = false;
txtFormat.underline = false;
txtFormat.url = itemPath;
txtFormat.bold = true;
txtFormat.font = "Arial";
// txtFormat.color = 0xFF9900;
mc.theText.text = itemTitle;
mc.theText.setTextFormat(txtFormat);
mc.theText.onRollOut();
}
}
};
xmlFile = "tracks.xml";
menuXML.load(xmlFile);
function onReleaseHandler() {
loadDynSound("myS", this.itemPath, 1);
trace(this.itemPath);
}
function onRollOutHandler() {
this.theText.textColor = colorOut;
}
function onRollOverHandler() {
this.theText.textColor = colorOver;
}
|
|
|
ActionScript-Quelltext |
1 2 3 4 5 6 |
<?xml version="1.0" encoding="iso-8859-1"?>
<tracks>
<items title="Titel 1" path="audio/sample1.mp3"/>
<items title="Titel 2" path="audio/sample2.mp3"/>
<items title="Titel 3" path="audio/sample3.mp3"/>
</tracks>
|
geben, der ladezeiten und dauer eines sounds handelt...