all groups > flash actionscript > october 2005 >
You're in the

flash actionscript

group:

Can't hear sound object after upload


Can't hear sound object after upload WickedSense
10/14/2005 10:55:09 PM
flash actionscript:
I am building a portfolio site with audio and video. There is a main movie and
then small movies that load into it.

Basically my main movie loads portfolio1.swf via

function loadFile() {

_root.holder.loadMovie("http://www.viswiz.biz/files/portfolio"+mymovie+".swf");
}

Inside portfolio1.swf is embedded video and audio. I have the audio controlled
by this script

bplay.onPress = function() {
gotoAndPlay(lastframe);
sound = new Sound();
sound.attachSound("myaudio");
sound.start();
};

"myaudio" is also assigned to the linkage of the embedded sound file (which is
quicktime format).
It previews perfectly on my computer, but when I upload portfolio1.swf to the
internet the sound can no longer be heard.

Sorry if you have already seen this posted before, but it's driving me nuts,
this should be easy.
Re: Can't hear sound object after upload NSurveyor
10/14/2005 11:10:22 PM
Try:

Re: Can't hear sound object after upload WickedSense
10/16/2005 11:54:56 PM
Re: Can't hear sound object after upload WickedSense
10/17/2005 12:00:00 AM
The sound works but I can no longer alter the volume of it..

_root.sound.setVolume(vol);

Re: Can't hear sound object after upload WickedSense
10/19/2005 9:37:57 PM
Any ideas? vol is my variable that returns 0 to 100.

To reiterate, I created the sound object via

bplay.onPress = function() {
gotoAndPlay(lastframe);
sound = new Sound(this);
sound.attachSound("myaudio");
sound.start();
};

After using "this" to create my sound object I am unable to alter the volume
of it with basic code...

_root.sound.setVolume(vol);

As always, thanks for the time.

Re: Can't hear sound object after upload NSurveyor
10/20/2005 10:37:50 PM
Because the swf with the sound is embedded in another swf, the sound object
will look in the _level0 for attaching sounds, if not specified. So, if you
specify 'this', it will belong to bplay, because this refers to bplay, and
because bplay is in your embedded swf, it will look for the sound in that swf.

Try:

bplay.onPress = function() {
gotoAndPlay(lastframe);
_root.sound = new Sound(this);
_root.sound.attachSound("myaudio");
_root.sound.start();
};

Re: Can't hear sound object after upload WickedSense
10/22/2005 12:27:10 AM
Well, this is killing me inside... still can't get it functioning. When I use
trace(_root.sound.GetVolume()) it even shows the volume has changed, but there
is no audible difference in the sound even if volume is 0 or 100.

vol is defined as 100 on frame 87.

frame 88 has the following.

stop();
this._lockroot = true;
var lastsound;
var lastframe;
var dragging;
bpause.enabled = false;
bpause._alpha = 50;
bplay.enabled = true;
bscrub._alpha = 50;
bscrub.enabled = false;
bvol._alpha = 50;
bvol.enabled = false;
bplay.onPress = function() {
gotoAndPlay(89);
bplay._alpha = 50;
bplay.enabled = false;
bpause.enabled = true;
bpause._alpha = 100;
bscrub.enabled = true;
bscrub._alpha = 100;
bvol.enabled = true;
bvol._alpha = 100;
_root.sound = new Sound(this);
_root.sound.attachSound("mysound");
_root.sound.start();
_root.sound.setVolume(vol);
};
if (vol == 0) {
mcxred._alpha = 100;
mcx._alpha = 0;
} else {
mcxred._alpha = 0;
mcx._alpha = 100;
}
_root.sound.stop();

frames 89 through 447 (this length of the timeline has corresponding video for
the audio)

this._lockroot = true;
bvol.onPress = function() {
startDrag(bvol, false, 338, 278, 419, 278);
};
bvol.onRelease = function() {
stopDrag();
vol = Math.round((bvol._x-338)*1.234567);
trace(vol);
_root.sound.setVolume(vol);
trace(_root.sound.getVolume());
if (vol == 0) {
mcxred._alpha = 100;
mcx._alpha = 0;
} else {
mcxred._alpha = 0;
mcx._alpha = 100;
}
};
bscrub.onPress = function() {
dragging = true;
var lastframe = _currentframe;
lastsound = sound.position/1000;
_root.sound.stop();
startDrag(bscrub, false, 441, 279, 600, 279);
stop();
};
bscrub.onRelease = function() {
stopDrag();
dragging = false;
lastframe = Math.ceil((bscrub._x-441)*2.25786)+89;
lastsound = (lastframe-89)*.083565;
trace(lastframe);
gotoAndPlay(lastframe);
_root.sound.start(lastsound);
trace(lastsound);
};
bscrub.onReleaseOutside = function() {
dragging = false;
gotoAndPlay(lastframe);
_root.sound.start(lastsound);
stopDrag();
};
onEnterFrame = function () {
if (!dragging) {
bscrub._x = 441+Math.round((_currentframe-89)*.442896);
bscrub._y = 279;
}
};
bpause.onPress = function() {
lastframe = _currentframe;
trace(lastframe);
lastsound = sound.position/1000;
stop();
_root.sound.stop();
bpause.enabled = false;
bpause._alpha = 50;
bplay._alpha = 100;
bplay.enabled = true;
bscrub._alpha = 50;
bscrub.enabled = false;
};
bplay.onPress = function() {
gotoAndPlay(lastframe);
_root.sound.start(lastsound);
bpause.enabled = true;
bpause._alpha = 100;
bplay._alpha = 50;
bplay.enabled = false;
trace(lastsound);
bscrub._alpha = 100;
bscrub.enabled = true;
};


Notice the trace function when bvol is released.. they both return correct
values, but the volume never changes. I've tried this with and without
lockroot. Also, when you press bscrub, the sound does stop, meaning it is
functioning almost properly.


AddThis Social Bookmark Button