A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: buttons help

  1. #1
    Member
    Join Date
    Jul 2006
    Posts
    56

    buttons help

    im trying to make buttons like this:

    http://www.templatemonster.com/websi...tes/10398.html

    but i cannot get it

    does anyboy know how to do this? i think i need it to determine what web page your on so that button will become "lit also"
    does anybody know what i mean and can help me?
    thank you

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    is this just for a FLASH header?? embedded into a HTML pages with the rest of the content being HTML?

    If so..then yes, you do need to check what page you are on...to keep that button 'lit'..

    you can do this with either javaScript or through the swfObject you use to embed your .swf into your HTML page.

    or you can use a sharedObject.

  3. #3
    Member
    Join Date
    Jul 2006
    Posts
    56
    ooh i knew it was going to have to be more coding
    do you know of anyplace i could get a script like that?

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    depends on which method you want to take... there are two links in my footer that cover the sharedObject and the URL > FLASH links will helps.. also if you search there was a method posted on how to use the swfObject as well

    launchpad76 posted in.. I was in the thread as well..

    her is the link to the swfObject site:
    http://blog.deconcept.com/swfobject/

    Code:
    <script type="text/javascript">
       var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
       so.addVariable("variable1", getQueryParamValue("variable1"));
       so.addVariable("variable2", getQueryParamValue("variable2"));
       so.write("flashcontent");
    </script>
    
    will grab variables variable1 & variable2 from the URL/query string..  these will automatically be loaded/available in _root of your document once the movie loads.

  5. #5
    Member
    Join Date
    Jul 2006
    Posts
    56
    ok, so then how will i get the swf to use these? i feel so stupid

  6. #6
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    you do and you dont.. LOL

    you pick a method and implement it..

    either the javaScript way (like the URL > FLASH link in my footer) or the swfObject way (posted above)..
    once you have done this the variable in the URL/QUERY string will be loaded and ready for you to use on _root. before you movie even starts.


    heres a quick example..

    1.) create your header/navigation FLASH movie.. so that it can accept a VARIABLE when the movieLoads..and then that movieClip will play/trigger (looking like its activated/down)
    so make your nav... each button is a movieClip.. with two frames... both frames have stop actions.
    frame 1: button text in BLACK
    frame 2: button text in ORANGE

    do this for all the buttons you want.

    use this code in the main timeline:
    if(_root.pageID == "home"){
    link1.gotoAndStop(2);
    }
    if(_root.pageID == "about"){
    link2.gotoAndStop(2);
    }
    if(_root.pageID == "email"){
    link3.gotoAndStop(2);
    }

    save/publish your .swf & HTML page..

    go to the HTML you just published and create a copy..
    edit the source code and embed your .swf using this code..

    Code:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>swfObject_varCheck</title>
    </head>
    <body bgcolor="#ffffff">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!-- saved from url=(007)about:internet -->
    
    
    <script type="text/javascript" src="swfobject.js"></script>
    		
    <div id="flashcontent">
      This text is replaced by the Flash movie.
    </div>
    
    <script type="text/javascript">
       var so = new SWFObject("swfObject_varCheck.swf", "URL_varCheck", "395", "125", "8", "#FFFFFF");
       so.addVariable("pageID", getQueryParamValue("pageID"));
       so.write("flashcontent");
    </script>
    
    
    </body>
    </html>
    now you need to call your pages like this:

    instead of:

    www.somesite.com/home.html

    it will be

    www.somesite.com/home.html&pageID=home

    and so on
    www.somesite.com/home.html&pageID=home
    www.somesite.com/about.html&pageID=about
    www.somesite.com/email.html&pageID=email

    etc..etc so flash can read the pageID variable at the end..

    see attachment.
    Attached Files Attached Files

  7. #7
    Member
    Join Date
    Jul 2006
    Posts
    56
    ok i tried really really hard to do this on my own, i feel like a pest. but anyway i cannot get the urls like that! i downloaded the file and uploaded it to my host i tried everything i could think of (without coding something) and nothing worked, on another forum i use for webdeveloping help i asked and what they game me didnt really help. thats like all i need and i think (until i start making my flash header) all i will need. do you think you can explain to me what im doing wrong, or should i just give up lol?

  8. #8
    Member
    Join Date
    Jul 2006
    Posts
    56
    Quote Originally Posted by Shannighan
    ok i tried really really hard to do this on my own, i feel like a pest. but anyway i cannot get the urls like that! i downloaded the file and uploaded it to my host i tried everything i could think of (without coding something) and nothing worked, on another forum i use for webdeveloping help i asked and what they game me didnt really help. thats like all i need and i think (until i start making my flash header) all i will need. do you think you can explain to me what im doing wrong, or should i just give up lol?
    apparently you cannot edit a post on here, so i just wanted to say that i figured it out! can you believe it! i just needed to change one little thing, instead of having it search for the pageID i just set it what i wanted it to be right into the embed script.
    thank you for all of your help!

  9. #9
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Im not sure what the problem is..you arent giving us much..just 'cant do it' and 'wont work' basically..LOL

    That header I uploaded works fine.. but it needs a variable in the URL...
    the banner will do NOTHING unless it has a variable in the URL string called pageID

    and pageID has to have the value of one of the pages coded in the .fla (home, about, email..etc)

    I dont understand what you mean by:
    but anyway i cannot get the urls like that! i downloaded the file and uploaded it to my host i tried everything i could think of
    you just type that at the end.. thats all..

    on all the buttons.. in FLASH.. and all the HTML links.. (basically any button or link that will change/load a new page) need to have the
    ?pageID=home
    ?pageID=about
    ?pageID=email
    etc..etc..

    at the end..

    if you have your code on a FLASH button that looks like this:

    on(press){
    getURL("home.html");
    }

    it needs to be like this:

    on(press){
    getURL("home.html?pageID=home");
    }

  10. #10
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    update: if you downloaded the file..and uploaded it to your webhost..

    then when you open it..

    type:
    ?pageID=home

    at the end in the URL bar.. and it enter.. the button will highlight.. edit home and put about in there..the about button will light up...


    I didnt put it on the buttons....so you could see how it works...

  11. #11
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Quote Originally Posted by Shannighan
    apparently you cannot edit a post on here, so i just wanted to say that i figured it out! can you believe it! i just needed to change one little thing, instead of having it search for the pageID i just set it what i wanted it to be right into the embed script.
    thank you for all of your help!

    glad it all worked out...

    you can do it either way.. (as mentioned in both links in my footer)

  12. #12
    Member
    Join Date
    Nov 2005
    Posts
    37
    Is there a way to make this work without the PageID? I need to use this script for pages like index.php, about-us.php and so on? 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