PDA

View Full Version : Flash + Jvascript



viktor
06-04-2005, 03:04 AM
I need help to combine the following two codes. Javascript code uses two images to show if user got any messages. I want to use Flash button instead of regular images.
No new messages button code:


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="183" height="30" align="left">
<param name="movie" value="http://home.ripway.com/2005-5/316598/viktorix_button.swf">
<param name=quality value=High>
<param name="BGCOLOR" value="ffffff">
<param name="_cx" value="10848">
<param name="_cy" value="1323">
<param name="FlashVars" value>
<param name="Src" value="http://home.ripway.com/2005-5/316598/viktorix_button.swf">
<param name="WMode" value="Window">
<param name="Play" value="0">
<param name="Loop" value="-1">
<param name="SAlign" value="left">
<param name="Menu" value="-1">
<param name="Base" value>
<param name="AllowScriptAccess" value="always">
<param name="Scale" value="ShowAll">
<param name="DeviceFont" value="0">
<param name="EmbedMovie" value="0">
<param name="SWRemote" value>
<param name="MovieData" value>
<param name="SeamlessTabbing" value="1">
<embed src="http://home.ripway.com/2005-5/316598/viktorix_button.swf" width="554" height="50" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#FFCC00"></embed></object>


New mail button code:


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="183" height="30" align="left">
<param name="movie" value="http://home.ripway.com/2005-5/316598/viktorix_button2.swf">
<param name=quality value=High>
<param name="BGCOLOR" value="ffffff">
<param name="_cx" value="10848">
<param name="_cy" value="1323">
<param name="FlashVars" value>
<param name="Src" value="http://home.ripway.com/2005-5/316598/viktorix_button2.swf">
<param name="WMode" value="Window">
<param name="Play" value="0">
<param name="Loop" value="-1">
<param name="SAlign" value="left">
<param name="Menu" value="-1">
<param name="Base" value>
<param name="AllowScriptAccess" value="always">
<param name="Scale" value="ShowAll">
<param name="DeviceFont" value="0">
<param name="EmbedMovie" value="0">
<param name="SWRemote" value>
<param name="MovieData" value>
<param name="SeamlessTabbing" value="1">
<embed src="http://home.ripway.com/2005-5/316598/viktorix_button2.swf" width="554" height="50" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#FFCC00"></embed></object>


Now the javascript code:


<script type="text/javascript">
<!--

// New/No new PM button in menu

// Image to show there are new private messages
var newPM = "http://home.ripway.com/2005-5/316598/addfriend.gif";

// Image to show there are no new private messages
var noPM = "http://home.ripway.com/2005-5/316598/house.gif";

var pmLink = document.createElement("a");
var pmImg = document.createElement("img");
var pmCell = document.getElementsByTagName("td").item(2).innerHTML;

pmLink.href = "http://viktorix.hyperboards3.com/index.cgi?action=pm_view";
pmImg.border = "0";

if(pmCell.match(/you have <.+?>, (\d+) /i)){
switch(RegExp.$1){
case "0" :
pmImg.src = noPM;
pmImg.title = "You have no new private messages.";
break;
case "1" :
pmImg.src = newPM;
pmImg.title = "You have 1 new private message.";
break;
default :
pmImg.src = newPM;
pmImg.title = "You have " + RegExp.$1 + " new private messages.";
}
pmLink.appendChild(pmImg);
document.getElementsByTagName("td").item(5).appendChild(pmLink);
}

//-->
</script>


As you can see javascript code has url link to inbox (http://viktorix.hyperboards3.com/index.cgi?action=pm_view) This url was already added to flash buttons. I need to know how can I use flash buttons with this code because this code switches them when mail arrives. I understand this might be difficult, thanks for your help!

viktor
06-04-2005, 10:37 PM
Can anyone provide an input on this puxxle ?