PDA

View Full Version : SWFObject 2.0 Flashvars


paragonc
06-12-2008, 06:06 PM
I'm trying to pass a random string to multipe swf files using SWFObject 2.0

I'm able to pass the string to one file, but it wont pass to any other object (even if i remove the object that it works on, the string wont pass to the others )

here's the HTML / JS / AS

It only seems to work on mainStage....


package {

import flash.display.*;
import flash.events.*;
import flash.media.Video;
import flash.net.*;
import flash.system.*;
import flash.media.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;

public class LeftScroll extends MovieClip {

var outgoing_lc:LocalConnection = new LocalConnection();

var myText:TextField = new TextField();

public function LeftScroll() {


if (root.loaderInfo.parameters.rs == null) {
myText.text = "Loader is Null";
myText.textColor = 0xFFFFFF;
addChild( myText );
} else {
myText.text = root.loaderInfo.parameters.rs;
myText.textColor = 0xFFFFFF;
addChild( myText );
}


}
}
}


<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var ranString = Math.random().toString();
ranString = ranString.substr(ranString.length -10, 10);
var flashvars = {};
flashvars.rs = ranString;
var params = {};
params.play = "true";
params.loop = "true";
params.menu = "true";
params.quality = "high";
params.scale = "exactfit";
params.wmode = "window";
params.bgcolor = "#000000";
params.devicefont = "false";
params.swliveconnect = "true";
params.allowfullscreen = "true";
params.allowscriptaccess = "sameDomain";
var attributes = {};
attributes.name = "mainStage";
attributes.align = "middle";
swfobject.embedSWF("leftScroll.swf", "slideLeft", "45", "100", "9.0.0", flashvars, params, attributes);
swfobject.embedSWF("mainStage.swf", "mainStage", "785", "486", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("rightScroll.swf", "slideRight", "45", "100", "9.0.0", flashvars, params, attributes);
swfobject.embedSWF("myHeader.swf", "my", "785", "29", "9.0.0", flashvars, params, attributes);
swfobject.embedSWF("footer.swf", "footer", "785", "30", "9.0.0", flashvars, params, attributes);



</script>

paragonc
06-12-2008, 06:26 PM
So it seems like swfobject 2 requires you set un-used parameters to false, so if i dont want express install, but i do want flashvars, i should set it to false like so :

swfobject.embedSWF("leftScroll.swf", "slideLeft", "45", "100", "9.0.0", false, flashvars, params, attributes);

However, thise causes the swf file in question not to render at all.... I'm confused

TCHProgrammer
04-03-2011, 08:05 AM
Hi! Escuse me for my English because I'm from Russia. I would ask you:
1) I installed swfObject.js 2.1 version . Then I tried to use in html-file js-script: so = new swfObject(...). But it doesn't work, the error awake: "object swfObject have not defined" (I don't remember how it's right). I desided, that swfObject.js 2.1 version don't support new swfObject(...) (swfObject.createSWF(...) work very fine). Previous version swfObject.js 1.5 version work very fine (new swfObject(...)). I have done many of flash-projects embedded to html in 1.5 version.
Why so=new swfObject(...) don't work in version 2.1 ?

2) In rar-file of swfObject folder after extracting I detected 2 files of swfObject.js: first file is in root directory of this folder (one string of js text), second file is in sub folder "src" (many strings of js-functions - all functional). May I refer to file in src-folder. May be these files are related by anything?