Hi All
I’m really confused using these session vars can somebody help me out.
What i’m trying to accomplish is that when i click a mute button (mute the sound) in a flash movie on one page its muted then throughout the site. the code i have used is as follows:
on the timeline
ActionScript Flash:
//session vars
createEmptyMovieClip(“mute_ctrl”,0);
loadVariables(“http://www.iceni.tv/mute/mute.php","mute_ctrl”);
mute_ctrl.onData = function() {
mute_off_btn.label = this.mute;
}
//end session vars
on the button
ActionScript Flash:
on (press) {
set_mute = _root.mute_ctrl.mute == “off” ? “on” : “off”;
loadVariables(“http://www.iceni.tv/mute/mute.php”, “_root.mute_ctrl”, “GET”);
}
and this is how i get the sound (its on a flv)
ActionScript Flash:
// take the audio out of the flv
my_video.attachAudio(myVideo);
var snd = new Sound("_root");
snd.setVolume(100);
// mute button turn off
mute_off_btn.onRelease = function(){
if (snd.getVolume(100)){
snd.setVolume(0);
mute_off_btn._alpha = 50;
}else{
snd.setVolume(100);
mute_off_btn._alpha = 100;
}
}
and the php code is
<?php
session_start();
//if the session index `mute` is not set, set it to `off`
if ( !isset($_SESSION['mute']) )
{
$_SESSION['mute'] = "off";
}
//if the GET variable `set_mute` is `on` or `off` set the SESSION variable `mute` as the same
if ( @$_GET['set_mute'] == 'off' || @$_GET['set_mute'] == 'on' )
{
$_SESSION['mute'] = $_GET['set_mute'];
}
//echo the mute value for flash
echo "mute=".$_SESSION['mute'];
?>
the web site address is http://www.iceni.tv
this code was written for me but i just don’t understand how to get it to work so all advise/help is very much appreciated. if my explanation is unclear let me know.
cheers
iceni