A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: how best to use a flash menu on web page?

  1. #1
    if you go first
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    62

    how best to use a flash menu on web page?

    Hi guys,

    I have been dabbling with flash for a while now, but want to start doing things properly.

    I've volunteered to do the website for my local sports council, this is what i have so far:
    http://www.pc16.net/chris/test/div.php
    (I'm trying to improve my prototype http://sportstevenage.co.uk)

    How can I load the unique content without using iframes? It really goes pair-shaped for users with small resolutions (for this reason, I've decided to use <div>s instead).

    Can I use javascript (or FSObject) to replace a <div> ?

    What's best here?

    Thanks in advance,
    Chris
    <insert witty signature here>

  2. #2
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Make one navigation swf and put it on every page. Use getURL to load the other pages.

  3. #3
    if you go first
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    62

    wanted the flash menu not to reload

    Sorry,

    I could do that, but it's an awful lot of work. If you look at my site, the menu moves and changes depending on what page is loaded (into the iframe).
    http://www.pc16.net/chris/test/div.php

    I'd rather just use css than have to make a whole array of swf files which would each need updating whenever the site changes.

    I was hoping that someone tell me something about using Flash and javascript together.

    Thanks,
    Chris
    <insert witty signature here>

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    maybe use CSS and LAYER your FLASH menu over the HTML..using the z-index. (never really used it or looked into much

    and you would still only have 1 menu.swf...you just use an #include statement to add it to every HTML page as suggested above...same thing you do for a consistant header/footer throughout a site.

    a 3rd option..would be to NOT load your next HTML page on the CLICK of the button..but rather when the 'sliding animation' was complete....
    on the NEW page that loads..just have the menu open at that point again...flash can read a variable in the URL of an HTML page..and display the correct menu 'look'

  5. #5
    if you go first
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    62

    hmm... we're getting close...

    Hi Whispers,

    Thanks for trying to help!

    How does a SWF read variables? Are these php variables?
    That would solve my problem if the reloaded menu could go straight to a particular "state".

    ( I've used getURL with "post" and "get" before, so I understand what happens the other way round )

    ...However, what I was thinking was to use javascript - much like the SWFObject.js for embedding SWFs available on these boards. Instead of replacing the contents of the <div> with the swf file, I could replace the MAIN <div> with other pages. I'd have to use FSObject in making the .fla files, though, right?

    Does that make sense? (I'm pretty tired now!)

    Anyone know how to do this?

    ps - I've been changing things, but here's the link:
    http://www.pc16.net/chris/test/div.php
    Note: Clicking on "About Us" loads the old Flash menu. This is like what I want to happen with the main <div> but with the proper content.

    Thanks,
    Chris
    Last edited by flashMine; 06-28-2006 at 08:35 PM. Reason: making something clearer
    <insert witty signature here>

  6. #6
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    you can use a little bit of javaScript and..and the .swf can then read the URL of the HTML..and pick out the VARIABLE from there..

    example how it pertains to you.

    you click on a link in your menu... it plays the sliding down animation (although why it does that..I dont know...there are NO sub-links...and if there were this would get harder)...at the end of the sliding animation..you have a FRAME action that says getURL... this calls another HTML page..however the url is calls is like so:
    getURL("http://www.whatever.com?page=contact");

    when your "contact" HTML page loads....the .swf (MENU) will read this variable in the URL string.....you will have code that says:

    Code:
    if (page == contact) {
        _root.menu.gotoAndStop("contactState");
    }else if (page == home) {
        _root.menu.gotoAndStop("homeState");
    };
    etc..etc..on and on until you check against all your possible options..

  7. #7
    if you go first
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    62

    ok...

    thx, I understand all that, but exactly how does the .swf get the variables (page etc.) from the url?

    What is the function?

    thaks again,
    chris


    ps - the animation is all done by actionscript, and i was planning to have submenus. i'll have to figure out how best to deal with that after i sort out the fundamentals, like how the menu interacts with the page.

    pps - i'm not happy with the way the animation looks. maybe i'll load flash submenus across using the SWFObject.js ( just like the "about us" link loads the original red menu in its place.
    <insert witty signature here>

  8. #8
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    sorry..I thought I had mentioned it... there are two links in my footer.. the first I think will help you more:

    urlVar > Flash 1 2 & embedVar > Flash

  9. #9
    if you go first
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    62
    oh, wow!

    I had no idea you could append variables on there just like php... fantastic!

    Can you add multiple variables in the same way:
    movie.swf?firstVar=something&secondVar=somethingEl se ???

    thanks a lot - I'll figure out some way of doing this now.

    Kindest regards and thanks
    Chris
    <insert witty signature here>

  10. #10
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    I believe you can add more than one variable in the URL string lke that...however I just havent dont it..I only did it with 1 for a test...

  11. #11
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Here's an example. Try it.
    Attached Files Attached Files

  12. #12

  13. #13
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    I don't know what the ampersand in the object tag will do, or if flash will read it as a separate variable. It might, it can read txt file variables that way. I just haven't done it either, and don't have the time to try.

  14. #14
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    yep..I just tried it in my example... didnt even have to change any code..(unless I wanted to trigger somethign with those vars...I just added another var to the "URL" and pulled in all vars on _root..shouldnt be a problem at all.. ..this is different that pulling in a hardcoded var from the HTML code..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center