From: silentC on
I'm a total newbie with Flash.

We want to host video on our site. The video to be viewed is selected by the
user. I wanted to use the FLVPlayback component to display the video by
specifying the source URL of the .fla file at runtime in the HTML page code.
I've no idea how to access the source property at runtime in the object tag or
whatever. Obviously I need to learn Actionscript to understand it properly, but
can anyone give me a simple example of how it would be done, or point me to a
tutorial on it?

The object tag looks like this:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve
rsion=9,0,0,0" width="550" height="400" id="viewer" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="viewer.swf" /><param name="quality" value="high"
/><param name="bgcolor" value="#ffffff" /> <embed src="viewer.swf"
quality="high" bgcolor="#ffffff" width="550" height="400" name="viewer"
align="middle" allowScriptAccess="sameDomain" allowFullScreen="false"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

There's also a javascript function:

AC_FL_RunContent(
'codebase',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0
,0,0',
'width', '550',
'height', '400',
'src', 'viewer',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'viewer',
'bgcolor', '#ffffff',
'name', 'viewer',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'viewer',
'salign', ''
); //end AC code

Is it a matter of dropping in some code here, or do I need to modify my
viewer.swf to accept the parameter?




From: silentC on
A bit more info after some digging around. I've now worked out how to add AS to
the object. I've got this bit of script:

import fl.video.*;

var flvPlayer:FLVPlayback = new FLVPlayback();
addChild(flvPlayer);
flvPlayer.skin = "SkinUnderAllNoCaption.swf"

if(loaderInfo.parameters.flaPath == '')
{
flvPlayer.source = loaderInfo.parameters.flaPath;
}
else
{
flvPlayer.source = "water.flv";
}

I've put this in my HTML:
AC_FL_RunContent(
'codebase',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0
,0,0',
'width', '550',
'height', '400',
'src', 'Untitled-2',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'Untitled-2',
'bgcolor', '#ffffff',
'name', 'Untitled-2',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'Untitled-2',
'salign', '',
'flashVars', 'flaPath="water.flv"'
); //end AC code
}

When I load the page, I get just the skin with the rotating download bar and
no video. If I remove the flashVars line from the above, I get the water.flv.
This proves to me that the flashVar is getting through to the swf but for
whatever reason my AS code isn't doing the job.

From: silentC on
Seems to be because of the quotes in the flashVars parm. I removed them and it works now.

Thanks for listening!