phatsion
asked on
Mute sounds in a swf at the time of embedding.???
Hi all.
I have a SWF movie which plays background mucis.
I need to embed this SWF into a page, with full functionality. But i need it to be silent / muted.
I do not have acces to the original flash file, so i cant see any parameters inside etc..
There should be no other sounds on the page, so is there some way of just stopping all sounds on the page? (this should not must other pages and applications though )
Any help greatly apreciated.
I have a SWF movie which plays background mucis.
I need to embed this SWF into a page, with full functionality. But i need it to be silent / muted.
I do not have acces to the original flash file, so i cant see any parameters inside etc..
There should be no other sounds on the page, so is there some way of just stopping all sounds on the page? (this should not must other pages and applications though )
Any help greatly apreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The other option would be to convert the SWF to a FLV if it makes sense to do so (i.e. it's an actual video) and then load it up through a player skin which will have a mute control.
ASKER
The movie has functionality, with buttons etc, so not just an actual video.
Would it work to embed this SWF inside another flash movie, and mute that one?
would that work?
Would it work to embed this SWF inside another flash movie, and mute that one?
would that work?
Yes you could, providing the first movie is not password protected. Adobe have the password functionality to stop this happening. Try the IMPORT command in Flash and see if it lets you do it
Just to add, you might have to give the embedded movie an instance name and fire the StopAllSounds command directly against it, i.e.
myMovieName.stopAllSounds( )
I've not used Flash for a long time so my ActionScript knowledge is a little rusty!
myMovieName.stopAllSounds(
I've not used Flash for a long time so my ActionScript knowledge is a little rusty!
ASKER
The swf wont import, as it is locked...
I have tryed embeding it remotly, but seem to be running into all sorts of other problems.
I have, however, managed to decompile the swf - code is attached.
Can any one see any volume parameters in there that i could send it to mute it??
i have tryed userVolume=0 and myVolume=0 but had no joy.
Cheers.
I have tryed embeding it remotly, but seem to be running into all sorts of other problems.
I have, however, managed to decompile the swf - code is attached.
Can any one see any volume parameters in there that i could send it to mute it??
i have tryed userVolume=0 and myVolume=0 but had no joy.
Cheers.
// Action script...
// [onClipEvent of sprite 105 in frame 1]
onClipEvent (construct)
{
multipleSelection = false;
rowHeight = 17;
}
// [onClipEvent of sprite 152 in frame 1]
onClipEvent (load)
{
startPosition = this._x;
myleft = this._x;
mytop = this._y;
myright = myleft + _root.hbase._width - 9;
mybottom = this._y;
fadeOutTime = 120;
}
// [onClipEvent of sprite 152 in frame 1]
onClipEvent (enterFrame)
{
mySoundPosition = Math.round(_root.sound_mc.myMP3.position / 10) / 100;
mySoundDuration = Math.round(_root.sound_mc.myMP3.duration / 10) / 100;
if (_root.q == "hi" && _global.myPlaylist[_global.currID].fade == 1 && mySoundDuration > fadeOutTime)
{
mySoundDuration = fadeOutTime;
} // end if
if (mySoundPosition > fadeOutTime - 5 && _root.q == "hi" && _global.myPlaylist[_global.currID].fade == 1)
{
if (_root.sound_mc.myMP3.getVolume() > 0)
{
_root.sound_mc.myMP3.setVolume(_root.sound_mc.myMP3.getVolume() - 2);
} // end if
} // end if
if (mySoundDuration < 20)
{
mySoundDuration = 20;
} // end if
if (mySoundDuration > 20 && mySoundPosition >= mySoundDuration)
{
_root.killMusic();
if (_global.myPlaylist.length > _global.currID + 1)
{
_global.currID = _global.currID + 1;
_root.prepareSong(_global.currID);
}
else
{
_root.endPositionPlay();
_global.currID = 0;
} // end if
} // end else if
myTimeBarPosition = startPosition + mySoundPosition / mySoundDuration * (_root.hbase._width - 7);
if (_global.playStatus == "playing" && this.dragingSlider != 1 && mySoundPosition > 0)
{
this._x = myTimeBarPosition;
} // end if
distanceTraveled = this._x - startPosition;
percentTraveled = distanceTraveled / (_root.hbase._width - 10);
dragStartPosition = percentTraveled * mySoundDuration;
}
// [onClipEvent of sprite 160 in frame 1]
onClipEvent (load)
{
top = _y;
bottom = _y;
left = _x - Math.floor(_root.volumeDisplay._width);
right = _x;
checkInitialVolume();
}
// [onClipEvent of sprite 160 in frame 1]
onClipEvent (enterFrame)
{
if (_global.changeInitialVolume == true)
{
_root.sound_mc.myMP3.setVolume(_root.so.data.userVolume);
setProperty("", _x, left + _root.so.data.userVolume / 2);
_global.changeInitialVolume = false;
} // end if
if (volumeDragging == true)
{
var myVolume = 100 - (right - _x) * 2;
_root.sound_mc.myMP3.setVolume(myVolume);
_root.so.data.userVolume = myVolume;
_root.volumeText = "volume:" + Math.ceil(myVolume);
} // end if
}
// [Action in Frame 1]
function getKeyXML()
{
myStatus2 = "loading...";
var _loc1 = new XML();
_loc1.ignoreWhite = true;
_loc1.onLoad = processKeyXML;
_loc1.load("http://www.soundclick.com/util/passkey.cfm?flash=true");
} // End of the function
function processKeyXML(success)
{
if (success)
{
myPasskey = this.firstChild.firstChild;
if (_global.playlistStatus == "loaded")
{
myPlaylist[currID].controlID = myPasskey;
playSong(currID);
}
else
{
getMyXML(myPasskey);
} // end else if
}
else
{
myError = "key not loaded!";
gotoAndStop("linkError");
} // end else if
} // End of the function
function getMyXML(myKey)
{
var _loc1 = new XML();
_loc1.ignoreWhite = true;
_loc1.onLoad = processXMLData;
newref;
if (newref == undefined)
{
counterID = 3;
}
else
{
counterID = newref;
} // end else if
ext;
if (ext == undefined)
{
extSource = 0;
}
else
{
extSource = 1;
counterID = 4;
} // end else if
shuffle;
if (shuffle == undefined)
{
shuffle = "false";
} // end if
scid;
if (scid == undefined)
{
}
else
{
songid = scid;
} // end else if
if (playType == "single")
{
_loc1.load("http://www.soundclick.com/util/xmlsong.cfm?songid=" + songid + "&passkey=" + myKey + "&q=" + q + "&ext=" + extSource);
}
else if (playType == "band")
{
_loc1.load("http://www.soundclick.com/util/xmlband.cfm?passkey=" + myKey + "&bandid=" + bandid + "&q=" + q + "&shuffle=" + shuffle + "&ext=" + extSource);
}
else if (playType == "album")
{
_loc1.load("http://www.soundclick.com/util/xmlalbum.cfm?passkey=" + myKey + "&albumid=" + albumid + "&q=" + q + "&ext=" + extSource);
}
else if (playType == "charts")
{
_loc1.load("http://www.soundclick.com/util/xmlcharts.cfm?passkey=" + myKey + "&q=" + q + "&genre=" + genre + "&subGenre=" + subgenre + "&showOnly=" + showOnly + "&advState=" + advState + "&advCountry=" + advCountry + "&advSigned=" + advSigned + "&advVIP=" + advVIP + "&advFeatured=" + advFeatured + "&ext=" + extSource);
}
else if (playType == "station")
{
_loc1.load("http://www.soundclick.com/util/xmlstations.cfm?passkey=" + myKey + "&q=" + q + "&folderID=" + folderID + "&shuffle=" + shuffle + "&ext=" + extSource);
}
else if (playType == "contest")
{
_loc1.load("http://www.soundclick.com/util/xmlcontest.cfm?passkey=" + myKey + "&q=" + q + "&contestID=" + contestID + "&shuffle=" + shuffle + "&ext=" + extSource);
} // end else if
} // End of the function
function processXMLData(success)
{
if (success)
{
_global.playlistStatus = "loaded";
var _loc9 = this.firstChild.childNodes.length;
var _loc5 = this.firstChild.firstChild.childNodes.length;
_global.myPlaylist = new Array(_loc9);
for (var _loc3 = 0; _loc3 < _loc9; ++_loc3)
{
_global.myPlaylist[_loc3] = new Array(_loc5);
for (var _loc4 = 0; _loc4 < _loc5; ++_loc4)
{
myName = this.firstChild.childNodes[_loc3].childNodes[_loc4].nodeName;
myValue = unescape(String(this.firstChild.childNodes[_loc3].childNodes[_loc4].firstChild));
myValue = str_replace("/xtc", "", myValue);
myPlaylist[_loc3][myName] = myValue;
} // end of for
var _loc6 = padZero(_loc3 + 1);
playlist.addItem({label: _loc6 + " " + myPlaylist[_loc3].artist + " - " + myPlaylist[_loc3].title, data: _loc3});
} // end of for
_global.currID = 0;
if (autoplay == 0)
{
autoplay = 1;
myStatus2 = "press PLAY button to start song";
killMusic();
}
else
{
prepareSong();
} // end else if
}
else
{
myError = "xml error!";
gotoAndStop("linkError");
} // end else if
} // End of the function
function prepareSong()
{
myStatus2 = "loading...";
if (myPlaylist[currID].useSecure == "true")
{
getKeyXML();
}
else
{
playSong(currID);
} // end else if
} // End of the function
function playSong()
{
if (myPlaylist[currID].useSecure == "true")
{
var _loc5 = "http://" + myPlaylist[currID].datacenter + "/" + myPlaylist[currID].streamer + "/getsongfile.cfm?songid=" + myPlaylist[currID].songid + "&id=" + myPlaylist[currID].controlID + "&q=" + q;
}
else
{
_loc5 = myPlaylist[currID].filename;
} // end else if
var _loc4 = new XML();
_loc4.ignoreWhite = true;
_loc4.load("http://www.soundclick.com/player/stats/votes.cfm?songID=" + myPlaylist[currID].songid + "&vip=" + myPlaylist[currID].vip + "&bandID=" + myPlaylist[currID].bandid + "&counterID=" + counterID);
var _loc3 = this.createEmptyMovieClip("sound_mc", 1);
_loc3.myMP3 = new Sound();
_loc3.myMP3.onLoad = checkForPlayError;
_loc3.myMP3.loadSound(_loc5, true);
if (so.data.userVolume != 100 && so.data.userVolume != undefined)
{
_global.changeInitialVolume = true;
} // end if
if (currID == 0)
{
this.prevTrack._y = skipButtonsInActive_y;
this.prevTrackInactive._y = skipButtonsActive_y;
}
else
{
this.prevTrack._y = skipButtonsActive_y;
this.prevTrackInactive._y = skipButtonsInActive_y;
} // end else if
if (myPlaylist.length == currID + 1)
{
this.nextTrack._y = skipButtonsInActive_y;
this.nextTrackInactive._y = skipButtonsActive_y;
}
else
{
this.nextTrack._y = skipButtonsActive_y;
this.nextTrackInactive._y = skipButtonsInActive_y;
} // end else if
startPositionPlay();
_global.playStatus = "playing";
setRemoteStatus();
updatePlaylist();
} // End of the function
function checkForPlayError(success)
{
if (success == false)
{
myStatus2 = "error loading songfile (" + _global.myPlaylist[_global.currID].title + ")";
} // end if
} // End of the function
function updatePlaylist()
{
this.playlist.selectedIndex = currID;
this.playlist.vPosition = currID - 2;
myStatusTrack = padZero(_global.currID + 1);
if (playType != "single" && testMode == undefined)
{
myRandom = Math.random();
if (playType == "station")
{
getURL("http://www.soundclick.com/player/single_player.cfm?bandid=" + _global.myPlaylist[_global.currID].bandid + "&songID=" + _global.myPlaylist[_global.currID].songid + "&type=" + playType + "&q=" + q + "&ref=" + ref + "&myRan=" + myRandom + "&upperOnly=true" + "&folderID=" + folderID, "upper");
}
else
{
getURL("http://www.soundclick.com/player/single_player.cfm?bandid=" + _global.myPlaylist[_global.currID].bandid + "&songID=" + _global.myPlaylist[_global.currID].songid + "&type=" + playType + "&q=" + q + "&ref=" + ref + "&myRan=" + myRandom + "&upperOnly=true", "upper");
} // end if
} // end else if
} // End of the function
function killMusic()
{
removeMovieClip (sound_mc);
hslider._x = hslider.startPosition;
_global.playStatus = "killed";
setRemoteStatus();
endPositionPlay();
} // End of the function
function updateProgressBar()
{
loadProgress = Math.round(sound_mc.myMP3.getBytesLoaded() / sound_mc.myMP3.getBytesTotal() * 100);
showProg = _root.hbase._width * (loadProgress / 100);
percent = loadProgress + " %";
_root.progBar._width = loadProgress;
_root.bars._x = progWidth + showProg;
if (loadProgress < 100)
{
_root.bars._alpha = 100;
}
else
{
_root.bars._alpha = 0;
} // end else if
updateTimerAndTitle();
} // End of the function
function updateTimerAndTitle()
{
mps = int(sound_mc.myMP3.position / 1000);
if (mps < 1)
{
myStatus = "0:00";
}
else
{
nmins = Math.floor(mps / 60);
nsecs = mps - nmins * 60;
nsecs < 10 ? (nsecs = "0" + nsecs) : (null);
myStatus = nmins + ":" + nsecs;
} // end else if
if (sound_mc.myMP3.position > 0 && (_global.showInfo != true || myStatus2 == "loading..."))
{
myStatus2 = _global.myPlaylist[_global.currID].artist + " - " + _global.myPlaylist[_global.currID].title;
} // end if
} // End of the function
function setRemoteStatus()
{
so.data.remoteStatus = _global.playStatus;
so.flush();
so.data.remoteStatus = "killed";
} // End of the function
function initialPosition()
{
if (playType == "single")
{
this.playlist.visible = false;
}
else
{
this.playlist.visible = true;
} // end else if
playButtonActive_x = 3.600000E+000;
playButtonActive_y = 1.156000E+002;
playButtonInActive_x = -250;
playButtonInActive_y = -250;
skipButtonsActive_y = 1.025000E+002;
skipButtonsInActive_y = 250;
startPositionPlay();
this.prevTrack._x = 1.681000E+002;
this.prevTrack._y = skipButtonsInActive_y;
this.nextTrack._x = 1.837000E+002;
this.nextTrack._y = skipButtonsActive_y;
this.prevTrackInactive._x = this.prevTrack._x;
this.prevTrackInactive._y = skipButtonsActive_y;
this.nextTrackInactive._x = this.nextTrack._x;
this.nextTrackInactive._y = skipButtonsInActive_y;
this.myStatusTrack = "";
this.volumeText = "";
} // End of the function
function endPositionPlay()
{
this.buttonPause._x = playButtonInActive_x;
this.buttonPause._y = playButtonInActive_y;
this.buttonPlay._x = playButtonActive_x;
this.buttonPlay._y = playButtonActive_y;
} // End of the function
function startPositionPlay()
{
this.buttonPause._x = playButtonActive_x;
this.buttonPause._y = playButtonActive_y;
this.buttonPlay._x = playButtonInActive_x;
this.buttonPlay._y = playButtonInActive_y;
} // End of the function
function toggleButtons(fromButton, toButton)
{
prevPosFrom = fromButton._x;
prevPosFromY = fromButton._y;
prevPosTo = toButton._x;
prevPosToY = toButton._y;
fromButton._x = prevPosTo;
fromButton._y = prevPosToY;
toButton._x = prevPosFrom;
toButton._y = prevPosFromY;
} // End of the function
function str_replace(search, replace, string)
{
var _loc1 = string.split(search);
return (_loc1.join(replace));
} // End of the function
function padZero(myNumber)
{
if (Math.round(myNumber).toString().length < 2)
{
myNumber = "0" + myNumber.toString();
}
else
{
myNumber = myNumber.toString();
} // end else if
return (myNumber);
} // End of the function
so = SharedObject.getLocal("userSettings", "/player/");
if (so.data.userVolume == undefined)
{
so.data.userVolume = 100;
so.flush();
} // end if
getKeyXML();
initialPosition();
if (q == "Lo")
{
setProperty("", _soundbuftime, 5);
}
else
{
setProperty("", _soundbuftime, 0);
} // end else if
my_interval = setInterval(updateProgressBar, 100, sound_mc.myMP3);
progWidth = _root.bars._x;
mx.accessibility.playlist.enableAccessibility();
focusManager.setFocus(playlist);
playlist.setStyle("themeColor", "haloOrange");
playlist.setStyle("fontSize", 11);
playlist.setStyle("backgroundColor", 14803455);
playlist.setStyle("selectionColor", 7829503);
playlist.setStyle("textSelectedColor", 16777215);
playlist.vScrollPolicy = "auto";
playlist.change = function (evt)
{
_global.currID = evt.target.selectedItem.data;
_root.prepareSong();
};
playlist.addEventListener("change", playlist);
// [Action in Frame 2]
stop ();
// [Action in Frame 13]
myOffset = 0;
killMusic();
myStatus2 = myError;
stop ();
Try setting this line (110 above):
playSong(currID);
to this:
// playSong(currID);
That comments the line that *appears* to play the song
playSong(currID);
to this:
// playSong(currID);
That comments the line that *appears* to play the song
ASKER
I dont think i can get the swf to work if it is changed, as it is ment to be hosted, and just embedded.
Idealy i need to just pass a var to it.. something like volume=0, but in the html embedding code.
I just cant see what one would do it.
Cheers.
Idealy i need to just pass a var to it.. something like volume=0, but in the html embedding code.
I just cant see what one would do it.
Cheers.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Agreed. Sorry, phatsion...you're out of luck.
ASKER
ok,
no worries guy.
Thanks for all your help though.
Cheers.
no worries guy.
Thanks for all your help though.
Cheers.