Tim,
Here is the html code when i use the code in my Snippet, but it
doesn't work.
### Code in the Snippet ###
var flashSrc = "/flash/test.swf"
var flashVar = "{name1=hello&name2=world&name3=foobar}"
val script = """swfobject.embedSWF('" + flashSrc + "', 'myContent',
'300', '120', '9.0.0', 'expressInstall.swf', '" + flashVar + "');"""
def whatever(xhtml: NodeSeq): NodeSeq = bind("flash", xhtml,
"flashVar" -> Text("/flash/focus.swf"),
"object" -> Script(Run(script))
)
### Code in the Snippet ###
### Code in the index.html ###
<head>
<script type="text/javascript" src="/scripts/swfobject.js"></script>
<lift:HelloWorld.whatever>
<flash:object />
</lift:HelloWorld.whatever>
</head>
<div id="myContent">
<h1>Alternative content</h1>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://
www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash player" /></a></p>
</div>
### Code in the index.html ###
This is the source html code when i use this code.
<head>
<script type="text/javascript">
//
swfobject.embedSWF('" + flashSrc + "', 'myContent', '300', '120',
'9.0.0', 'expressInstall.swf', '" + flashVar + "');
//
</script>
</head>
<body>
<object height="120" width="300" type="application/x-shockwave-flash"
data='" + flashSrc + "' id="myContent" style="visibility: visible;"/>
</body>
Why the " flashSrc" is a string in the Script ? Maybe it should be "/
flash/test.swf" ?
Thanks very much!
Cheers,
Neil
On Nov 12, 5:39 pm, Timothy Perrett <[email protected]> wrote:
> Neil,
>
> Try this:
>
> import net.liftweb.http.js._
> import net.liftweb.http.js.JE._
> import net.liftweb.http.js.JsCmds._
>
> val script = """swfobject.embedSWF('" + flashSrc + "','myContent', '300',
> '120', '9.0.0', 'expressInstall.swf', '" + flashVar + "');"""
>
> def whatever(xhtml: NodeSeq): NodeSeq = bind("flash", xhtml,
> "object" -> Script(Run(script))
> )
>
> That should give you enough to work out what it is you need to do.
>
> Cheers, Tim
>
> On 12 Nov 2009, at 09:04, Neil.Lv wrote:
>
>
>
> > Hi all,
>
> > How to Embed the flash dynamic in Snippet in the Lift?
>
> > I use the swfobject to embed my flash and want to specify the
> > flashVar dynamic, but this is doesn't work!
>
> > Here is the code in the Snippet:
>
> > The flashSrc can shown correctly in the index page, but the
> > falshvar doesn't work!
>
> > ###
> > var flashSrc = "/flash/test.swf"
> > var flashVar = "{name1=hello&name2=world&name3=foobar}"
> > def initFlash(in: NodeSeq) : NodeSeq = {
> > bind("init", in,
> > "flash" -> Text("swfobject.embedSWF('" + {flashSrc} + "',
> > 'myContent', '300', '120', '9.0.0', 'expressInstall.swf', '" +
> > {flashVar} + "');")
> > )
> > }
> > ###
>
> > Any help would be much appreciated!
>
> > Cheers,
> > Neil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---