A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: simple nav issue

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    7

    simple nav issue

    Hi guys and gals,

    I'm a programmer by trade (PHP/MySQL) but I have been lumped with more and more flash work lately and to be honest I haven't the dandiest about flash :P

    I have made a really, really simple flash banner for a website where the navigation sits inside and uses a 'getURL' to find the next web page.

    It worked fine until I came across a small issue. The link it gets is like this: "http://www.mydomain.com/folder/"

    This works a treat....buuuuut, you can access our website without the www prefix (http://mydomain.com) which means that the flash nav stops working....

    help!

    Any idea's how I can fix this? Your help is greatly appreciated!

  2. #2
    Senior Designer
    Join Date
    Jul 2001
    Location
    Australia
    Posts
    367
    So getUrl("http://mydomain.com"); doesn't work?

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    7
    Yes that works, however if you were to go to the domain as http://www.mydomain rather than http://mydomain then I have the same issue but reversed. So I'm damned whichever route I go.

    It makes no sense.

    Now in PHP I can use $_SERVER['DOCUMENT_ROOT'] to get the root directory. Does flash support anything like this so i don't have to specify the www?

  4. #4
    Member
    Join Date
    Mar 2009
    Location
    Brooklyn, NY
    Posts
    77
    Have you tried just using relative links?

    That should bypass the whole problem of the www vs no www.

    Or are you linking from different levels of folders? I don't think I've tried the /folder method in flash. But it'd be worth a shot.
    Break it until it works.

  5. #5
    Junior Member
    Join Date
    Apr 2009
    Posts
    7
    hey cessnajumpin

    Because of the design of the site, the banner and hence navigation is used as an 'include' file compiled in PHP.

    So for each page you visit, the flash is 'called in' from its main location, so relative links won't work.

    It's so very strange, I can't believe it doesn't support both prefixed and non-prefixed addresses.....then again, nothing in flash makes much sense to me :P

  6. #6
    Member
    Join Date
    Mar 2009
    Location
    Brooklyn, NY
    Posts
    77
    Hmm...
    The only thing that's coming to me off the top of my head is to use pass in $_SERVER['DOCUMENT_ROOT'] as a variable through flash vars. That way, you could have php define whether or not flash uses the www.

    Permadi has a pretty good tut to help set that up:
    http://www.permadi.com/tutorial/flashVars/index.html
    Break it until it works.

  7. #7
    Junior Member
    Join Date
    Apr 2009
    Posts
    7
    Cheers mate, that sounds like it could well be the option I'm looking for!

    I'll give it a go and get back to you!

    Thanks again!

  8. #8
    Junior Member
    Join Date
    Apr 2009
    Posts
    7
    I must be doing something wrong in the flash itself because I can't for the life of me get this thing to work. Here's what I have that works fine if you have the 'www' prefix in your browser:

    Code:
    home_btn.onRelease = function() {
    getURL("http://www.mydomain.com/index.php");
    }
    portfolio_btn.onRelease = function() {
    getURL("http://www.mydomain.com/web/index.php");
    }
    contact_btn.onRelease = function() {
    getURL("http://www.mydomain.com/contact/index.php");
    }
    So if I am using a flashvar of:

    Code:
    <param name=FlashVars value="webroot=<?php $_SERVER['DOCUMENT_ROOT']; ?>">
    Then how do I call it into Flash? Again, any help muchly appreciated

  9. #9
    Member
    Join Date
    Mar 2009
    Location
    Brooklyn, NY
    Posts
    77
    Alright, so what you'll need to do (and I'm going to assume that you have to run AC Content. If not then just disregard the first step) is this:

    1) In your HTML inside of AC_FL_RunContent array just add
    Code:
    'FlashVars',"webroot=<?php echo($_SERVER['DOCUMENT_ROOT']); ?>",
    2) Within the object tag add a new param tag
    Code:
    <param name="FlashVars" value="webroot=<?php echo($_SERVER['DOCUMENT_ROOT']); ?>" />
    3) In the embed tag add
    Code:
    FlashVars="webroot=<?php echo($_SERVER['DOCUMENT_ROOT']); ?>"
    That should set it up for flash to be able to receive the variable. Then to access the variable you just call it within the getURL function:
    Code:
    getURL(webroot + "/web/index.php");
    If your scope isn't at the root level then you would need
    Code:
    getURL(_root.webroot + "/web/index.php");
    And hopefully that should do it
    Break it until it works.

  10. #10
    Junior Member
    Join Date
    Apr 2009
    Posts
    7
    Legendary.

    It wouldn't work because I was using 'swf object' instead of runcontent.

    I might see if I can get it to work in swf object so I can keep my W3C rating.

    Thanks ever so much, you're a legend!

  11. #11
    Member
    Join Date
    Mar 2009
    Location
    Brooklyn, NY
    Posts
    77
    Oh great, swfobject is even easier. I'm not at a point where I can double check to make sure my syntax is right, but I'm pretty sure all you have to do is declare a new variable like this:
    Code:
    <script type="text/javascript">
       var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#FFFFFF");
       so.addVariable("webroot", "$_SERVER['DOCUMENT_ROOT']");
       so.write("flashcontent");
    </script>
    Break it until it works.

  12. #12
    Junior Member
    Join Date
    Apr 2009
    Posts
    7
    okay cool. I couldn't get it to work but I will come back and have a look at this shortly!

    Thanks again for all your help, mad thanks

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