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?
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.
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.
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?
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.
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(); }
}
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.
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:
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.