Google Answers Logo
View Question
 
Q: Multitask flash button ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Multitask flash button
Category: Computers > Software
Asked by: galgal1-ga
List Price: $10.00
Posted: 21 Jun 2003 16:48 PDT
Expires: 21 Jul 2003 16:48 PDT
Question ID: 220218
Hi,
I would like to know how to make a button using Flash MX that has 2 or
more tasks. For instance if you would look on the website
www.tctalent.com, please click on one of the buttons in the banner and
watch what happens. As you can see the frame with all the buttons on
the side changes and new buttons appear, and the frame to the right
with the picture also changes and something else appears. I would like
to know how to make a button (using flash mx) that opens two frames at
once.

Thank you and have a great day.
Answer  
Subject: Re: Multitask flash button
Answered By: hibiscus-ga on 21 Jun 2003 21:19 PDT
Rated:5 out of 5 stars
 
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

Request for Answer Clarification by galgal1-ga on 22 Jun 2003 10:29 PDT
Thank you for the quick responce. Your answer was very helpful to me.

Can I ask you one more thing? The thing is I thought I knew how to
make the menu on the left using Front Page Xpress. My website looks
just like TCT's so if you would go back to www.tctalent.com and this
time you click in one of the buttons on the left side (the menu)you
will see that the menu changes and the frame on the right also changes
or if you click on Models and then Models Login you will see that the
two frames disappear and all that is left is the top banner frame and
the frame in the middle. I would like to know how to do both of these
things and please give me a script if that is what I need in order to
do this.

Have a wonderful day!

Request for Answer Clarification by galgal1-ga on 22 Jun 2003 16:00 PDT
Hello,

I did what you said about the banner. What happens is when I click the
button the two frames that are suppose to change do change, but it
displays "page connot be displayed" instead of the page I want it to
display. The codes I wrote were:
on (release) { 
 getURL("management_index1.htm", "home"); 
 getURL("management_index.htm", "home1"); 
}

Because they are buttons do we have to write the whole URL and make a
target somewhere else?

Thank you for your help!

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
galgal1-ga rated this answer:5 out of 5 stars
He was very helpful in everything I needed.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy