?
Solved

Flash window.open after geturl with target _self

Posted on 2007-07-24
18
Medium Priority
?
1,192 Views
Last Modified: 2012-08-14
Scenario:
Flash file with two links, embedded in an html-page.
First link uses geturl(javascript: window.open ...) to open another correctly sized, no-menu-bar html-page.
Second link uses geturl('http: ....', '_self') to open a .ram file (real media)
Second link targets _self to avoid opening a blank page before streaming media-file.
Now if I press second link, then first link doesn't work anymore. Seems to me as if Flash loses reference to html-page after .ram plays, and therefore cannot execute javascript.
Can anybody help me out on this?
0
Comment
Question by:tsm_tn
  • 6
  • 4
  • 4
  • +2
18 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 19559846
Perhaps you only do not see the opened window by first link because it is not focused?
Extend the window.open() to this:

javascript:nw=window.open();nw.focus;


0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19559850
Sorry, focus needs braces:
javascript:nw=window.open();nw.focus();

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19559879
can you show what exactly your getUrl() string is?

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tsm_tn
ID: 19563459
I dont think you understood me.
Sequence one:
Open flash site
Press first link - works fine
Press second link - works fine
Press first link again - doesn't work any more.

Sequence two:
Open flash site
Press second link - works fine
Press first link - doesn't work

So the problem occurs after performing a geturl with target _self. When this link is clicked, then the first link isn't working anymore
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 19565428
target "_self" means you are loading the RAM file into the browser... so you should actually be going to a new page or RAM file as it is...

can you post a link to your files?


rp
0
 

Author Comment

by:tsm_tn
ID: 19567942
exactly rp ..
The .ram file opens and the browser-window stays with the loaded flash file. That's the trick ... meaning that I open a .ram file without navigating away from the browser-window with the flash.
But after the .ram file is loaded into the browser the flash cannot launch a geturl(javascript: window.open .. command.

I cannot give the link because it is on intranet .. but if you like I can create a flash file with the same scenario.
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 19568027
so if I am interpretting what you are saying, it is like...

- clicking on a link in HTML
- the page starts to load
- before it loads, you click another link

you want the other link to work right?

Why?  at the very least this is poor user experience and should be avoided.

it sounds like the issue is more about how long it takes to have the RAM open.


you should be looking intot that problem instead.


rp

0
 

Author Comment

by:tsm_tn
ID: 19573305
No rp .. you have misunderstood ..
Check this test-link:
http://thami.homepage.dk/test.html
Actionscript on link 1:
on (release) {
getURL("javascript: window.open('http://thami.homepage.dk/angry.html','','width=500,height=455,menubar=no,resizable=no,status=no,scrollbars=no'); void(0);");
}

Actionscript on link 2:
on (release) {
getURL("http://thami.homepage.dk/ugachaka.ram", "_self");
}

Now you try press link 1 then link 2 ... so far working .. try link 1 again ... error ..
Or try refresh page then press link 2 .. working .. press link 1 .. not working
0
 

Author Comment

by:tsm_tn
ID: 19594399
Is there no flash-expert to find a neat trick on this ?
0
 
LVL 1

Expert Comment

by:vanpevi
ID: 19599398
rascalpants is a flash-expert... :D

did you try the same stuff by replacing http://thami.homepage.dk/ugachaka.ram by a usual html page ? I'm wondering if the problem is not linked to Ram Player...

when it doesn't work anymore, did you try a double-click on link one, it opens a download pop up on my computer...
0
 
LVL 1

Expert Comment

by:vanpevi
ID: 19599492
An other solution could be adding the sound in the library of the main library and using the "linkage" stuff on ugachaka.ram with the name "ugachaka"...

Then on the first frame put:
  clipSound = new Sound();
  clipSound.attachSound("ugachaka");
  stop();

On your button2, put:
  on (release) {
      clipSound.start(0,1);
      playing = true;
  }

Just a solution to make your project moving forward...

A beginner... ;o)
0
 

Author Comment

by:tsm_tn
ID: 19599531
hi vanpevi
If I placed an ordinary html-page then I would be navigating out of flash ..

 ... your last trick would make my swf huge because I am going to link to a bunch of corporate videos ..
0
 
LVL 1

Expert Comment

by:vanpevi
ID: 19599675
Ok, with your new infos, let's forget the second solution...

About the first one, you could load the html page (linked to the ram) in a movie clip...

Couldn't?

0
 
LVL 1

Expert Comment

by:vanpevi
ID: 19599801
I'll stop to spam this topic with my last solution:
-convert all your movie to swf format (create a bat file to do that automatically)
-use loadmovie
-enjoy your site...
0
 
LVL 22

Accepted Solution

by:
rascalpants earned 1500 total points
ID: 19600304
"rascalpants is a flash-expert... :D"    thanks V!


yeah tsm, I did misunderstand you...


and it looks like this has nothing to do with Flash...  BUT, I have made an example that might work for you.

http://www.rascalpants.com   <delete these spaces>    /ram_link_test/


here is what I am using in Flash:

btn1.onRelease = function() {
      getURL("javascript: window.open('http://thami.homepage.dk/angry.html','','width=500,height=455,menubar=no,resizable=no,status=no,scrollbars=no'); void(0);");
}

btn2.onRelease = function() {
      getURL("javascript: window.open('ram.html','','width=5,height=5,menubar=no,resizable=no,status=no,scrollbars=no'); void(0);");
}

you just need to change out your getURL code with something similar...

and this is the source of my ram.html page:


<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">

function openRAM(){

      window.location.href = "http://thami.homepage.dk/ugachaka.ram";
      setTimeout("window.close()", 500);
}

</script>

</head>

<body onload="openRAM()">
</body>
</html>



I am basically opening up a new window... changing the location reference, and then closing that window...    and if you don't want the window to be viewable, you can add some code in the javascript function that places the window off of the screen.


rp
0
 

Author Comment

by:tsm_tn
ID: 19606826
Hi rascalpants
I guess this will be the solution. I had already been thinking about this solution, but I thought that "window.close" would invoke an alert box from IE. So therefore I didn't even test it.

Well anyway thanks ya all guys .. I think that I will press the accept as solution button now ..
Thanks rascalpants
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 19606977
Rock 'n Roll..
       ;Z
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 19612822
BTW...  since you are using javascript to open the window, you will not get an alert when you window.close it


rp
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

850 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