Link to home
Start Free TrialLog in
Avatar of ripnoel
ripnoel

asked on

Losing volume control when loading swf into another movie.

I have built a swf movie for video playback and volume control which works fine when played alone. When I load this external SWF file into another movie I am loosing my volume control. here is the code I'm using for volume control:
-------------------------
var s:Sound = new Sound();
s.setVolume(100);
mc_soundLevel.mc_bar._yscale = 100;

mc_soundLevel.onPress = function() {
      volumeTo = (this._ymouse / this._height)*100;
      this.mc_bar._yscale = -volumeTo;
      s.setVolume(volumeTo);
}
----------------------------
Ideas/help appreciated

Rip
Avatar of Zeffer
Zeffer
Flag of New Zealand image

try adding..
this._lockroot = true;
Z
Avatar of ripnoel
ripnoel

ASKER

Does nothing no matter where I place it...other ideas?
volumeTo: Number = (this._ymouse / this._height)*100;
Z
Avatar of ripnoel

ASKER

I'm really not sure what you are suggesting...have you looked at my original code? The issue I'm trying to address is NOT trying to get it to work BUT to get it to work when imported into another flash movie. Works fine stand alone.

My code:
------------------------

var s:Sound = new Sound();
s.setVolume(100);
mc_soundLevel.mc_bar._yscale = 100;

mc_soundLevel.onPress = function() {
      volumeTo = (this._ymouse / this._height)*100;
      this.mc_bar._yscale = -volumeTo;
      s.setVolume(volumeTo);
}
Yes looked at your code..It just that it's a mix of AS1 and AS2 and if you are importing it into a swf exported as AS2 the imported clip may fall over as the parent clip's attributes are inherited by the imported clip..frame-rate etc.
anyway..try the following with reference to the clip rather than default reference to _root (which is why I suggested _lockroot in the clip)..

var s:Sound = new Sound();
s.setVolume(100);
this.mc_soundLevel.mc_bar._yscale = 100;

this.mc_soundLevel.onPress = function() {
      var volumeTo:Number = (this._ymouse / this._height)*100;
      this.mc_bar._yscale = -volumeTo;
      s.setVolume(volumeTo);
}

Z

Avatar of ripnoel

ASKER

Already tried this and tried it again to no avail. I feel I need to put a volume controller on the main movie timeline (and just below my video) where I have a music player there already. Can you provide some proper code I can add in to this area as an overall volume controller?

Thanks,

Rip
ASKER CERTIFIED SOLUTION
Avatar of Zeffer
Zeffer
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin