Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Hardcode variables

4 replies [Last post]

Just in case anyone else wants to hard-code a variable and can't find a way of doing it in version 4...

Player.as says that you can change the page to hard code, however this doesn't actually hard code, it just sets the defaults.

The config object is loaded first and then the flashvars change the object in Configger.as

Therefore the easiest way to hard code (especially if you aren't greatly experienced in ActionScript 3) is to change

/** Compare and save new items in config. **/
private function compareWrite(obj:Object):void {
for (var cfv:String in obj) {
config[cfv.toLowerCase()] = Strings.serialize(obj[cfv.toLowerCase()]);
}
};

To

/** Compare and save new items in config. **/
private function compareWrite(obj:Object):void {
for (var cfv:String in obj) {
if (cfv.toLowerCase() == "streamer")
{
}
else
{
config[cfv.toLowerCase()] = Strings.serialize(obj[cfv.toLowerCase()]);
}
}
};

You can continue to add blank if statements for other variables.

if (cfv.toLowerCase() == "streamer")
{
}
else if (cfv.toLowerCase() == "file")
{
}
else
{
config[cfv.toLowerCase()] = Strings.serialize(obj[cfv.toLowerCase()]);
}

Make sure you set your (now hard coded) config defaults in the Player.as file.

Graham

That's correct, thanks for the info!

Using this method, How would I hardcode the playlist.xml and the skin.xml?

Thanks!
Rich

@Graham

Excellent post. I truly wish I had skills commensurate with yours and the folks at longtail. In truth I'd be generously described as pretty much a kitchen mechanic when it comes to actionscript but, I am persistent and usually come up with workable solutions even when they are not the most effective means to an end. It was a bit embarrassing when I saw your post as I had just yesterday created a group of tutorials one of which is titled "how to hardcode flashvars". You very accurately point out with your post that I misnamed that piece as all I really should have said it was how to set the defaults.

If you have the time and are generous enough to share more of your ideas I invite you to contribute to my meager attempt to help others from this forum with minor revisions to JW's greate Players. You can message me through the site I put up for that purpose at:<strong>http://mymail.playourvideo.net/tweaks.htm</strong>
Regards - Jimb

Thanks, Graham.

Does anybody knows how to assign a value of one flashvar to another?

I am trying to put:
private function compareWrite(obj:Object):void {
obj["image"]=obj["file"];
for (var cfv:String in obj) {

It is compiling but player disapears.