A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: open pre-defined window

  1. #1
    Member
    Join Date
    Jan 2001
    Location
    Toronto, Ontario
    Posts
    53
    I have several thumbnails on my website. When I click on them I get a larger jpg in it's own html file. I would like these jpg's to open to their actual size only. I have tried using javascript but can't get it to work. Go to http://www.geocities.com/eyeondesign2001 and click on photoshop to see what I mean. Thanks.

  2. #2
    YH Jelly Llama Jockey defuzz's Avatar
    Join Date
    May 2001
    Posts
    464
    This is what I use:


    But it doesn't work out how big the picture is, it depends on teh code on the button/keyframe



    Code:
    STUFF TO PUT IN THE HEAD TAGS OF YOUR HTML  :
     
     
    <script language="JAVASCRIPT" type="TEXT/JAVASCRIPT">
    <!-- 
    if(screen){ 
    topPos=0 
    leftPos=0 
    } 
    function getPage(thePage,wt,ht){ 
    leftPos= (screen.width-wt)/2 
    topPos = (screen.height-ht)/2 
    newWin1 = window.open(thePage,'aWin','toolbars=no, resizeable=no,scrollbars=no,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
    } 
    // --> 
    </script> 
    
     
     
     
     
    ACTION TO PUT ON YOUR BUTTON/IN YOUR KEYFRAME IN FLASH:
     
    on (release) {
     getURL ("javascript:getPage('http://www.yoursite.co.uk/yourpicture.jpg',300,300)");
    }




    this should do the trick, change the 300,300 to teh size of you photograph and the yoursite.co.uk bit to your site obviously, should work for a relative path eg just yourpic.jpg.

    get back to me if you are having problems with it.




  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    hi Lola
    Code:
    on (release) {
    	getURL ("javascript:window.open('http://www.geocities.com/eyeondesign2001/webad.jpg','Webad','width=375,height=400,top=0,left=0,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no');void(0);");})
    This code works with a button directly in Flash, nothing else. good luck!
    gparis

  4. #4
    YH Jelly Llama Jockey defuzz's Avatar
    Join Date
    May 2001
    Posts
    464
    byt he way, it looks complicated as it also loads in teh centre of the page.

  5. #5
    Senior Member
    Join Date
    Jun 2001
    Posts
    148
    Make your button action as below:
    On (Release)
    Get URL ("javascript:launchwin('http://www.url.com', 'newwindow', 'height=150,width=300')")")
    End On

    You have to have this code in your HTML page for the javascript to work:

    <!--
    Popup Window
    <SCRIPT LANGUAGE="JavaScript"> var javascript_version = 1.0; </SCRIPT>
    <SCRIPT LANGUAGE="JavaScript1.1"> javascript_version = 1.1; </SCRIPT>
    <SCRIPT LANGUAGE="JavaScript">
    var newwin;
    function launchwin(winurl,winname,winfeatures)
    {
    //This launches a new window and then
    //focuses it if window.focus() is supported.
    newwin = window.open(winurl,winname,winfeatures);
    if(javascript_version> 1.0)
    {
    //delay a bit here because IE4 encounters errors
    //when trying to focus a recently opened window
    setTimeout('newwin.focus();',250);
    }
    }
    </SCRIPT>

    The quick and easy way (or import this to dreamweaver):::::
    Publish your movie with HTML as well as SWF. Open your HTML and right click view source. Add this Code between the <Head> and </Head> tags and save as Whatever.html. Now your button should work.

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    hi Flashtrack,
    your AS is Flash4. in Flash5 it should be:
    on (release) {
    getURL ("javascript:launchwin('http://www.url.com', 'newwindow', 'height=150,width=300')");}

  7. #7
    Member
    Join Date
    Jan 2001
    Location
    Toronto, Ontario
    Posts
    53
    Thanks everyone for your help, I appreaciate the help. However I still can't do it. I've tried each and every code that you posted but I still can't make it work. I am new to this so maybe I'm doing something wrong. Can someone please go and look at my website, click on photoshop and then click on my first science logo. Since I implimented the javascript I only get a blank page in this one and the webad one also. I will keep trying though, thanks.

  8. #8
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    my mistake sorry. i had an extra ')' at the end of the code. erase it and it will work now. like in:
    on (release){getURL ("javascript:window.open('http://www.geocities.com/eyeondesign2001/webad.jpg','Webad','width=375,height=400,top=0,lef t=0,toolbar=no,scrollbars=no,resizable=no,menubar= no,status=no,directories=no,location=no');void(0); ");}
    gparis

  9. #9
    Member
    Join Date
    Jan 2001
    Location
    Toronto, Ontario
    Posts
    53
    I can't seem to write in exactly what you have written. My code looks like this - getURL ("javascript:window.open('http://www.geocities.com/eyeondesign2001/webad.jpg','Webad','width=375,height=400,top=0,lef t=0,toolbar=no,scrollbars=no,resizable=no,menubar= no,status=no,directories=no,location=no');void(0); \");}\r\n");

    I can't get rid of the ending.

  10. #10
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    go to expert mode (arrow top right corner) and copy paste.
    gparis

  11. #11
    Member
    Join Date
    Jan 2001
    Location
    Toronto, Ontario
    Posts
    53
    Fantastic! It worked! And it looks great. Thank you SO much.

  12. #12
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    gooood!! now you understand how it works, right? you know where to change the address and dimensions for your other pop ups?
    gparis

  13. #13
    Member
    Join Date
    Jan 2001
    Location
    Toronto, Ontario
    Posts
    53
    Yes, I understand exactly. One more question though: If you go to my website now the webad and science logo are working but you can see a white rim around the picture. It's not there in photoshop. Any reason for this that you know of? I would like to remove it if possible, but if not it's ok. I'm just glad I finally got the windows the way I wanted them...thanks to you. Thanks for all your help.

  14. #14
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    maybe the white rim is a trace of the background (which must be white #FFFFFF) of the html page which holds the jpg. check both dimensions of jpg and pop up. you could go minus one pixel for your pop up height and width, maybe.
    gparis

  15. #15
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    actually i went and check your pop up. in the html that holds the jpgs you should add these in the body tags:<BODY bgcolor="#FFFFFF" MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0">
    hope this helps
    gparis

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