PDA

View Full Version : Help please


MaV
05-18-2008, 10:55 AM
hello everyone,
can anyone tell me how to get the url of the page in swf file?

i mean if you want to get the url of the swf file then you put:

trace (_root._url)
-----------------------------------------
in output panel it comes like:
C:/folder/main.swf
or in website it says
http://www.yoursitename.com/main.swf

but how we get the url of the page?
like if i have a php code like:
www.site.com/main.php?002145872images

how can i get that url in flash?
i mean how i get the url like
www.site.com/main.php?002145872images
rather than:
www.site.com/main.swf

adrianTNT
05-18-2008, 11:02 AM
Hello.

As I know flash cannot detect the HTML address of the web page.
One way would be to retrieve the URL by PHP code and then pass it to the swf file, like this:

main.swf?page_url=http://site.com<?php echo $_SERVER['REQUEST_URI'];?>

Then inside your flash file you will have a variable "page_url" that will be the address of the page containing your swf file.

I hope this helps, it can probably be done by JavaScript too.

- Adrian.

MaV
05-18-2008, 09:03 PM
Can you tell me where to put that code in this php?
i tried but don't really understand how to use php and flash.
and if i put in flash:
my_txt.text = page_url
will it work or i am wronge in flash?

please i need serious help in this.

This is an example of php page added a flash movie named main.swf
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','1005','heig ht','628','src','main','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','main' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="1005" height="628">
<param name="movie" value="main.swf" />
<param name="quality" value="high" />
<embed src="main.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="1005" height="628"></embed>

</object></noscript>
</body>
</html>


its not that i am not good in codeing, i am good but i don't understan php :(
other than that i can go really smooth with flash and xml :)

adrianTNT
05-18-2008, 09:14 PM
Hi, it should be like this:

#####################################

<script type="text/javascript">

AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','1005','heig ht','628','src','main','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','main?page_url=http://site.com<?php echo $_SERVER['REQUEST_URI'];?>' ); //end AC code

</script>

<noscript>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="1005" height="628">
<param name="movie" value="main.swf?page_url=http://site.com<?php echo $_SERVER['REQUEST_URI'];?>" />
<param name="quality" value="high" />
<embed src="main.swf?page_url=http://site.com<?php echo $_SERVER['REQUEST_URI'];?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="1005" height="628"></embed>

</object>

</noscript>


#####################################


The code gets writtena fter each path to the swf file, normally it is only in 2 locations (2nd and 3rd) but your code has a javascript fix for an Internet Explorer issue, so there is that first location, note that in first location it doesn't have the .swf, it is correct like that, it is not a typo.

Good luck.

MaV
05-19-2008, 07:16 PM
thanks alot, it worked fine.
you Rock adrianTNT :)

one more question,
what if we add multiple variables? can we do that? i mean like page_url, how we add more variables than only one?

adrianTNT
05-19-2008, 07:20 PM
main.swf?page_url=http://site.com<?php echo $_SERVER['REQUEST_URI'];?>&page_title=Flash&page_description=flash files

MaV
05-30-2008, 05:17 PM
thanks man adrianTNT, you rock
it worked smoothly for me.
thanks again