View Full Version : [CS3] Pop up media player from button
stonecutter
06-26-2008, 07:55 PM
Good day everyone--
I have a Flash site that is built for photography. I would like to add a couple videos that I will create, most likely .avi, but can convert to any format. There is no room on the site to embed a media player, so I will need a popup player for the videos. Currently I have a photo configured as a button:
on (rollOver) {
gotoAndPlay("s1");
}
on (rollOut, releaseOutside) {
gotoAndPlay("s2");
I believe I need to configure the "hit" portion with JavaScript code as well as adding to the HTML file, I'm just not sure about the verbiage to use. Any hints greatly appreciated.
thanks!
gnomeontherun
06-26-2008, 09:19 PM
I'm sorry I'm not sure I understand what you are asking exactly.
Here is a link to something that sounds like what you might be describing, but if not could you try to explain a little more?
http://www.actionscript.org/resources/articles/22/1/Pop-Up-window-within-flash/Page1.html
stonecutter
06-27-2008, 02:13 AM
Thank you for the link. I will try to describe more:
On one of my pages I have a small picture that I configured as a button so that a user will click on it and it will bring up a popup media player to play a video file. I have the button configured with the mouse rollover, and now I just need to configure the "hit" portion that will bring up the popup.
In that link, it talks about the getURL function. I'm not sure what the input should be when it talks about "somepage.html" being the file or URL to popup. Maybe I'm overthinking it?! I have an HTML and .swf file that I published from the .fla file. So if I have a video, ie: test.avi, that resides in that directory, how to I point to that so it will popup with the player?
I hope that makes sense. (brand new to Flash) I can explain more if needed.
thanks!
gnomeontherun
06-27-2008, 06:19 AM
Here is the documentation about getURL.
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001730.html
So what are you opening in the window? Are you just linking to a video? If so I would advise against that. If possible I would put the video inside of a flash video player.
stonecutter
06-27-2008, 05:27 PM
Thanks Jeremy. You are correct- I'd like it to be a Flash video player that plays the video, not just a link to the video. I just don't have anywhere on the site to embed it, so that's why it needs to be a popup window.
gnomeontherun
06-27-2008, 06:16 PM
Ok great. You will have to embed it in a web page still, and then pop it up. If you don't have a video player try http://www.*******************/?item=JW_FLV_Player.
Then you can use javascript to pop open a new window the right size. Just put the javascript commands in the getURL command.
stonecutter
06-30-2008, 07:29 AM
Thanks! I downloaded the player and FTP'd it up.
Is this the syntax I'm supposed to use? This is the path to the video on my site.
on (release) {
getURL("javascript:openNewWindow('http://mydomain.com/videos/testvideo.flv','thewin','height=350,width=500,toolbar=no,scrollbars=yes')");
}
I also used the setup wizard on the ******************* site, so I have some "embed" code for the HTML file. Is that supposed to go into the same HTML file that was published with the .swf file - along with the <script language="JavaScript"> etc. code?
this is my embed code:
<embed
src="http://www.mydomain.com/player/mediaplayer.swf"
width="500"
height="350"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="height=350&width=500&file=/videos/testvideo.flv&overstretch=fit&showstop=true"
/>
gnomeontherun
06-30-2008, 06:28 PM
on (release) {
getURL("javascript:openNewWindow('http://mydomain.com/videos/testvideo.flv','thewin','height=350,width=500,toolbar=no,scrollbars=yes')");
}
You cannot directly link to a FLV file like this. You have to link the FLV file into a media player, and then put that player on a page. Look at my website for an example.
<embed
src="http://www.mydomain.com/player/mediaplayer.swf"
width="500"
height="350"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="height=350&width=500&file=/videos/testvideo.flv&overstretch=fit&showstop=true"
/>
This code is what you should put into your webpage. Just copy it directly into your pages. If it comes with <script...> tags, put them into the header. It should say pretty much where it all goes.
Lets say you put it in mediapopup.html. Then your getURL code should link to this page, not to the FLV.
stonecutter
07-01-2008, 12:39 AM
Ok - so should the path be http://mydomain.com/mediapopup.html ? assuming that's the name of the new html page? And this page is where I enter all the code? Or do I edit the html file that gets published with the swf as well? (the one I'm using as my index.html)
I will be home shortly to give it a shot.
I like the carousel on your site!
gnomeontherun
07-01-2008, 12:41 AM
Yes the path is to the web page, not the FLV. Then the page will have the code that was generated from the JW webesite, not the page that is generated by Flash for your main window.
stonecutter
07-01-2008, 08:17 PM
(thanks chinasoso !!)
I added the code, and when I run the mouse click locally on the .swf file it brings up a blank webpage. However when I run the mediapopup .html file locally it brings up a web page with the player, and I can play the video. When I browse locally to the html page in Firefox it will display the video. But when I browse using IE it only displays the text in between this statement: <div id="player">This text will be replaced</div>
I uploaded the new .sfw file and the mediapopup html page, and when I do a live test of the mouse click I get no response (in Firefox), in IE I get "error on page". I am assuming it's an issue with my html page. I'll post the mediapopup html page:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<HEAD>
<TITLE>Demo 1</TITLE>
<script type="text/javascript" src="http://www.*******************/embed/swfobject.js"></script>
<div id="player">This text will be replaced</div>
<script language="JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
</script>
<script type="text/javascript">
var so = new SWFObject('http://www.mydomain.com/player/mediaplayer.swf','mpl','500','350','8');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('height','350');
so.addVariable('width','500');
so.addVariable('file','/videos/alex.flv');
so.addVariable('screencolor','0x000000');
so.addVariable('overstretch','fit');
so.addVariable('showstop','true');
so.write('player');
</script>
</HEAD>
</html>
gnomeontherun
07-01-2008, 09:12 PM
You need to try testing this on a web server. There are some conflicts with browsing a local file that tries to grab Flash from a server.
Then if you get it uploaded to a server you can post the link so I can see better what is going on. Its my belief that loading it to the server should make it work (hopefully!).
stonecutter
07-02-2008, 07:40 AM
All the files are loaded on the web server. Here's the link: http://www.socalvisual.com
After the Flash intro is done, there's a "Services" tab on the right. In there the top graphic (the picture of a camera) is the one I configured to pop up the video player. Currently nothing is popping up. The html file path is /demo1.html - which does bring up a window with the player and demo video if the path is typed in.
This is my getURL code for that button:
on (release) {
getURL("javascript:openNewWindow('http://socalvisual.com/demo1.html','thewin','height=350,width=500,toolbar=no,scrollbars=yes')");
}
I also added this to the index.html page as well: swLiveConnect=true
note: the site is currently on a free Windows host (hence the banner), I'll be changing it to a Linux host.
gnomeontherun
07-02-2008, 05:16 PM
You need the Javascript, I didn't look for it earlier but I don't see it this time around.
Put this in the header of your index.html.
<script language="JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
</script>
You can delete the commented text in your index.html file too. Its got the word volume about 100 times.
stonecutter
07-02-2008, 09:16 PM
Sweet!! I thought I put that code in the index.html, may have not uploaded the right version. I took out all the "volumes" - seems every time I publish the settings in Flash it adds another 20 lines of it. ?
So the popup is working in Firefox, but only text shows up in IE.
stonecutter
07-02-2008, 09:36 PM
It looks like this may be an IIS issue, and since I'm moving to a Linux server I'll make the change and see if that takes care of it.
stonecutter
07-03-2008, 05:17 AM
I moved files to the Linux server, now on both Firefox and IE I get "file not found" for the popup page. And get the same error when I browse to the /demo1.html file as well - both browsers.
Switch to Linux not happy! Is there something that needs to be added for Linux compatibility?
gnomeontherun
07-03-2008, 06:41 AM
It should not make any difference what server you are on. It should only matter that your files are linked properly.
stonecutter
07-03-2008, 07:47 AM
It is strange...I verified the paths, haven't changed anything. I can see all my files and directories on the web server. But now even the JW Setup Wizard doesn't display the demo1.flv player.
gnomeontherun
07-03-2008, 04:44 PM
Are you sure that you moved all of the files? Flash doesn't load files from other servers unless it has a crossdomain.xml policy file. Everything has to be on that server together for this to work.
stonecutter
07-03-2008, 07:17 PM
So I found that some directories and the html file were capitalized, renamed them, now I'm back to where the popup player is working in Firefox but not IE.
I can't find it at the moment, but I know I ran in to some sites that were talking about needing <embed> and <object> code for the IE side of things, neither of which I have in the popup html page.
stonecutter
07-03-2008, 11:33 PM
OK - I just installed the latest Flash Player on the machines that are using IE, and now it works. Is there a way for the browser to verify the latest Flash Player, and prompt to download if it's not?
stonecutter
07-04-2008, 12:05 AM
I changed this:
var so = new SWFObject('http://www.mydomain.com/player/mediaplayer.swf','mpl','500','350','8');
to this
var so = new SWFObject('http://www.mydomain.com/player/mediaplayer.swf','mpl','500','350','9');
And added a link to the latest Flash Player download site.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.