all groups > flash actionscript > august 2006 >
You're in the

flash actionscript

group:

MediaPlayer component problem


MediaPlayer component problem miquael
8/21/2006 10:53:42 PM
flash actionscript:
i have a portfolio application that uses a MediaPlayer component to play both
audio (MP3) and video (FLV) clips. when an image thumb is clicked in the
portfolio--either an image, a video clip, or an audio clip is displayed (images
are displayed in another MC). everything works fine--when selecting an audio
or video thumb, then the corresponding audio or video clip is loaded and played
in the MediaPlayer. but this only works once. any other time an audio or
video thumb is selected, the corresponding clip will not load and play.

below is the code i am currently using. resetMedia() is another function that
simply makes invisible the MediaPlayer and image display MC (and then one of
these will be turned back on to display content), and also stops any media
playback in MediaPlayer.

if (currentPicture.attributes.image != null) {
// image
currentThumb_mc.image = currentPicture.attributes.image;
currentThumb_mc.onRelease = function() {
_root.resetMedia();
content_holder.image_mc._visible = true;
content_holder.image_mc.loadMovie(this.image);
description_lv.load(this.description);
}

} else if (currentPicture.attributes.audio != null) {
// audio
currentThumb_mc.audio = currentPicture.attributes.audio;
currentThumb_mc.onRelease = function() {
_root.resetMedia();
content_holder.media_mc._visible = true;
content_holder.media_mc.setMedia("web_audio/Weekend_Players__Angel.mp3",
"MP3");
media_mc.play(0);
description_lv.load(this.description);
}

} else if (currentPicture.attributes.video != null) {
// video
currentThumb_mc.video = currentPicture.attributes.video;
currentThumb_mc.onRelease = function() {
_root.resetMedia();
content_holder.media_mc._visible = true;
content_holder.media_mc.setMedia("web_video/Coca_Cola_p.flv", "FLV");
media_mc.play(0);
description_lv.load(this.description);
}
}
Re: MediaPlayer component problem miquael
8/22/2006 12:00:00 AM
okay - i have an update here: i've added autoPlay and still dont get results:

. . .

} else if (currentPicture.attributes.audio != null) {
// audio
currentThumb_mc.audio = currentPicture.attributes.audio;
currentThumb_mc.onRelease = function() {
_root.resetMedia();
content_holder.media_mc._visible = true;
content_holder.media_mc.autoPlay = true;
content_holder.media_mc.setMedia("web_audio/Weekend_Players__Angel.mp3",
"MP3");
title_txt.text = this.title;
description_txt.text = this.description;
}
} else if (currentPicture.attributes.video != null) {
// video
currentThumb_mc.video = currentPicture.attributes.video;
currentThumb_mc.onRelease = function() {
_root.resetMedia();
content_holder.media_mc._visible = true;
content_holder.media_mc.autoPlay = true;
content_holder.media_mc.setMedia("web_video/Coca_Cola_p.flv", "FLV");
title_txt.text = this.title;
description_txt.text = this.description;
}
}


same situation as before ... the first one plays automatically (either the
audio or the video), but second time will not autoplay (only if you click
"play" in the MediaPlayer).

help?


AddThis Social Bookmark Button