A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Simple Hyperlink question

  1. #1
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017

    Simple Hyperlink question

    I know i've done this before, I just can't remember how..

    Say I have a navbar in flash. I click on button 1, and want the page to go index.php. How do I do this?

    Now, the problem that I'm having (aside from using _parent) is because I don't want the .swf to reload at the top of the page, so I think I'll have to use frames. Now, using frames kinda sucks, but I can live with it.

    How would I get the link to target the frame only? Or if you have a better way altogether of doing this, please let me know.

    Thanks,
    DaVulf

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    I think a frameset would be the easiest way to do that,

    Code:
    <html>
    <head>
      <title>My Document Title</title>
    </head>
    <frameset rows="20%,*">
     <frame src="navbar.html" name="nav">
     <frame src="main.html" name="main">
    </frameset>
    </html>
    then from your movie in the navbar page it could target the other frame using the frame name,

    getURL("index.php", "main");

  3. #3
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    That's not traditional 'old school' frames is it? (where you have the defined seperator going across the page)..

    I will try that out, thanks catbert.

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Yep, they're old school. you should be able to remove any visible borders from them though

    http://www.tizag.com/htmlT/frames.php

  5. #5
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    That was my next question actually. This is what I ended up with.

    http://www.niveau.ca/brian/test.htm

    Thanks again for the help catbert.

    edit: that remove frame thing works pretty swell actually. Another quick question, it says on that site that 'with CSS and php, frames are obsolete'. Does this mean I can accomplish the same thing with one of these? I'm actually going to be making the 'main.html' portion in php, so maybe that would be easier?
    Last edited by DaVulf; 06-24-2005 at 09:54 PM.

  6. #6
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Catbert, if you don't mind (or anyone else) I have another question.

    If you go to that link, you can see that there is a dotted line between the two pages, this is with using that prior code. How would I turn this off?

    edit: I've just ran into another issue. If you look at the page on a smaller resolution, then the scrollbar only scrolls the bottom section as opposed to the whole page, which makes all the graphics look ugly.
    Last edited by DaVulf; 06-24-2005 at 10:29 PM.

  7. #7
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    From the look of it the dotted line is caused by the hatching in the background images not lining up between the frames. This could probably be solved with a little trial and error by adjusting the height of the top frame by a pixel or 2 (then make sure the movie in the top frame is positioned at the bottom of its page to remove any gap between it and the content in the main frame)

    in the top frame you could also edit the CSS,

    Code:
    <style type="text/css">
    <!--
    body {
    	margin-left: 0px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-bottom: 0px;
    	background-image: url(bg0.gif);
    }
    -->
    </style>
    could be rewritten as,

    Code:
    <style type="text/css">
    <!--
    body {
    	margin: 0; padding: 0;
    	background: url(bg0.gif);
    }
    -->
    </style>
    as for CSS and PHP making frames obsolete - PHP would allow you to easily insert different pieces of content into a template page. Your template could contain the content that remains constant throughout the site (eg the navbar) and then the other content could be loaded as appropriate depending on what page the user is looking at. CSS could be used to present content in a way that it looked like it was in a frame. e.g. the overflow property would allow you to control the appearence of scrollbars around a section of the content if it grew too big.

    what they wouldn't do is allow you to have an area of the page that doesn't get reloaded when moving between sections.

  8. #8
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    I see, so that's the benefit of frames then.

    Hmm.. I just hope that even using frames that I can still pass a variable out of the .swf and have it picked up by the other main frame.

  9. #9
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    If you're passing a variable between movies in the frames you can use the LocalConnection object.

    this thread has an example - http://www.flashkit.com/board/showth...ocalConnection

  10. #10
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Catbert: the issue isn't passing a variable between movies, it's between flash and php. Would this work just like normal when using sendAndLoad?

  11. #11
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    yep, sendAndLoad should work as normal

  12. #12
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Okay great, thanks again catbert, you're a big help.

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