metazai,
[quoted text, click to view] > Trying to get the last frame of my javascript to replace the
> layer my flash is in with a static html layer on the page.
This opening statement turns out to be pretty ambiguous. Words like
"frame" and "layer" have significantly different meanings in ActionScript
from those they have in HTML. Based on your sample code, I *believe* you're
trying to communicate with the HTML document in which the SWF is embedded.
[quoted text, click to view] > As to the error, Firefox says flashopen and Layer2 are not
> defined. IE says 'visible' is undefined.
Generally, this occurs when a scripting language cannot reference an
object, for some reason or another.
[quoted text, click to view] > I'm confused, and need another few sets of eyes on this. Any
> help or comments would be appreciated.
Let's take a swing at it. :)
[quoted text, click to view] > Here's the layers:
>
> HTML Code:
First off, let's clarify. The word "layer" in Flash means horizontal
rows in a timeline. You create layers in the Timeline panel of Flash and
add artwork and/or ActionScript to frames of a layer. The word "layer" in
HTML could mean anything from the non-standard Netscape <layer> tag to a
generic concept that refers to a combination off CSS and block level HTML
elements (often <div>, but practically any element).
[quoted text, click to view] > <style>
> #flashopen {
> position:relative;
// <code snipped />
> }
> </style>
So far, we have two CSS (Cascading Style Sheet) rules defined in an HTML
document. Each seems to define the style of what might be called a "layer"
in the HTML sense.
[quoted text, click to view] > getURL("javascript:flashopen.style.visibility=none;");
> getURL("javascript:Layer2.style.visibility=visible;");
> stop();
Here, we have three lines of ActionScript in a Flash movie. Line 3
stops the timeline in which this script lies. Lines 1 and 2 invoke the
getURL() function, using javascript: as the protocol. The javascript:
protocol is perfectly valid, and its purpose is to communicate with the
SWF's host (presumaby an HTML document, in this case).
These two lines are your problem. The CSS above (in your <style>
elements) are not an example of JavaScript. They are CSS, which isn't a
programming language. When your browsers complain that certain objects are
not defined, they're doing so because, in fact, you haven't defined anything
in JavaScript at all.
It looks to me like you're trying to use JavaScript to turn one HTML
"layer" off and another on. You'll need to write a JavaScript function in
your HTML document itself that handles this, then invoke that JavaScript
function from your ActionScript.
Leave the CSS as is. Here's how your JavaScript might look ...
<script type="text/javascript">
function toggleHtmlLayers() {
document.getElementById("flashopen").style.visibility = "none";
document.getElementById("Layer2").style.visibility = "visible";
}
</script>
Here's how your ActionScript might invoke the new JavaScript ...
getURL("javascript:toggleHtmlLayers();");
David
stiller (at) quip (dot) net
"Luck is the residue of good design."