Flash window.open after geturl with target _self

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?
tsm_tnAsked:
Who is Participating?
 
rascalpantsCommented:
"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
 
ZvonkoSystems architectCommented:
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
 
ZvonkoSystems architectCommented:
Sorry, focus needs braces:
javascript:nw=window.open();nw.focus();

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ZvonkoSystems architectCommented:
can you show what exactly your getUrl() string is?

0
 
tsm_tnAuthor Commented:
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
 
rascalpantsCommented:
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
 
tsm_tnAuthor Commented:
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
 
rascalpantsCommented:
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
 
tsm_tnAuthor Commented:
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
 
tsm_tnAuthor Commented:
Is there no flash-expert to find a neat trick on this ?
0
 
vanpeviCommented:
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
 
vanpeviCommented:
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
 
tsm_tnAuthor Commented:
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
 
vanpeviCommented:
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
 
vanpeviCommented:
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
 
tsm_tnAuthor Commented:
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
 
ZefferCommented:
Rock 'n Roll..
       ;Z
0
 
rascalpantsCommented:
BTW...  since you are using javascript to open the window, you will not get an alert when you window.close it


rp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.