views:

104

answers:

2

I'm rebuilding this embedable player for a client of mine, the video file URL and a couple of other variables are in the HTML as Flashvars. I suspect something is wrong with the code that looks for the flashvars.

Link to test page: http://dev.howdini.com/embed.html The top part showing the green box is where the player didn't load because it was unable to obtain the Flashvars form the HTML. The player below has the Flashvars string hardcoded into the player so it works.

I believe the problem lies somewhere below Perhaps something wrong with the way I'm trying to pull in the Flashvars?

// LIVE Embedded
   //vidURL = stage.loaderInfo.parameters.fvar;
   vidURL = this.loaderInfo.parameters.fvar;            

   fvarText.text = "vidURL = this.loaderInfo.parameters.fvar"

   vidSplit = vidURL.split(".flv")[0].split("/");
   varVid   = vidURL.toLowerCase().split("&vid=")[1].split("&")[0];
   varChid  = vidURL.toLowerCase().split("&chid=")[1].split("&")[0];

// Hardcode Testing 
//(This creates the player that works at the bottom of the test page)
   /*vidURL   = "http://howtoevery.vo.llnwd.net/o18/Pantene_TaylorSwiftUpDo_H_828-640x360.flv&VID=690&CHID=999";
   vidSplit = vidURL.split(".flv")[0].split("/");
   varVid   = vidURL.toLowerCase().split("&vid=")[1].split("&")[0];
   varChid  = vidURL.toLowerCase().split("&chid


I get this error when I export from Flash:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.howdini.HowdiniPlayer::Embed/init()
at com.howdini.HowdiniPlayer::Embed()

I expect this error however since obviously the Flash isn't embedded yet, but could this error shed any light on why my player isn't able to get the FlashVars link and then render itself?

The HTML embed code:

<object width="640" height="395" border="0">
<param name="flashvars" value="fvar=http://howtoevery.vo.llnwd.net/o18/Pantene_TaylorSwiftUpDo_H_828-640x360.flv&amp;amp;VID=1273&amp;amp;CHID=4" />
<embed src="http://dev.howdini.com/embed.swf" width="640" height="395" flashvars="fvar=http://howtoevery.vo.llnwd.net/o18/Pantene_TaylorSwiftUpDo_H_828-640x360.flv&amp;amp;VID=1273&amp;amp;CHID=4"&gt;
</embed>
</object>
+1  A: 

You need to set the flashVars param in both the object as well as the embed tag. Check out this link http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_3.html

<object id='mySwf' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab' height='100%' width='100%'>
        <param name='src' value='FlashVarTest.swf'/>
        <param name='flashVars' value='firstName=Nick&lastName=Danger'/>
        <embed name='mySwf' src='FlashVarTest.swf' pluginspage='http://www.adobe.com/go/getflashplayer' height='100%' width='100%' flashVars='firstName=Nick&lastName=Danger'/>
    </object>

To get values inside Flash. Use this:

var firstName:String = stage.loaderInfo.parameters.firstName;
var lastName:String = stage.loaderInfo.parameters.lastName;
Abhinav
I tried that just now, using both your code and dana's... I think the problem still has something to do with the actionscript that tries to pick up the Flashvar :/ using Flash not Flex btw
Leon
Updated the answer with the AS3 code that works for me. See if it solves the issue.
Abhinav
Thanks Abinav! The way I was trying to get the other 2 variables was the problem :) but yeah your way works!
Leon
Glad it worked for you! Best of luck!
Abhinav
+1  A: 

Like George said, you could try using flashvars for both the and tag. Also, I quote my attribute values and escape my ampersand (&). The following code should work:

<object width="640" height="395" border="0">
    <param name="flashvars" value="file=http://howtoevery.vo.llnwd.net/o18/Pantene_TaylorSwiftUpDo_H_828-640x360.flv&amp;amp;VID=1273&amp;amp;CHID=4" />
    <embed src="http://dev.howdini.com/embed.swf" width="640" height="395" flashvars="file=http://howtoevery.vo.llnwd.net/o18/Pantene_TaylorSwiftUpDo_H_828-640x360.flv&amp;amp;VID=1273&amp;amp;CHID=4"&gt;
    </embed>
</object>
dana
Thanks, but still the player doesn't render, does my Flash code look correct?
Leon
OK, a couple of things here. First, your flash code shouldn't have to split the flashvars string. Depending on which version of flash you use, you can get at the flashvars object in a different way. in AS3 for example, you would do something like this:var x:String = LoaderInfo(this.root.loaderInfo).x;var y:String = LoaderInfo(this.root.loaderInfo).y;var z:String = LoaderInfo(this.root.loaderInfo).z;Also, try replacing the forward slashes (/) with %2f. For instance: http:%2f%2fhowtoevery... Not sure if that will help but it might?
dana
I wish I could check both you and Abinav, but heres a vote up at least :D thanks!
Leon
No problem, good luck with your project :)
dana