Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Need Help Running Remote SWF Animation

Posted on 2011-04-28
35
Medium Priority
?
499 Views
Last Modified: 2012-05-11
Hello,

I have some code to play a SWF animation.  The code in the snippet works perfectly for local execution of the SWF.

I now need to run the code from a remote host.  I am replacing both instances of header_design2a.swf with http://nnn.nn.nn.nnn/header_design2a.swf, where nnn.nn.nn.nnn is the dedicated IP address of the host for the SWF (for technical reasons that are not important here, I cannot use the textual URL of the SWF host).  When I run from the remote host, the SWF does not display at all on the web page.

Can anyone help me adjust the code as needed?

Thank you,
Stu Engelman
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="780" height="160" id="header_design2a" align="middle" VIEWASTEXT>
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="header_design2a.swf" /><param name="quality" value="high" />
<param name="bgcolor" value="#663300" />
<embed quality="high" bgcolor="#663300" width="780" height="160" name="header_design2a" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="header_design2a.swf" />
</object>

Open in new window

0
Comment
Question by:stuengelman
  • 17
  • 9
  • 5
  • +1
32 Comments
 
LVL 26

Expert Comment

by:David Brugge
ID: 35498255
Have you tried replacing the instance with a jpeg hosted in the same location to check to see if your URL is being translated properly?
0
 

Author Comment

by:stuengelman
ID: 35499989
Hi D_Brugge,

As mentioned, the SWF does play locally without issue.

Could the issue have something to do with the line:

<param name="allowScriptAccess" value="sameDomain" />

Thanks, Stu
0
 
LVL 4

Expert Comment

by:Jeremy Daley
ID: 35500799
are you changing the path to the swf in both the <param> and the <embed src> ?
you have to set it in both places
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Expert Comment

by:Jeremy Daley
ID: 35500807
after you do that, open your webpage in Firefox, and using the Firebug extension, you can detect if the request for the swf file is being made. you can use the following link for reference to help explain what i mean:
http://geeklad.com/download-flash-video-from-any-website
0
 

Author Comment

by:stuengelman
ID: 35501209
daleyjem,

Yes, I am prefixing the path as follows: http://nnn.nn.nn.nnn/header_design2a.swf, where nnn.nn.nn.nnn is the dedicated IP address of the host for the SWF.

I'll try your link.

Do you have any opinions about <param name="allowScriptAccess" value="sameDomain" />; should the value of the "value" parameter be changed?

Thanks, Stu
0
 

Author Comment

by:stuengelman
ID: 35501218
daleyjem,

I didn't use GeekLad, but simply navigated to http://nnn.nn.nn.nnn/header_design2a.swf, substituting in the real numerical IP where the SWF is hosted.  The SWF renders in MSIE as mime types are set as necessary at the server.

Stu
0
 
LVL 4

Expert Comment

by:Jeremy Daley
ID: 35507666
if you can put the file up on a web server, i might be able to help you troubleshoot the problem better. i don't think the "allowscriptaccess" attribute is the cause of the issue.

i didn't ask what you were prefixing your swf path to though... what i asked is if you are setting the path of the swf both in the:
<param name="movie" path="path_to_swf.swf" />
and the:
<embed src="path_to_swf.swf" />

you need to set it in both location of your code.
0
 

Author Comment

by:stuengelman
ID: 35510494
Hi daleyjem,

Yes, I am using the full physical path in both locations.

Stu
0
 
LVL 4

Expert Comment

by:Jeremy Daley
ID: 35713212
...and have you had any luck putting the page on an externally accessible web server?
0
 

Author Comment

by:stuengelman
ID: 35713950
Hi daleyjem,

That is my problem.  I can run the SWF from a web page at the same server where the SWF is stored, but I need to be able to run it from a page at a different server.  When I try the latter, I get no errors, but the SWF area is simply blank.

Please see the discussion above for all the details.  I'm clearly doing something wrong, but I don't know what.  My complete code snippet is in the initial post.

Thanks, Stu
0
 
LVL 4

Expert Comment

by:Jeremy Daley
ID: 35715748
If you put everything on a publicly accessible web server exactly how you have it on your local server, I'll be able to look into the problem. It doesn't matter if the SWF is blank or not, just please do this for me or else I won't be able to help you any further.
0
 

Author Comment

by:stuengelman
ID: 35726425
Hi daleyjem,

The SWF is not actually blank internally.  It is a fully prepared animatinon that works properly when the web page accessing it is on the same domain as the SWF.

The poblem comes up when I try to access (play) the SWF from a web page on another server (domain).  The SWF simply doesn't render at all.  For this scenario, I have coded the URL for the SWF as http://nnn.nn.nn.nnn/header_design2a.swf, where nnn.nn.nn.nnn is the dedicated IP address of the host for the SWF, and set the value of "allowScriptAccess" to "always", in all locations where the SWF playing code requires these values.

Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35902537
stuengelman - do you know if there is code inside the swf that accesses any external content? For example, does it draw on any external data feed such as RSS / webcam / config files / any files at all?

If so, then your issue is probably a cross domain scripting issue.

If your swf does draw from external data, then say so, and I'll explain further.

If your swf is entirely self contained (i.e. all resources are inside the swf) then please ignore my posting.
0
 

Author Comment

by:stuengelman
ID: 35910180
Hi Quizengine,

Your question is very cogent.  I don't know the answer, but I'll try to find out.

If the SWF does access external content, then all such content appears to be available to the SWF, since the SWF runs when accessed locally.

I thought about the cross domain issue; that is why I set "allowScriptAccess" to "always".  But perhaps more is necessary if the SWF is not "self contained."

I will attempt to provide more information on your question.

Thank you very much for your post.

Stu
0
 

Author Comment

by:stuengelman
ID: 35955032
Hi Quizengine,

This is in regard to your last question.  I'm not very familiar with SWF architecture, so I thought the simplest way to get you an answer would be to direct you to http://www.legalhelprightnow.org .  The issue is with regard to the flash banner at the top.

As mentioned earlier, the flash banner works fine when it is invoked from web pages on the same server as the SWF is stored on.  The "blanking out" problem occurs when I try to access it from pages on other servers (I just get white space where the flash banner shgould be).  There are technical reasons why I can't simply copy it over to the remote server, so I do need to make the remote invocations of the SWF.

Please do a "View Source" on http://www.legalhelprightnow.org/ .  If you need any of the external JS files it calls, please ask.

I guess the issue that you're getting at is that there may be some files that the SWF "pulls in" that have relative rather than absolute URL's, so calling from a remote server fails (because the base URL is not the SWF host).  Hopefully, the HTML in source view and/or one of the external JS files will give you this information, and we can modify these as necessary so the SWF can be utilized remotely.

Will await your input.

Thanks again, Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35955102
On frame 2 of the swf (its called "header_design2a.swf") there is the actionscript command

loadVariablesNum("druqpt.txt", 0);

This (attempts to) load the file "druqpt.txt" (note that there is no path on the filename, only the filename) into the swf. Here are the contents of the file "http://www.legalhelprightnow.org/druqpt.txt"

name=DON'T WASTE ANOTHER MINUTE
&slogan=Get The Legal Help You Need Right Now!&rep=replay
&button1=Home
&button2=Consumer Law
&button3=Contract Law
&button4=Landlord Law
&button5=Renters Rights
&button6=Contact Us
&button7=Add
&url1=index.asp
&url2=consumer-laws.asp
&url3=contract-attorneys.asp
&url4=landlord-tenant-rights.asp
&url5=renters-rights.asp
&url6=contact-Affordable-Florida-Insurance-Life-Annuity-Health.asp
&url7=#&enddata=1

You should see that this contains dynamic content such that the contents of this file can change the content of the swf - slogans, button names, urls that the buttons lead to.

Now let's imagine that you have put copies of the swf in different folders such that  it is easier to embed the swf in pages that are in those folders. I'm going to pretend that there is a file in your web called "http://www.legalhelprightnow.org/help/help.asp" which contains the Flash header. Further, you placed a copy of the swf into the folder "http://www.legalhelprightnow.org/help".

UNLESS YOU ALSO PLACED A COPY OF THE FILE "druqpt.txt" IN THE FOLDER, THE SWF'S BEHAVIOUR WOULD FAIL BECAUSE IT HAS ONLY BEEN TOLD TO LOAD THE FILE AND NOT WHERE TO FIND IT.

If this is indeed what is happening, you have three possible solutions.

1) place a copy of the text file wherever you also have the swf. This is a 'quick and dirty' solution. It should work but it means that you will need to edit every copy of the text file if you ever want to change any of its content. Also you should be aware that the urls in this text file are also relative rather than absolute urls and you may need to edit these urls if you end up placing copies of the text file in other folders on your site

2) Rewrite the swf so that the actionscript I mentioned references an absolute url rather than a relative url. Then in won't matter where you place the swf as it should be able to find the text file (as long as the text file is on the same domain).

3) rewrite the swf so that these variable are HARD WIRED into the swf. This has the disadvantage that you would need to edit and recompile the swf anytime you want to change the content, but it has the advantage that the swf has no dependencies on any external files - it carries all of its own data.

Hope this helps.
0
 

Author Comment

by:stuengelman
ID: 35955199
Hi Quizengine,

The above is very helpful.  It is clear that by calling the SWF remotely, the base URL changes, so the SWF cannot access druqpt.txt, and thus cannot render (i.e., the SWF logic crashes).

It seems that (1) by itself won't work, as the druqpt.txt file would have to already be in the same folder as the SWF file (since the SWF works when invoked locally, and the callout to druqpt.txt within the second frame specifies no subfolder for druqpt.txt).  In other words, the conditions in (1) must already be satisfied.

Correct me if I'm wrong, but I think two things need to be done:

(1) The loadVariablesNum command needs to specify an absolute URL for druqpt.txt.  The source file for the SWF would need to be updated and recompiled.

(2) druqpt.txt needs to specify absolute URL's for &url1,...,&url6.

Thanks, Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35955209
I just had a browse around the site and every page I clicked the header worked properly. Do you have examples / urls of pages on the site where the problem you originally described happens ? (I don't feel like I can offer a definitive solution until I can see / replicate the problem)
0
 

Author Comment

by:stuengelman
ID: 35955256
Hi Quizengine,

The SWF will work perfectly if you invoke it directly from http://www.legalhelprightnow.org , as the physical web space for this domain contains the SWF and all of its "subfiles".

The issue I'm actually having is that I've built a proxy layer that lets customers use DNS redirection to a .NET HTTPModule, permitting automated content adjustment via a control panel (essentially, the content variations created by the site owner are stored on a DB, the proxy layer leeches the requested page from the client server via AJAX (XMLHTTP object), modifies the HTML body, and then downloads the adjusted content to the end user).  This system is extremely complex, and I think providing a replication via this approach would involve extensive explanation so you understood what was going on.

As an alternative, would it be helpful if I simply created a hard coded web page at another server that "mimics" the output of the proxy system?  This would not only permit you to see the problem in real time, but would have the added advantage that we wouldn't need to spend extensive time getting you up to speed on the HTTPModule.

I think all we really need is a simple web page that invokes the SWF, and includes all hard coded logic and JS callouts that relate to the SWF.  We don't really need all the other content at the home page you just looked at (text, vertical nav bar, etc.).  Just as the proxy system does automatically, I'll ensure that all references to external content are absolute URL's using the appropriate dedicated IP.  The actionscript and druqpt.txt will initially use relative URL's, but we can easily update druqpt.txt.  Once we identify what easily editable files need to be updated with absolute URL's, we will next need to hunt down the source file for the SWF so it can be updated and recompiled.  Let me know if you think this is a good approach.

Thanks, Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35955281
You could try using absolute urls as in your last suggestion, but when you start figuring in proxys / other domains you may also run foul of the 'cross domain scripting' issues that Flash imposes. This is to prevent a swf at one domain accessing content at another domain. There are workarounds for this too, but if you try absolute urls and still get problems I would recommend *not* using external files to deliver dynamic content. Instead embed the necessary variables into the swf and make it entirely self contained and have no dependencies outside itself. That may be sub-optimal if you want to have dynamic content in the swf, but I would think that having a single swf in a single location that can be easily edited and recompiled when you want to change the contents of it, BUT it would then work reliably, - I would call that a worthwhile compromise.
0
 

Author Comment

by:stuengelman
ID: 35956785
Hi Quizengine,

I thought setting  "allowScriptAccess" to "always" resolves the cross domain issue (I've already done this).  Am I wrong in this assumption?

Stu
0
 
LVL 19

Accepted Solution

by:
quizengine earned 2000 total points
ID: 35957154
Its more complicated than that. *some* content is allowed to travel across domains, but much else is not.

Try googling 'Flash cross domain policy' - you need to have access to the root of the server and create a 'crossdomain.xml' file.

If you have the variables / content hard wired into the swf *you do not need to deal with these restrictions*
0
 

Author Comment

by:stuengelman
ID: 35960891
Hi Quizengine,

Got it.  Correct me if I'm wrong, but it seems that druqpt.txt must utilize absolute URL's for &url1,...,&url6, and:

(1) The callout to druqpt.txt (loadVariablesNum("druqpt.txt", 0);) must use an absolute URL, or

(2) The content of druqpt.txt must be embedded in the SWF.

In either of cases (1) or (2), the SWF's source file would need to be modified and recompiled.

Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35961001
Yes to all of the above.

Let me know what happens.
0
 

Author Comment

by:stuengelman
ID: 35961049
Hello Again,

Will attempt to get access to the FLA and report back.

Thanks again, Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35961329
If you can't get the fla, I have a decompiled version, which is how I found the actionscript in the first place. Better to work from the original fla if you can.
0
 

Author Comment

by:stuengelman
ID: 35965526
Hello,

Unfortunately I do not have the FLA.  I can ask my partner if he can get one from the flash developer.  If he can't obtain it, would you be able to make the changes and recompile from what you've got?

I realize this is an advice site, so there is no problem if you wish to charge a fee for the work.

Just let me know.

Thanks, Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35965739
Hi Stu,

Yes I could make the changes to the fla, but it's against the policy of EE for me to solicit work here. If you are unable to get the fla / make the changes yourself, my advice would be to post the task at an online freelancing site - for example www.elance.com
0
 

Author Comment

by:stuengelman
ID: 35970859
Hi Quizengine,

Would it be within EE rules if I provided my email address, and we communicate offline?  You wouldn't be soliciting any work, as I am explicitly requesting it.

I would also of course award you the points on this question.

Please advise.

Thanks, Stu
0
 
LVL 19

Expert Comment

by:quizengine
ID: 35972303
Not sure. Have looked for such a violation in the terms of service but couldn't find one so I'm ok to share

pat@quizengine.co.uk

(If there are any moderators viewing this question and sharing my email address is against terms of service, please remove my email address from this post and I would be grateful if you could provide a link to the relevant section of the terms of service so I can read it. Thanks.)
0
 

Author Comment

by:stuengelman
ID: 35996597
Hi Pat,

Will send you an email.

Stu
0
 

Author Closing Comment

by:stuengelman
ID: 36009644
Great work.  Thank you so much.  Stu
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
How does storytelling impact the web? What goes into a great story on the web? And how can it be used for marketing purposes? All of these questions will be answered.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

579 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