A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Linking HTML

  1. #1
    Junior Member
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    20

    Linking HTML

    When you visit my website it has a button that says 'Open Popup', when you open the popup you have some lame flash animation that has 4 links to go to 4 different sub websites of my entire website. So now, there are 2 windows, one is a normal window with that Open Popup page on it, and then there is the one with the flash animation on the 800x600 popup with no toolbar, no resize, no anything. I want the links on the flash animation to be able to go to the normal HTML page that has the open popup link on it. How would I do this? I'm assuming it's a target such as _blank, _parent, _self, or something else?

    If you want a more visual look go to: http://dille-zone.com

    on (release) {
    getURL("http://dille-zone.com/forum/","_self");
    }

    Is the command I'm using for the forum at the moment and _self didn't work, I would use _blank but I don't want more than 2 windows opening up, I don't want to aggravate the user.

    Thanks in advance,
    Mark Dille

  2. #2
    In javascript you have "window.opener" property. This will hold a reference to the window that opened your popup window.
    Use an fscommand in your swf to call the javascript.

  3. #3
    Junior Member
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    20
    I have absolutely no clue what that means man. lol sorry I'm new to flash, I don't know how to use an fscommand and what do I do to call on the javascript?

  4. #4
    This is harder to explain than to actually make it work. I would suggest to read a little in the Flash help:
    Action Script Reference Guide > Working with externam data > Sending messages to and from flash player > Using fscommand()

    If you follow the example, change your javascript to:

    function theMovie_DoFSCommand(command, args){
    if (command=="go"){
    window.opener.location = args;
    }
    }

    Change your actionscript to
    on(press){
    fscommand("go", "myurl.htm");
    }

    This will open "myurl.htm" in your original window.

  5. #5
    Junior Member
    Join Date
    Feb 2001
    Posts
    12
    below is the current javascript i use to open my movie window

    now i am not a programmer, so how do i replace the previous code to reflect the below code to work w/ the fscommand?

    BTW how do successfully post JS in the post? it keeps cutting off half my message? thanks all on this board for the great help, its easy to learn by example!

    -----------

    function NewWindow(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl +',scrollbars='+scroll+',resizable'
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }
    Last edited by section8; 06-23-2004 at 03:40 PM.

  6. #6
    The theMovie_DoFSCommand() code goes in that windows that you opened. Not in the opener. So you don't need to change anything in your code, nor in my code, just put them in the right place.

  7. #7
    Junior Member
    Join Date
    Feb 2001
    Posts
    12
    still not working for me.

    does "location"

    function theMovie_DoFSCommand(command, args){
    if (command=="go"){
    window.opener.location = args;
    }
    }


    have to be changed to something?

  8. #8
    Junior Member
    Join Date
    Feb 2001
    Posts
    12
    ok, i have spent a better part of a week tryingt o figure this out. all i have figured out is that i suck at javascript, and coding in general.

    i have attached some test files. can someone puhleeeze help a poor coding retard out?

    much good kharma will follow!
    Attached Files Attached Files

  9. #9
    Junior Member
    Join Date
    Feb 2001
    Posts
    12
    bueller? bueller?



    heeeeeeelp...

  10. #10
    Junior Member
    Join Date
    May 2004
    Posts
    22

    very little javascript to do

    you don't have to do much javascript at all and you don't have to use the fscommand, all you really need to do give the window a name. To do this, all you need to do is add this javascript to the top of the window between the head tags and of course in javascript tags.

    window.name = "mainwindow";

    Now after you do that make your link target to mainwindow in actionscript like this:

    on(release){
    getURL("http://testing.com", "mainwindow");
    }

    Now, after you get that done you come across a problem, the window doesn't come forward after the stuff changes. Well, here's how you fix that. Add this javascript to the top of each of the pages that open up in "mainwindow".....make sure you put this in between javascript tags:

    window.focus();


    Hope this helps.....if you have any more questions, let me know.

    Jay
    Code:
    <script language="javascript">
    Last edited by headlessb; 07-12-2004 at 11:55 PM.

  11. #11
    Junior Member
    Join Date
    Feb 2001
    Posts
    12
    solution!

    //place this in Pop Up window:

    <script language="java script">

    function LocationsWindow (whatWindow){window.opener.location=(whatWindow);} function changewindow (){window.close();}

    </script>

    //(javascript should be one word)

    Place this Action on the Button:

    on (release) {_ _getURL("javascript:LocationsWindow('http://www.yahoo.com')");

    works great!

    thanks to Josh of GeckoWebsystems.com & AntiCrombie

  12. #12
    Junior Member
    Join Date
    Feb 2001
    Posts
    12
    solution!

    //place this in Pop Up window:

    <s cript language="java script">

    function LocationsWindow (whatWindow){window.opener.location=(whatWindow);} function changewindow (){window.close();}

    </s cript>

    //(javascript should be one word)

    Place this Action on the Button:

    on (release) {_ _getURL("javascript:LocationsWindow('http://www.yahoo.com')");

    works great!

    thanks to Josh of GeckoWebsystems.com & AntiCrombie

    not sure how to post code here...

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