Hi, guys.
Probably we all face this problem at some point in our lives. I’m trying to create a site with HTML pages and Flash based navigation, which basically means that the site content itself is standard in HTML/CSS format, but the main menu bar with the buttons and all is an SWF file. Needless to say, each lit-up button on the menu bar has to dim out on release and take to the corresponding page, e.g. clicking the ‘Contact Us’ button would cause it to dim out (as if unavailable) and open the ‘Contact Us’ page. Clicking a different button afterwards, would re-light the previous button and dim-out the newly clicked button and take to the page that corresponds to the newly clicked button, etc, you get the idea. There are 4 buttons for 4 pages.
Anyway, so far I’ve tried two methods which have failed:
Method A. **
I exported four duplicate SWFs from the same FLA, with the only difference being the one unique button dimmed out and the other three lit up (a total of 4 combinations). Then, I put a different SWF on each page. This, the ‘Contact Us’ page would have the copy of the SWF with the ‘Contact Us’ button already dimmed out; the ‘Home’ page would have the one with the ‘Home’ button dimmed out, and so on. The obvious problem with this approach is that an SWF needs to load over again every time the page changes, which results in a brief, but, nonetheless, annoying enough blink. I hoped to combat this latency issue by loading all bitmap elements in the flash files externally, as opposed importing them to the library. I assumed that since all SWF copies accessed the exact same bitmaps from the exact same location, they would be cached in the memory somehow and not need to be loaded every time, so there’d be no latency. Then again, I was two days younger. This method failed. As Eric Bogosian’s character said in the movie Under Siege 2, “Assumption is the mother of all”… (you-know-what-ups).
**
Method B.
At a couple of other message boards, I was suggested another technique, which would require only one single SWF. A guy gave me a tiny peace of Java Script that would use a variable to inform flash about which page is called so it would know which button in the menu bar to dim out. Although this technique rid me of the necessity to use multiple SWFs, it didn’t fix the nasty blinking problem AT ALL!!!
**
Method C. **
I was also advised to “put info in a div and generate server requests to bring the appropriate info up”. “You need to use ASP or PHP or some other server language” he said. Well, ASP is absolutely out for me, so I won’t even consider it. As for PHP, unless there exits a very simple and straight-forward tutorial with source files, which I could very easily figure out, modify, and implement for my needs, I can’t get into it because since I don’t know PHP, it takes me a really long time to learn how to do a simple thing with it, which is something I can’t afford right now with my deadline and all.
I’m basically down to
Method D.
I basically want to put the page contents into an iFrame window. Even all drawbacks of using iFrames considered, I still thing this is the optimal way for me. So here’s where I currently am on this:
I learned how to change the iFrame content using a function. Here’s a simple test example, and here are the HTML and JavaScript codes for that example:
<!-- This is the iFrame.HTML file code-->
<head>
<script src="changeurl.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css">
<!--
body {
background-color: #343434;
}
-->
</style>
</head>
<table width="800" border="0" align="center" bordercolor="#343434">
<tr>
<td><iframe runat="server" align="top" style="border:0px dotted purple scrolling = "auto="Auto"" frameborder="0" marginheight="0" marginwidth="0" name="login"
src="http://www.psychoform.com/htmlgallery/transformers.1.htm" width="800" height="400"
id="myFrame"></iframe></td>
</tr>
</table>
<p align="center">
<input type="button" value="change url"
onclick="changeURL('http://www.psychoform.com/htmlgallery/matrix.htm')"/>
</p>
//and this is the 'changeurl.js' file code
function changeURL(towhat)
{
document.getElementById('myFrame').src=towhat;
}
What I need now is to be able to call that JavaScript function and pass it the URL argument using action script instead. This tutorial explains how to do it, but I don’t fully understand it and I’d appreciate it if you or anyone could elaborate how exactly I can apply that to my case.
[SIZE=1]PS. I really appreciate your time.[/SIZE]