Reputation: 2110
As a PHP junior encountering Flex for the first time this scratches my brain for days. The flashvar contains the source of the video I wnat to play in the Flex video component. The HTML of the player looks like:
function createPlayer(videoSource){
document.writeln("<div id=\"player\">");
document.writeln("<object width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
document.writeln("<param name=\"player\" value=\"bin-debug/FlexPlayer.swf\">");
document.writeln("<embed src=\"bin-debug/FlexPlayer.swf\" name=\"player\" width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
document.writeln("</embed>");
document.writeln("</object>");
document.writeln("</div>");
}
I tried to call the FlashVars in the FlexPlayer.mxml but it's not working. Please tell me what I have to apply in the source in the mxml to access the FlashVars.
<s:VideoPlayer id="Player" left="0" top="0" width="497" height="414"
skinClass="MySkin" source="FlashVars"/>
</s:Group>
Upvotes: 0
Views: 599
Reputation: 6127
What does the variable videoSource
contain? If it is an URL to a video and nothing more, it probably won't work, since flashvars is supposed to be a string that contains variable names and values (not just values).
So for example, flashvars="video.flv"
won't work, but flashvars="sourceUrl=video.flv"
can work, if the video player is made to use a variable named sourceUrl
.
Also, for the object
element you should add a separate param
element for the flashvars, instead of having flashvars as an attribute of the object
element. For the embed
element, flashvars is an attribute, as you have it now (aint standards great ;)
More info:
http://kb2.adobe.com/cps/164/tn_16417.html
Upvotes: 1
Reputation: 15390
<mx:Script>
<![CDATA[
private function init():void {
// The FlashVars
var obj:Object = Application.application.parameters;
var videoSource:String = (obj.videoSource != null) ? obj.videoSource : "there was no flashVar by this name";
trace(videoSource);
}
]]>
</mx:Script>
Upvotes: 1