A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: something for the most l33t

  1. #1
    Senior Member RangrJay's Avatar
    Join Date
    Sep 2005
    Location
    Las Vegas
    Posts
    163

    something for the most l33t

    how would you take a back button in an html doc, and point it to a certain keyframe in a flash project??
    Xero Patience Studios
    Web Design
    Software Development
    Graphic/Logo Design

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    You can do it with an active page. The following is from a script that I used to vary the video playing in a window opened with javascript. Using this script I reuse the same window and SWF so that I did not have to create an SWF for each FLV. This example is ASP, but could be done in PHP.
    ASP:
    <%="<script language='javascript'>function setMovie(){window.document.flvPlayer.SetVariable(' fileName', "& Request.QueryString("playFile") & ")}</script>"%>

    ActionScript:
    var fileName

    function getMovie(){
    trace("checking for variable value")
    if(fileName){
    clearInterval (fileCheck)
    _root.main.setMedia (fileName, FLV)
    }else{

    }


    }
    var fileCheck = setInterval(getMovie, 1000)

    I am sure you can adapt this to do what you want.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Also might want to check out
    http://osflash.org/browserhistory
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  4. #4
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    can do it in javascript too, onload use location.replace to pass a querystring with ?redirect=32 appended, then document.open/write to send to new page that's same as the page we just left, minus that onload, and on the swf object put a flashvars that's populated by location.search.split("?").pop() - then in the swiff at the top of frame 1 just put gotoAndPlay(redirect||2);

  5. #5
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    moagrius, would you say your method is better than the link Kortex just posted? By 'better' I mean does it fix the known issues with Kenny Bunch's class?

    If so I'd be very interested in a longer explanation and sample files if possible. The back button problem has plagued me from day one and I'm tired of people getting angry at my pages because they innocently hit Back.

    I've tried Penners solution before but it just seemed like it should be simpler.

    My flash movies only have one frame and all navigation is handled with functions and moviecliploaders so I need something that can intergrate with that fairly easy. I'd be so stoked if I could retro-fit my last two sites with browser history.

    Thanks for any advice you may have.

  6. #6
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Should also mention that SharedObject is also a possibility.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  7. #7
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    long answer: i cant make the claim it's better - its just not dependant on server side script - truth is, i've never tried either way. i have, however, found success with location.replace in arenas others often describe as difficult - it's basically a splice into the browsers history object, and can circumvent a lot of the issues commonly experienced when dealing with the sinister back button. you probably know this already, but for the edication of anyone who doesnt - each page a browser serves "pushes" a copy of that page (a very good copy, including window scroll position, rendering of active content, etc) onto an array-ish object called "history". location.replace deletes an entry, and replaces it with the value - so say you go to mainpage, contactspage, affiliatespage, vendorspage, phonenumbers - then go back twice, landing you on affiliatespage - which has a button on it with location.replace("elsewhere.html"); you click that button, and youre now at elsewhere.html. if you hit the back button, you'll go back to contactspage, NOT affiliates page. if from there you hit forward, you'll go back to elsehwere.html, NOT affiliates.

    short answer: i dunno.

  8. #8
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    hmm i just looked more thoroughly at kortex's first solution - taht's not ASP at all really - its javascript inside ASP tags with a call to the querystring that can be easily emulated with pure js. here's a modification:
    Code:
    <script>
    function setMovie(){
    document.flvPlayer.SetVariable("fileName",location.search.substr(1).split("playBack=").pop())}</script>
    Last edited by moagrius; 06-17-2006 at 12:36 AM.

  9. #9
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    moagrius is correct. It is javascript that is written by ASP. The reason for this is so that you can get the GET variable (via the ASP) passed by a link to the page as passing variables from page to page with javascript can be tricky. So if you are not passing variables from page to page, the whole thing can be done in a single page (the setting a variable in flash) and calling javascript.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  10. #10
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Thanks for the explanation. It looks like I'll just have to pick a method and continue to tweek it until it does what I want.

  11. #11
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    kortex: you don't need ASP to retrieve GET variables, only POST. just pull everything off the url after "?", split it by "&", then split each of those by "=", stick the shift on an object as a key and the pop as a value, e.g.,
    code:
    function setquery(a){
    var b=[],c;
    for(c in a)b.push(escape(c)+"="+escape(a[c]));
    return "?"+b.join("&");}

    function getquery(a){
    a=a.split("?").pop().split("&"),b=a.length,c={};
    while(b){
    var d=a[--b].split("=");
    c[d.shift()]=d.pop();}
    return c;}

    var querystring="http://www.yoursite.com/somepage.php?somevar=someval&do=1&color=blue&gende r=male";
    var GET=getquery(querystring);
    trace(GET.gender);
    trace(GET.color);
    trace(setquery(GET));


  12. #12
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    moagrius
    Thanks, was not aware you could do that with strait javascript. That sould make my life a bit easier in the future.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


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