Solved

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

Posted on 2007-03-20
6
209 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
Comment Utility
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
Comment Utility
window.opener.someFunction();

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

Expert Comment

by:Jaax
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
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
Comment Utility
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
Comment Utility
thanx for Qaiser Mehmood Mughal and Jaax
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now