Solved

Geting parent document object, while calling a new page from flash.

Posted on 2007-03-20
6
215 Views
Last Modified: 2008-03-06
Hey Experts!

I have a ParentWindow (asp page\ which contains a Flash Movie, when user clicks on a link on Flash Movie it opens a PopupWindow. Now I want to execute a script located on ParentWindow when PopupWindow gets closed.

Need urgent reply.
0
Comment
Question by:imrancs
6 Comments
 
LVL 10

Assisted Solution

by:Jaax
Jaax earned 200 total points
ID: 18754713
In your popup you should have

<script>
 function fnExecuteMainFunc(){
   window.opener.parentWinFunc(); // parentWinFunc is the function in the parent window
}
</script>

<body onunload="fnExecuteMainFunc()">
.....

</body>
0
 
LVL 10

Author Comment

by:imrancs
ID: 18754768
window.opener.someFunction();

This gives null reference to the parent window.
0
 
LVL 10

Expert Comment

by:Jaax
ID: 18754913
I think the pop-up is not opened by a javascript but by some other means. Would it be possible for you to open the pop-up using javascript code
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 63

Expert Comment

by:Zvonko
ID: 18755036
You neen to do two things:
1.) Give the parent window a name by script. Do that by placing on parent page anywhere this script:
<script>window.name="flashWindow";</script>

If the parent window is a Frame or Iframe, then upper script line is not neccessary. Then you need the frame or iframe name. If you do not know the name find the name like this:
<script>alert(window.name);</script>

2.) On the popup window where you want to call the parent window function do this script:
<script>
function callParenFunction(){
   var parentWindow = window.open("","flashWindow","top=90000");
   parentWindow.yorParentWindowFunctionName();
}

callParenFunction();
</script>




0
 
LVL 5

Accepted Solution

by:
Qaiser_Mehmood_Mughal earned 300 total points
ID: 18755181
Okey.
If you are opening the popupWindow from flash movie then "Jaax" Code will be worked.

and if you are just opening the new window not popup then the "Jaax" code will not worked.

so just tell me first is you are opening the popup window or new window using link.

if you are just opening the new window then open popup to find the right solution.

here is the code to open the popup window from flash movie.

--------------------------------------------------------------------------------
place this code in action of the button or link button on press
on (press){
fscommand("popup", "http://www.macromedia.com/");
}

then include the following script tag in ur parent window.
<script Language="JavaScript" event="FSCommand (command, args)" for="theMovie">
if (command == "popup") {
    window.open(args, "mmwin", "width=500,height=300");
}
</script>

I think this will help you.


0
 
LVL 10

Author Comment

by:imrancs
ID: 18755199
thanx for Qaiser Mehmood Mughal and Jaax
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question