我想从grails 2.3.1执行flash应用程序。
我有一个问题是从gsp加载我的swf文件的依赖项。
首先,我尝试将所有需要的文件放入我的web-app文件夹,它就像一个魅力:
当我转到这个网址:http://localhost:8080/application-name/flash/index.html
时,所有工作都像魅力一样。
所以我决定从控制器调用它:
class FrontFlashController {
def openFlash() {
}
}
这是我的gsp叫flash:
<g:applyLayout name="frontFlash">
<div id="flash-render">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="700" title="myFlash" >
<param name="movie" value="flash/flash.swf" />
<param name="FLASHVARS" value="idSession=rffcu96vn6j4tq3o56j1bgn5o7&lang=fr&xmlPath=prefs.xml">
<param name="quality" value="high" />
<embed src="/application-name/flash/flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="700" flashvars="idSession=rffcu96vn6j4tq3o56j1bgn5o7&module=module&maxchapter=6&gochapter=3&jeu=0&cumul=285"></embed>
</object>
</div>
</g:applyLayout>
通过此网址调用此操作:http://localhost:8080/application-name/frontFlash/openFlash
,我的文件&#39; flash.swf&#39;是正确加载但没有他的依赖。
这是我的firebug堆栈:
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/static.xml"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/textes/default_en.xml"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/prefs.xml"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/intro.swf"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/main.swf"
似乎是直接查看我的文件夹视图而不是swf文件夹。
我该如何解决?
更多,稍后我想在我的grails应用程序之外链接swf ressource,我该怎么做?
施奈特
答案 0 :(得分:0)
尝试在g.createLinkTo
中使用src
,例如
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" title="myFlash" >
<param name="movie" value="flash/flash.swf" />
<param name="FLASHVARS" value="idSession=rffcu96vn6j4tq3o56j1bgn5o7&lang=fr&xmlPath=prefs.xml">
<param name="quality" value="high" />
<embed src="${g.createLinkTo(dir: 'flash', file: 'flash.swf')}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashvars="idSession=rffcu96vn6j4tq3o56j1bgn5o7&module=module&maxchapter=6&gochapter=3&jeu=0&cumul=285"></embed>
</object>
答案 1 :(得分:0)
我解决了将<base href="/application-name/flash/">
添加到我脑海中的问题。
这是 openFlash.gsp的最终版本:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>FLASH</title>
<base href="/application-name/flash/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myId", "9.0.0", "expressInstall.swf");
</script>
</head>
<body>
<div>
<g:if test="${flash}">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="700" title="Module">
<param name="movie" value="flash.swf" />
<param name="FLASHVARS" value="idSession=rffcu96vn6j4tq3o56j1bgn5o7&lang=fr&xmlPath=prefs.xml">
<param name="quality" value="high" />
<embed src="${g.createLinkTo(dir: 'flash', file: 'flash.swf')}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="700" flashvars="idSession=rffcu96vn6j4tq3o56j1bgn5o7&maxchapitre=6&gochapitre=3&jeu=0&cumul=285"></embed>
</object>
</g:if>
<g:else>
<g:if test="${flash.error}">
<br />
<div class="alert alert-error">${flash.error}</div>
</g:if>
</g:else>
</div>
</body>
</html>