Hello galgal1,
I took a look at the site you mentioned, and using Sothink SWF
Decompiler (available here http://www.sothink.com/ ) I took a look at
the code that's being used to perform this function. Basically each
button loads a ColdFusion page in the left (Nav) frame which has the
appropriate menu options. I'm guessing that the CF script then has
some code in it to open the appropriate page in the right frame.
That's one way of doing it, but there's a simpler way. You can just
work with frames and ActionScript.
As an example, let's say you have a page set up pretty much the same
way as the tctalent page. So there's a banner at the top, navigation
links on the left, and data on the right. Set this up as a frameset
of three frames. So, for instance, make an index.htm page with the
following frameset:
<frameset rows="*" cols="80,*" frameborder="NO" border="0"
framespacing="0">
<frame src="left.htm" name="left" scrolling="NO" noresize>
<frameset rows="150,*" cols="*" framespacing="0" frameborder="NO"
border="0">
<frame src="banner.htm" name="top" scrolling="NO" noresize>
<frame src="right.htm" name="right" scrolling="YES" noresize>
</frameset>
</frameset>
banner.htm has your flash file with the navigation buttons that will
run along the top of the screen. The left side of the screen is a
separate frame which contains left.htm and has some default image or
default navigation links. right.htm contains the content that sits in
the area under the banner. The frames are named, reasonably enough,
"top", "left", "right".
In your flash file, create whatever buttons you want, then set the
action for each one like this:
on (release) {
getURL("products_left.htm", "left");
getURL("products_right.htm", "right");
}
This would be for a button labelled "Products", obviously, so adjust
the file names in the code accordingly. products_left.htm would
contain the navigation links for the left side bar, products_right.htm
would contain the contents for the area under the banner.
The reason this opens the pages in frames, and not as two new windows,
is because the optional "window" variable of the getURL() function
names a new window if a new window is being created, but opens the
file in a frame if the frameset has a frame of the name being
referenced. So in this case the frameset in index.htm has both a
"left" and a "right" frame, which are what getURL() is referencing,
and so products_left.htm loads in the frame called "left" and
products_right.htm loads in the frame called "right".
Remember when you're creating the frameset and coding the button
actions that the frame names are case sensitive, so telling the button
to open in the "Left" frame will open a whole new window if the frame
in the frameset is called "left".
I hope this is clear enough and meets your needs. Good luck with your
site.
Hibiscus
Other links:
------------
Macromedia's support page about getURL():
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary377.html
Search Strategy: actionscript geturl frame, "flash mx" actionscript
frames |
Clarification of Answer by
hibiscus-ga
on
23 Jun 2003 13:35 PDT
Hi galgal1,
Okay, first to answer your problem with the page not being displayed
when you click your flash button. If the error message is going to
the right frame, you know at least that the frame name is right, so
your problem is certain to be related to the URL. You might want to
try using "/management_index.htm". The configuration of your server
might require the initial slash. Other than that you could try using
the full URL.
On to your other question. In order to make a link change two frames,
the easiest way is to use JavaScript. The simple way is to just add
some javascript code in to the link itself. So, for instance, if you
have:
<a href="left.htm" target="left">
which puts left.htm in the left frame, but you also want to put
right.htm in the right frame, you would do:
<a href="left.htm" target="left"
onClick="parent.right.location='right.htm'">
in place of parent.right.location, put in parent.<desired
frame>.location
Finally, in order to recreate the function of the tctalent page where
the bottom frames combine in to a single frame, you need to use nested
framesets. So, instead of defining all three frames in your index.htm
file, you would define two frames, an upper one and a lower one. The
source file of the upper one is the page containing your flash banner,
the source file of the lower one is a page containing another
frameset. The frames can be called 'top' and 'bottom' or whatever you
want. The page referenced for the bottom frame defines a new
frameset, dividing the 'bottom' frame into two frames of left and
right. You would name them as you did before, so for instance just
'left' and 'right'.
This ends up giving you a page which really has four frames. 'top',
'bottom', 'left', and 'right. 'left' and 'right' exist in the
'bottom' frame. Now, just as before, you can reference the left and
right frames from your banner or anywhere else by using the frame
names that you give to them, in this case 'left' and 'right'. But, if
you want to make the space a single frame, you can call a link from
either the left or the right frame with the target "_parent". This
will clear the frameset that is in the bottom frame, and will make the
link appear in the undivided 'bottom' frame. Similarly, if you had a
banner link that you wanted to display in the bottom frame without
division, you could just make a link with a target of 'bottom',
instead of linking the 'bottom' frame to a frameset.
Unfortunately to recreate a menu system like this using nothing but
frames and pages of HTML you're going to end up with a lot of files
very quickly. There isn't much you can do about that, so if you are
making a large site you should really consider a different navigation
system.
Good luck with it,
Hibiscus
|