PDA

View Full Version : Cant read embed variables ??


dub_beat
05-13-2008, 10:20 AM
Hi,

I'm having a weird problem trying to read embedded variables.

The parameters in my html page look like this

<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="testRquest" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="testRquest.swf" /><param name="quality" value="high" /><param name="trackids" value="1,2,3,4,5,6,7,8,9,10"/><param name="bgcolor" value="#ffffff" /> <embed src="testRquest.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="testRquest" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>

I want to be able to read the parameter value of "trackids"

The code that I'm using to try and do this is as follows but when I run it the text field that should hold the parameter displays nothing?


var paramObj = LoaderInfo(this.root.loaderInfo).parameters;
test.text=paramObj.trackids;


As far I know this is how you read embedded variables. Can anyone see why I cant get at my variables?

dub_beat
05-13-2008, 12:25 PM
hi,

I was able to read variables but in a weird way. I'd would be really cool if somebody could explain this to me.

#1 I wanted to read an embedded variable named "var1"

The first thing I did was add this code <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="testRquest" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="var1" value="test"

<embed src="testRquest.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="testRquest" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" var1="test/>
</object>

So I made an embed src declaration and a param object declaration.

When I ran this code test.text was blank and so no variable was read.

test.text=root.loaderInfo.parameters.var1;

#2 After searching a while I came across a forum post that said you had to add the parameter to your javascript block as follows

'flashvars','var1=test',


Could somebody help me understand why you can only read variables from html using flashvars in javascript?

Whats the point in having embed src and parameters if you cant read values from them??

thanks,

dub

amarghosh
05-13-2008, 12:57 PM
this thread handles it:
http://www.actionscript.org/forums/showthread.php3?t=170324

dub_beat
05-13-2008, 01:02 PM
HI thanks for the reply.

Thats not exactly what I'm after or am I missing something?

I dont want to load an external file. I'm trying to read variables for the html page that the flash movie is embedded in

amarghosh
05-13-2008, 01:10 PM
oops: wrong link;
this is the one
http://www.actionscript.org/forums/showthread.php3?t=170495

use html query strings in the movie url;

<param name="movie" value="MyMovie.swf?test=something&anothervar=anothervalue" />
//now u can access it from the constructor of ur main class using:

trace(stage.loaderInfo.parameters.test);
trace(stage.loaderInfo.parameters.anothervar);

dub_beat
05-13-2008, 01:10 PM
Id also like to know is the only way to read embed variables from javascript thats embedded or should I be able to read the variable I want from embed params or embed src?

dub_beat
05-13-2008, 01:21 PM
Nope :(

That wont work for me either.... ?

Theres got to be a way to read variables from <param name="myVar" value="1234"/>