dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 33

Thread: Pop up boxes for websites

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    5

    Pop up boxes for websites

    I have made a website using flash MX 2004 and i have a thumb nail page of images. i want pop up boxes to appear with the whole image visable when you click on the thum nail. Anyone know how to do this easily?

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    you will have to use javascript.

    if you want to make an HTML page for each IMAGE (and possibly add other stuff, such as a close button..etc)

    go here..it will help you write the code:
    http://javascript.internet.com/gener...up-window.html


    if you just want to click a button in FLASH nd open a sized browser window (pop-up)

    you can use this code on a button:
    Code:
    on (release) { 
    getURL("javascript:NewWindow=window.open('page_containing_image.html','newWin','width=657,height=250,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);"); 
    }
    darn spaces:
    on (release) {
    getURL("javascript:NewWindow=window.open('page_con taining_image.html','newWin','width=657,height=250 ,left=100,top=100,screenX=100,screenY=100');NewWin dow.focus();void(0);");
    }
    make sure the javascript is ALL ON ONE LINE...and there are are no ODD spaces.. (sometimes the board does this)

  3. #3
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    For flash 8 users: There are new sandbox testing rules when using such things as javascript...When you publish the movie, Flash creates an HTML and a SWF on your local computer. Instead of testing the HTML, double click on the SWF to open it up in the local flash player. Once you click on one of your external javascript buttons, you will get a popup from the flash player, telling you that it can't do what you have asked unless you change the security settings. Click on the "settings" button, and follow the instructions, by clicking on the 'edit locations' drop down, choosing browse, and find the swf file (or folder) that you want to allow access. The easiest way to do it, is to create an allowed folder, then work with all of your flash files from within that folder.

    Another way to allow local testing is to go directly to macromedia's website, that has the settings manager. Note, that the flash movie that shows up on this link is actually pulling information from your computer and flash player, and is used to edit the allowed locations. The instructions are below the movie.
    http://www.macromedia.com/support/do...manager04.html

    This is only for testing on your local computer. It works fine from the server
    Last edited by DallasNYC; 02-28-2006 at 08:23 PM.

  4. #4
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    Hi
    I am using something like
    on (release) {
    getURL("javascript:NewWindow=window.open('page_con taining_ .aspx?','newWin','width=657,height=250,left=10 0,top=100,screenX=100,screenY=100');NewWindow.focu s();void(0);");
    }


    But I need to add a variable after the URL example:
    page_containing_.aspx?, ,+_root.points
    Where points is a variable, but it wont take it when appears in the new window´s URL, it shows "_root.points"

    How do I make points as a number?
    Tks
    Ale

  5. #5

  6. #6
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    I have a variable called: points
    When I open the new window the URL should appear as url, ,points
    points is a number
    Ale

  7. #7
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    hi-

    I understand, but post the CODE that you tried and lets see what you did wrong.
    (Im no expert at javaScript my any means) but you may just need to break out of the 'string' and then jump back in after the var.

    on (release) {
    getURL("javascript:NewWindow=window.open('page_con taining_ .aspx?'+points+,'newWin','width=657,height=250,lef t=10 0,top=100,screenX=100,screenY=100');NewWindow.focu s();void(0);");
    }

    or maybe

    on (release) {
    getURL("javascript:NewWindow=window.open('page_con taining_ .aspx?'"+points+",'newWin','width=657,height=250,l eft=10 0,top=100,screenX=100,screenY=100');NewWindow.focu s();void(0);");
    }

  8. #8
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    This is my code
    I tried this:
    getURL("javascript:NewWindow=window.open('http://mysite.aspx?, ,'"+_root.points+",'newWin','width=360,height=410, left=50,top=50,toolbar=No,location=YES,scrollbars= No,status=No,resizable=No,fullscreen=Yes'); NewWindow.focus(); void(0);");

    and

    getURL("javascript:NewWindow=window.open('http://mysite.aspx?, ,"+_root.points+"','newWin','width=360,height=410, left=50,top=50,toolbar=No,location=YES,scrollbars= No,status=No,resizable=No,fullscreen=Yes'); NewWindow.focus(); void(0);");

    Neither one works
    Ale

  9. #9
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    hi..did you try the suggestions above?

    I just tried using this:
    Code:
    on (release) {
    var points:Number = 17;
    getURL("javascript:NewWindow=window.open('page_containing_ image.html?"+points+"','newWin','width=300,height=300,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);");
    }
    NOTE: all one line..sometimes the forum puts spaces and line breaks in this code...so look at the at the value carefully.

    and this is the URL it was looking for:

    Firefox can't find the file at /C:/Documents and Settings/jdugan/Desktop/popUp_help/page_containing_ image.html?17

    a quick edit...

    Code:
    on (release) {
    var points = "id=17";
    getURL("javascript:NewWindow=window.open('page_containing_ image.html?"+points+"','newWin','width=300,height=300,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);");
    }
    gets this:
    Firefox can't find the file at /C:/Documents and Settings/jdugan/Desktop/popUp_help/page_containing_ image.html?id=17.

  10. #10
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    I don't know ASP, but in PHP, I think you need to send your variable name paired up with its value...

    myPoints=_root.points

    Where myPoints is the variable used in your server script.

    This yahoo example works for me...

    Code:
    on (release) {
    	mySearch = "cat";
    	getURL("javascript:NewWindow=window.open('http://images.search.yahoo.com/search/images?p="+mySearch+"','newWin','width=657,height=250,lef t=10 0,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);");
    }
    Like Whisper said before, make sure you fix any white space that flashkit might add to the line.

  11. #11
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    I need to put a ,
    It needs to be: http://mysite.aspx?80,Eng, ,Var
    Ale

  12. #12
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    Right. Well I dont know ASP, so I dont understand how all the commas work. Can you post an example of the whole string as you need it, using literals instead of passing the flash variable. Then confirm it works that way? It should be no problem adding the flash variables into the string at that point.

  13. #13
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    so your saying you need to pass more than one VAR into the URl string?..or those values will be 'hard coded'? and you need a "space" (empty value) in there as well?


    same example as I have posted above:

    Code:
    on (release) {
    var points = "id=17";
    getURL("javascript:NewWindow=window.open('page_containing_ image.html?80,ENG, ,"+points+"','newWin','width=300,height=300,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);");
    }
    looks for this:

    Firefox can't find the file at /C:/Documents and Settings/jdugan/Desktop/popUp_help/page_containing_ image.html?80,ENG, ,id=17.


    this also works:
    Code:
    on (release) {
    getURL("javascript:NewWindow=window.open('page_containing_ image.html?80,ENG, ,"+_root.points+"','newWin','width=300,height=300,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);");
    }
    with: var points = "id=17"; declared in frame 1 of the _root timeline.

  14. #14
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    There is only one var and it is points. The rest is hard coded
    Here is the whole string

    on(release){
    pepe = _root.pepe
    getURL("javascript:NewWindow=window.open('http://mysite.aspx?80,ENG,'',"+pepe+"','newWin','width=65 7,height=250,left=10 0,top=100,screenX=100,screenY=100', location=No,fullscreen=No);NewWindow.focus();void( 0);");
    }

    This doesn´t work
    Ale

  15. #15
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    on(release){
    pepe = _root.points
    getURL("javascript:NewWindow=window.open('http://mysite.aspx?80,ENG,'',"+pepe+"','newWin','width=65 7,height=250,left=10 0,top=100,screenX=100,screenY=100', location=No,fullscreen=No);NewWindow.focus();void( 0);");
    }
    Ale

  16. #16
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    well you have some 'stuff' in your code that is killing it.

    this works:
    Code:
    on (release) {
    var pepe = _root.points;
    getURL("javascript:NewWindow=window.open('page_containing_ image.aspx?80,ENG, ,"+pepe+"','newWin','width=300,height=300,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);");
    }
    in yours:
    Code:
    on(release){
    pepe = _root.points
    getURL("javascript:NewWindow=window.open('http://mysite.aspx?80,ENG,'',"+pepe+"','newWin','width=657,height=250,left=10 0,top=100,screenX=100,screenY=100', location=No,fullscreen=No);NewWindow.focus();void( 0);");
    }
    the 2 things in bold are whats causing the problems.

  17. #17
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    Can you post an example of the whole string as you need it, using literals instead of passing the flash variable. Then confirm it works that way?

  18. #18
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    I just copy and paste your code.
    Where the var supposed to be, it says "undefined"
    The URL says: http://page_containing_ image.aspx?80,ENG, ,undefined

    If I change pepe for 300 it works fine.
    But I need it to be a var
    Any sugestion?
    Ale

  19. #19
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    1.) whos code.. please post as much as you can.. It makes it hard when you post and do not give full info, liek whos code, what version..and either a .fla of the project yoru working on...or at least PASTE the code (all parts) so we can see what you may have overlooked.

    If your saying MY code.. it is IS a var.. its a string actually.. not just a number but "id=17" is the whole var I pass into the URL string.

    so either your _root var is wrong.. or your doing something else we cant see.

    Sounds like there is NO var on _root.. can you trace it?

  20. #20
    Junior Member
    Join Date
    Aug 2002
    Posts
    21
    I tried this and works

    on (release) {

    getURL("javascript:NewWindow=window.open('page_con taining_ image.aspx?80,ENG, ,"+_root.points+"','newWin','width=300,height=300, left=100,top=100, screenX=100,screenY=100');NewWindow.focus();void(0 );");
    }

    Somehow didn´t want it to take var pepe= _root.points
    Thank you very much for your help.
    Ale

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