PDA

View Full Version : flash movie controlling DHTML layers' visibility


bside
7-1-03, 05:14 PM
hello all,
i have a site that i've been building. for one reason or other, i have some text that is going to be in a DIV tag layer above a flash movie (worked out this problem already with "param name="wmode" value="transparent").
But i want to be able to turn the visiblity of these layers that rest above the movie from within the movie by clicking on buttons and within some dynamic text.
I am pretty sure this is possible, but i need to know the javascript and how to implement it in flash.
let me know if i'm making any sense.

in the page that holds the site i have this script:

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function myMovieLevel1_DoFSCommand(command, args) {
if (command == "MM_showHideLayers") {
MM_showHideLayers();
}
}



and the actionscript is:
onClipEvent (enterFrame) {
fscommand(MM_showHideLayers, "'myLayer','','show'");
}


This doesn't seem to be working (and i bet your laughing at me)
The actionscript takes place in a swf that is loaded into level(1) of movie that is embeded in the html.

please help me! i think my head's about to implode.

thanks,
b

bside
7-1-03, 06:56 PM
i found a solution and thought i'd share.

in order to show and hide layers of DHTML that are layed out over a flash movie, the following needs to happen.

in the html, you need to have this parameter set:
PARAM NAME="WMode" value="Transparent"
(enclose the line above in < and >)

and of course the javascript for showind and hiding layers (this is dreamweaver's default code):
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>


Then in Flash, your actionscript should read something like:
onClipEvent (load) {
getURL("javascript:MM_showHideLayers('layerName,'','show') ");
}

(where layerName is the name of the layer you want to show)
(and no spce inbetween "java" and "script")

I hope this helps somebody or at least leads way to some understanding of something else.

Thanks powwebbers,
b

bside
7-2-03, 05:09 PM
thought i'd update myself on what's going on.

the above solution only seems to wok ONCE when browsing through the movie/site. so i'm at a loss.

my appologies for anyone who has looked at this and tried to no avail. however, if there is anyone who knows of a better way, could you please post? i've been trying to figure out the "fscommand" feature, but it is very confusing to me. maybe someone could help me with that? i just want to use the above mentioned javascript (MM_showHideLayers) i suppose i don't understand where all the "commands" and "parameters" go and the help file only confuses me more with "args"

arg,
b