 |
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

April 26th, 2005, 02:43 PM
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
dinamically showing a .swf file in a popup window
hi, i like to show a .swf file in a popup window that receives on the querystring a variable indicating what .swf to show. i have this inside the body tag of the popup window:
<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
height="114" width="250" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>
<PARAM NAME="_cx" VALUE="6615">
<PARAM NAME="_cy" VALUE="3016">
<PARAM NAME="FlashVars" VALUE="">
<PARAM NAME="Movie" VALUE="XX.swf">
<PARAM NAME="Src" VALUE="XX.swf">
<PARAM NAME="WMode" VALUE="Window">
<PARAM NAME="Play" VALUE="-1">
<PARAM NAME="Loop" VALUE="-1">
<PARAM NAME="Quality" VALUE="High">
<PARAM NAME="SAlign" VALUE="">
<PARAM NAME="Menu" VALUE="-1">
<PARAM NAME="Base" VALUE="">
<PARAM NAME="AllowScriptAccess" VALUE="always">
<PARAM NAME="Scale" VALUE="ShowAll">
<PARAM NAME="DeviceFont" VALUE="0">
<PARAM NAME="EmbedMovie" VALUE="0">
<PARAM NAME="BGColor" VALUE="">
<PARAM NAME="SWRemote" VALUE="">
<PARAM NAME="MovieData" VALUE="">
<PARAM NAME="SeamlessTabbing" VALUE="1">
<embed src="XX.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="250" height="114"> </embed>
</OBJECT>
What i want to do is to change on the page load the value of the atributes that represent the path of the .swf (the code is in c#)
i have this on the page load:
int idUnit= Convert.ToInt32(Request.QueryString["id"]);
string strflashpath= Server.MapPath("\\Upload\\")+idUnit+".swf";
"strflashpath" is the path of the .swf i want to show on the popup.
any suggestions? thanks in advance...
|

April 26th, 2005, 04:26 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
- Wrap all of the <OBJECT> HTML inside of an asp:literal control.
- Place some kind of token where you want to drop the file name
(Right now you have 'XX.swf' so that could work fine. I like to use something like '%%SWFFILE%%'.)
- In the ASPX codebehind, do this:
litMyLiteral.Text = litMyLiteral.Text.Replace("XX.swf", strFlashPath)
or
litMyLiteral.Text = litMyLiteral.Text.Replace("%%SWFFILE%%", strFlashPath)
You do NOT want to use Server.MapPath because that will return the absolute LOCAL path (i.e. "C:\inetpub\wwwroot\myapplication\myswfs\myswf.swf ") to the browser which will be of no use. Instead, use Page.ResolveUrl("~/myswfs/myswf.swf") which will return the root relative HTTP path to the swf file ("/myapplication/myswfs/myswf.swf").
- Peter
|

April 27th, 2005, 09:18 AM
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks, i wraped the object tag like this:
<asp:Literal ID=litMyLiteral Runat=server>
<OBJECT.....
....
<PARAM NAME="Movie" VALUE="%%SWFFILE%%">
<PARAM NAME="Src" VALUE="%%SWFFILE%%">
....
<embed src="%%SWFFILE%%" ...></embed>
</OBJECT>
</asp:Literal>
and i have this in codebehind:
int idUnit= Convert.ToInt32(Request.QueryString["id"]);
string strFlashPath= Page.ResolveUrl("\\Upload\\"+idUnit.ToString()+".s wf");
litMyLiteral.Text = litMyLiteral.Text.Replace("%%SWFFILE%%", strFlashPath);
the problem is that when i request the page, it never goes to codebehind and the html source remains with the token.
the page is called like this:
hlAFP.NavigateUrl="javascript:var w=window.open('PopUpFAd.aspx?id=0','', 'width=250,height=250,scrollbars=no,resizeable=no' );";
i mean, i assign this to a hyperlink control in codebehind in another page, and the link works well, but the page PopUpFAd.aspx never gets into its codebehind...
Page Load
|

April 27th, 2005, 09:46 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Where in the codebehind do you have that code?
You probably also want to change this line:
string strFlashPath= Page.ResolveUrl("\\Upload\\"+idUnit.ToString()+".s wf");
to this:
string strFlashPath= Page.ResolveUrl("~/Upload/"+idUnit.ToString()+".swf");
The \ is used for local file references while the / is for web resources (though I don't think it will matter much. The key is using the ~ if you use the /. If you preceed any url with / it tells the browser to look at the web site root. Assuming that you probably are running this application in a virtual directory, the browser will be referencing a bad resource. By adding the ~ you'll get the complete root relative URL for the resource.
- Peter
|

April 27th, 2005, 09:48 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
I meant to include:
You do not have to use "~/" in the url. You can use just "upload/..." but then you need to make sure this relative reference is correct to the context of the page that is requesting it.
- Peter
|

April 27th, 2005, 09:53 AM
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi again. now i solved the postback problem. for some reason i do not had this on private void InitializeComponent():
this.Load += new System.EventHandler(this.Page_Load);
so my logic will never goes into page load eventhandler.
now the token is replaced with the right one, but the .swf doesn't appear on the page. i think it could be something about the size of the .swf and the size of the window in which i like the .swf be shown. ??????
|

April 27th, 2005, 10:07 AM
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks.., at last the .swf are showing!!!. now, i want to resize it client side. some kind of this i asked in a topic i posted before and you reply telling that with some scripting i can accomplish this
|

April 27th, 2005, 10:59 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Yes, like I mentioned before, I don't have any idea if you can read the swf and get the size of it. Presumably, there are flash APIs or something that could read the proprietary SWF format and give you this information. Otherwise, there may be numerous ways you could accomplish this task with some client scripting. Try a javascript and/or DHTML forum for the specifics on doing this.
- Peter
|
|
 |