FORUMS: list search recent posts

How to place a 'HOME' button on content page?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Thaher Pelaseyed
How to place a 'HOME' button on content page?
on Jan 19, 2011 at 7:28:35 pm

I am working on a simple web page designed using Adobe Flash CS3 Professional.

So far I have managed to generate the following:

1. A video background.
2. A vertical menu consisting of 4 options.
3. Content, in timeline respresented by frames, coupled to each and every option in my vertical menu.

Everything seems to work just fine. When I render my project, I am able to click on the menu that then navigates to different pages.

Now, here is my problem:

I want to place a button on each every content frame and I want this button, respresented by (X), to direct the visitor back to the main page, that is the frame that only displays my vertical menu and not contents. I have managed to do this for my first menu option simply by adding the following AS code:

BACK.addEventListener(MouseEvent.CLICK, clickBACK);
function clickBACK(event:Event):void {
trace("HOME");
gotoAndStop("HOME");
}

The problem is that I do not know how to apply this procedure for the other remaing three menu options. At this stage my 'Home' button represented by (X) is shown on content but is not actiove, that is nothing happens when I click on it.

I hope you can provide som helpful ideas!


Return to posts index

demetri tashie
Re: How to place a 'HOME' button on content page?
on Jan 19, 2011 at 8:21:27 pm

you would probably be better off by NOT using a timeline based navigation.

but if you are using it, try to have your file constructed so that ALL the buttons carry over ALL the frames,
and that all the content frames do have frame labels ( 'Home', 'About', etc etc )

then the code you wrote, placed on the first frame, should go to the frame with the frame label 'Home' every time a button with the instance name 'Back' is clicked.


if not, there is some problem in the structure of your site file, which we would need more info to figure out.

duplicate your code and substitute the instance names of the buttons, and their corresponding frame labels and you should be fine:
BACK.addEventListener(MouseEvent.CLICK, clickBACK);
function clickBACK(event:Event):void {
trace("HOME");
gotoAndStop("HOME");
}

about_btn.addEventListener(MouseEvent.CLICK, clickABOUT);
function clickABOUT(event:Event):void {
trace("About");
gotoAndStop("About");
}

bios_btn.addEventListener(MouseEvent.CLICK, clickBIOS);
function clickBIOS(event:Event):void {
trace("Bios");
gotoAndStop("Bios");
}


Return to posts index

Thaher Pelaseyed
Re: How to place a 'HOME' button on content page?
on Jan 19, 2011 at 10:23:48 pm

Hi, and thanks for all the help.

I still can't figure it out though. I have uploaded my file so maybe you have a quick look. I hope my problem becomes clearer to you after you publish it.

As you can see clicking on 'BAR' generates a content area with the header 'BAR' and random text. Clicking on 'X' on the top right corner 'closes' the content area. This is exactly what I want to achieve, however I can not make it work for the other three options in the menu.

The test file can be downloades here http://f1.creativecow.net/file/1518/1518_barkinotest.fla.zip


Return to posts index


demetri tashie
Re: How to place a 'HOME' button on content page?
on Jan 19, 2011 at 11:29:40 pm

there were a few things wrong with this file set up ( besided the fact that it is timeline based navigation ! )

and just note that actually clicking 'Back' WAS going back to the frame label 'HEM'. it is jus that your content was not being removed.

i made a few adjustements to your file, and it should be working as expected.
you will see that i moved ALL the code to be ONLY on the first frame.

i also removed the 'Back' button from your content frames - you had an instance of it in all the different frames ( bad, as it had the same instance name..) i removed it and put it in the first frame and just made it invisible in the first frame. clicking on a content button , besides navigating to the correct frame, will also turn on the visibility to the 'Back' button. clicking on the 'Back' button takes you to the 'Hem' frame, AND turns off the visibility of the 'Back' button.

hope that makes sense

1519_1518barkinotest2.fla.zip


Return to posts index

Thaher Pelaseyed
Re: How to place a 'HOME' button on content page?
on Jan 19, 2011 at 11:38:23 pm

Wow! Thanks a lot! I will look into it and try to understand your changes. It works perfectly now.

One final question: You reacted to the structure of the file, i.e. time line based navigation. I am, as you understand a beginner, som I wonder what are the pros and cons of my approach and what other ways are there to generate a similar website based on flash. I would love to read/look through some tutorials if there are any available out there.

Thank you, again!


Return to posts index

demetri tashie
Re: How to place a 'HOME' button on content page?
on Jan 19, 2011 at 11:55:01 pm

using a timelined based navigation is seen as being not up to date with the latest methods and attempts to move towards a full OOP means of coding.

in all reality - it is still fine, especially for very simple applications, such as the one you made. but on the other hand, being fairly simple, your site would also be very easy to make or adapt to being a " 1 frame main timeline' file.

for instance, each of your content areas, now on individual frames, could easily be turned into separate movieclip symbols - 1 for each former 'page'/frame. then your button functions, rather than navigating to individual frames, could just turn on and off the visibilities of the needed section/movieclips - much like i did with the 'back' button.

it's just something to start thinking of if you want to go further with your learning and coding. i hope that makes sense. don't sweat it at all for now - i just feel an obligation to mention it, rather than keep re-inforcing more out dated modes of coding with flash.


Return to posts index


Thaher Pelaseyed
Re: How to place a 'HOME' button on content page?
on Jan 19, 2011 at 11:59:22 pm

OK, great! Thank you for your advice and the much needed help with the file.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]