[SWFObject] Adding vars to SWFobject in Flash runtime
Danya Henninger
danya at imagicdigital.com
Tue Jun 27 09:12:16 PDT 2006
I was just trying this out yesterday. See the final product using a JS call
to load a new FLV file into a Flash movie written with SWFObject here:
www.ClubMax3D.com/animation.cfm (you might have to enter your email to
view the page --- sorry, client request!)
Once the page loads, the SWFObject is no longer there -- it has written an
object or embed tag to place the SWF in the page, and then it's done. So
you don't access the SWFObject anymore. (I'm pretty sure -- ?)
You can access the swf file by it's id, which is the second parameter in the
SWFObject constructor.
You can use Flash 8's ExternalInterface to set up a function that you can
call with JS from your HTML page. Something like:
In your HTML page:
<head>
<script type="text/javascript">
var flashVideoPlayer = document.getElementById('video');
function callFlashPlayVideo(flv_path) {
flashVideoPlayer.playVideo(flv_path);
}
</script>
</head>
<body>
<div id="flashcontent"></div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("spvideo.swf", "video",
"781px","522px", "8","" , true);
so.addVariable("flv_path", "flv/video1.flv");
so.write("flashcontent");
// ]]>
</script>
<a href="#" onclick="callFlashPlayVideo(flv/video2.flv)" > See other movie
</a>
</body>
And in your Flash file:
import flash.external.ExternalInterface;
//
ExternalInterface.addCallback("playVideo", null, playVideo);
//
// and then depending on how you're playing the flv
function playVideo(url){
ns.play(url);
}
// then call the first movie to play
playVideo(_root.flv_path);
> ------------------------------
>
> Does SWFobject support loading vars into flash via a javascript?
>
> Im not a programmer, but I hope you get the idea what im asking for.?
>
>
>
--
Danya Henninger
Imagic | www.imagicdigital.com
danya at imagicdigital.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deconcept.com/pipermail/swfobject-deconcept.com/attachments/20060627/c20e310e/attachment-0004.htm>
More information about the Swfobject
mailing list