Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Find URL of swf html host

Posted on 2002-05-31
10
Medium Priority
?
1,152 Views
Last Modified: 2012-08-13
Hello,

I need a flash swf file to be able to find out what the URL is of the html page that the swf is on?  Then make it a variable that I can pass onto another page...

Thanks...........Rob
0
Comment
Question by:jsttriit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
10 Comments
 
LVL 2

Expert Comment

by:thor918
ID: 7048093
do you have serverside capabilities?
asp? then you can do this easy!<HTML>

movie1.asp--->
<HEAD>
<TITLE>Movie1</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
 WIDTH=550 HEIGHT=400>
 <PARAM NAME=movie VALUE="Movie1.swf?url=<%="http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables("Url")%>">
 <PARAM NAME=quality VALUE=high>
 <PARAM NAME=bgcolor VALUE=#FFFFFF>
  <EMBED src="Movie1.swf?url=<%="http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables("Url")%>" quality=high bgcolor=#FFFFFF  WIDTH=550 HEIGHT=400 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>
</BODY>
</HTML>


as you see this asp puts the page url into a querystring where the Movie1.swf are..
Like this->
Movie1.swf?url=http://thor/flash/Movie1.asp

If you have an dynamic text box named url in the flash file you will retrive the url ;)


0
 
LVL 2

Expert Comment

by:thor918
ID: 7048097
if you know asp you will see that this is the only asp(server side script) in the page
<%="http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables("Url")%>"
0
 

Author Comment

by:jsttriit
ID: 7048150
I do have server side ability but I need this to be done on a regular html page.  We are using flash to let people put in bugs when reviewing a website(all .htm pages).  

So I need flash to be able to determine the hosting page url dynamically and then make it a variable which will then be passed to a cold fusion page for processing.

Thanks for the effor though.....Rob
0
Independent Software Vendors: 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!

 
LVL 2

Accepted Solution

by:
thor918 earned 800 total points
ID: 7048154
how about this then?
html file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Flash url</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="writeflashobject.js"></script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<script type="text/javascript">
document.write(makeflash("Movie1.swf?url="+location.href,400,550));
</script>
</body>
</html>

writeflashobject.js
function makeflash(flashfile,flashheight,flashwidth){
makeflash = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
makeflash +=  'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"'
makeflash +=  'WIDTH='+flashwidth+' HEIGHT='+flashheight+'>'
makeflash +=  '<PARAM NAME=movie VALUE="'+flashfile+'">'
makeflash +=  '<PARAM NAME=quality VALUE=high>'
makeflash +=  '<PARAM NAME=bgcolor VALUE=#FFFFFF>'
makeflash +=  ' <EMBED src="'+flashfile+'" quality=high bgcolor=#FFFFFF  WIDTH='+flashwidth+' HEIGHT='+flashheight+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'
makeflash += '</OBJECT>'
return makeflash;
}


the ?url=sdfj
will automatically create a variable called url in flash with the value.

0
 

Author Comment

by:jsttriit
ID: 7048166
Cool, let me mess around with it.  I really want it all in the flash movie with no javascript involved, but let me see if I can get this to work.

I would think flash mx would be able to do this, but no one has figured out how.

Thanks..Rob
0
 
LVL 2

Expert Comment

by:thor918
ID: 7048507
okey.. I will check out if I can make an mx example.
0
 
LVL 2

Expert Comment

by:thor918
ID: 7048604
There is no method to get the url of the html page where the swf is located.
The only thing you can do is getting the url where the movie is..
like this in actionscript->
url = _url;
(variable = _url;)

this works in lower versions too.
but for finding the html page you must use clientsidesdcript or serversidescript.

If you realy don't want to use javascript, you can use the _url to parse out the "http://hammar.no/users/thor/submit/"
and then put in src="Movie1.swf?file=test.html" manualy in each html page to identify the html page to flash, but that isn't exactly dynamic.
0
 

Author Comment

by:jsttriit
ID: 7079925
Great work.  Thanks..............Rob
0
 
LVL 2

Expert Comment

by:thor918
ID: 7080534
:D Glad to be of help. Thanks for the points!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

650 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