SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 31
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    redirect to new url when flash video ends

    Hi, flash noob here. I would like to embed a video into a flash file, and then embed the swf in an html. What I want to happen is that when the video ends, it redirects the user to another URL in the same browser window. Any help?

    Thanks!

  2. #2
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your embedding the video direct onto the timeline then all you need to do is create a blank key frame just after the last frame of your video and then add getURL code
    Example:
    Code Actionscript:
    getURL("yourpage.html","_self")
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  3. #3
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and how could you add random URL's when flash video ends so that user gets randomly to different parts of a website?

    any tips/hints appreciated!
    thanks

  4. #4
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,514
    Mentioned
    37 Post(s)
    Tagged
    1 Thread(s)
    Put the urls in an array and pull one out using a randomly generated number as the array index

  5. #5
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code Actionscript:
    function randRange(min:Number, max:Number):Number {
       // Generate a number between and including min  max
       var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
       return randomNum;
       }
     
    //build array to hold url's
      var urlArray:Array = new Array();
      urlArray[0] = "url1";
      urlArray[1] = "url2";
      urlArray[2] = "url3";
      urlArray[3] = "url4";
      urlArray[4] = "url5";
      // Get random number created
      var n:Number = randRange(0, urlArray.length);
      // 
       getURL(urlArray[n], "_self");
    Something like that maybe
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  6. #6
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I have tried so far is the following:

    Code Actionscript:
    var urls : Array = ['http://inkenrohweder.com/?page_id=119','http://inkenrohweder.com/?page_id=26','http://inkenrohweder.com/?page_id=121','http://inkenrohweder.com/?page_id=123','http://inkenrohweder.com/?page_id=125']
    var index:Number = Math.floor(Math.random() * urls.length))
    url = urls[index]

    and I've added the following as on a button:

    Code Actionscript:
    on (release){
    getURL(url, window);
    }

    however, I get a syntax error. Would any of you see on the fly what is missing in the above?

    ta, in the meantime I have a go what Paul has suggested,

  7. #7
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Paul, this has worked a treat! thanks :-) is there also a way to set random URLs on a "skip intro" button?

  8. #8
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code Actionscript:
    function randRange(min:Number, max:Number):Number {
       // Generate a number between and including min  max
       var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
       return randomNum;
       }
     
    //build array to hold url's
      var urlArray:Array = new Array();
      urlArray[0] = "url1";
      urlArray[1] = "url2";
      urlArray[2] = "url3";
      urlArray[3] = "url4";
      urlArray[4] = "url5"
     
    someButton.onRelease=function(){
    var n:Number = randRange(0, urlArray.length)
    getURL(urlArray[n], "_self");
    }
    Something like that.

    More examples of using random here.
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  9. #9
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    thanks also for supplyting the AS code for adding random hyperlinks to a button. I have tried this and when testing i don't get any errors but it seems like the links are not going anywhere.

    Basically I use the first AS for the automated re-direct as quoted by you on its own layer on the timeline:

    Code Actionscript:
    function randRange(min:Number, max:Number):Number {   // Generate a number between and including min  max   var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;   return randomNum;   } 
    //build array to hold url's  var urlArray:Array = new Array();  urlArray[0] = "url1";  urlArray[1] = "url2";  urlArray[2] = "url3";  urlArray[3] = "url4";  urlArray[4] = "url5";  // Get random number created  var n:Number = randRange(0, urlArray.length);  //    getURL(urlArray[n], "_self");

    and on the next layer i add the following AS enabling to click the animation and get directed to random URLS:

    Quote Originally Posted by [Paul Ferrie] View Post
    Code Actionscript:
    function randRange(min:Number, max:Number):Number {
       // Generate a number between and including min  max
       var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
       return randomNum;
       }
     
    //build array to hold url's
      var urlArray:Array = new Array();
      urlArray[0] = "url1";
      urlArray[1] = "url2";
      urlArray[2] = "url3";
      urlArray[3] = "url4";
      urlArray[4] = "url5"
     
    someButton.onRelease=function(){
    var n:Number = randRange(0, urlArray.length)
    getURL(urlArray[n], "_self");
    }
    Something like that.

    More examples of using random here.
    can you see with that where I'm going wrong? Do you need the link of where the animation is placed?

    thanks a lot for your help,

    best, Daniela

  10. #10
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your using/declaring the same code on different layers then there is likely to be a conflict. Can you post your fla?
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  11. #11
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by [Paul Ferrie] View Post
    If your using/declaring the same code on different layers then there is likely to be a conflict. Can you post your fla?
    here is the link to download the zipped version of the fla.

    http://inkenrohweder.com/intro_inkenrohweder.zip

    Let me know when you have downloaded it so I can remove it again from the server. thanks!

  12. #12
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kiwiAMS View Post
    here is the link to download the zipped version of the fla.

    http://inkenrohweder.com/intro_inkenrohweder.zip

    Let me know when you have downloaded it so I can remove it again from the server. thanks!
    Got it thanks
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  13. #13
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You had a duplicate array and function.
    http://www.scotflash.co.uk/share/int...enrohweder.zip
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  14. #14
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright, i just tried to open it but maybe you saved it in a newer version of flash? am still working with flash 8 .... I get an unexpected file error when trying to open it

  15. #15
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok that's going back a bit. I am using CS5.5

    Just place the code on the last frame with what is below
    Code Actionscript:
    // Get random number created  
    var n:Number = randRange(0, urlArray.length);
    //    
    getURL(urlArray[n], "_self");
    stop()
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  16. #16
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so basically it was just adding a stop() at the end of the AS in last frame? that's what i've done now. however, the animation works, clicking the button still doesn't work and when the animation has finished no random redirect to url's is happening.

  17. #17
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah yeah sorry you need to give the button an instance name "someButton"
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  18. #18
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    super duper! it works a treat now, thanks so much for your help!

  19. #19
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kiwiAMS View Post
    super duper! it works a treat now, thanks so much for your help!
    nice one
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  20. #20
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Paul, hello! or anyone else who has an idea :-)
    with the piece of flash you helped me with (see above) we are experiencing a random "undefined" URL error.
    I'm attaching a screenshot.
    Any ideas what this is causing?
    thanks
    Daniela.
    Attached Images Attached Images

  21. #21
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How often does it happen and is it in a particular browser?
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  22. #22
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when it happens, then a couple of times after each other, primarly on Safari and FF on Mac. have just tested it about 20 times on PC IE and FF, and there it didn't happen.

  23. #23
    SitePoint Guru [Paul Ferrie]'s Avatar
    Join Date
    Oct 2007
    Location
    Glasgow, Scotland, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah sorry. I don't have mac so this is where my help runs dry. Hopefully someone else will be able to help you out that has a mac.
    .:To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Glasgow Flasher
    bringmadeleinehome.com

  24. #24
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did some more tests and on Safari the following happened:

    10x fine
    3x undefined
    1x fine
    1x undefined
    4x fine
    1x undefined
    12x fine
    1x undefined
    5x fine

    today I couldn't get the undefined page on Firefox but it did appear there before as well, much less than with safari

    does this make any sense to you?

  25. #25
    SitePoint Enthusiast kiwiAMS's Avatar
    Join Date
    Feb 2007
    Location
    Amsterdam
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any mac flashers/actionscripters out there which might be able to help?


Bookmarks

Posting Permissions

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