Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Me1000

macrumors 68000
Original poster
Jul 15, 2006
1,794
4
ok on my PHP page a car will be difined

for example the URL would be
somesite.com/page.php?movie=4

then i will code it so that the var will mean something,

then the var will turn into something important

$var='somesite.com/movies/'.$movie.'.flv' ;
translating into
$var='somesite.com/movies/4.flv' ;

heres where the flash movie comes in...

when i have a video playback in my SWF file the location of the flash video file (the FLV file) needs to be $var

I hope im making since.

anyway,
How to I transfer that var over to the flash movie?


Thanks
 
Just pass the variables into flash eg

PHP:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%" id="multitxt" align="middle">
  <param name="allowScriptAccess" value="sameDomain" />
  <param name="swliveconnect" value="true" />
  <param name="menu" value="false" />
  <param name="movie" value="example.swf" />
  <param name="quality" value="high" />
  <param name="bgcolor" value="#ffffff" />
  <param name="FlashVars" value="var=<?php echo $var ?>" />
  <embed src="example.swf" quality="high" bgcolor="#ffffff" menu="false" width="100%" height="100%" name="multitxt" align="middle" allowscriptaccess="sameDomain" swliveconnect="true" FlashVars="var=<?php echo $var ?>" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
The important lines are

<param name="FlashVars" value="var=<?php echo $var ?>" />

and

FlashVars="var=<?php echo $var ?>"
 
How will that display...

How do i use the var in flash?
 
Me1000 said:
How will that display...

How do i use the var in flash?
In actionscript, it will be available as var as well, in _level0
try doing a trace with the variable _root.var

<param name="FlashVars" value="var=<?php echo $var ?>" />

FlashVars="var=<?php echo $var ?>"
 
Ok

Thank you,

I dont really need it in action script though.
in my Perimeters menu of my video player I need to know what to set the content path to.

(see screenshot for a visual)

Thanks again,
I really appreciate it!
 

Attachments

  • Picture-3.gif
    Picture-3.gif
    25.2 KB · Views: 211
I'm not too sure this will this be the best way but you may need to dynamically load your flv through actionscript

Try this

In here it would be
Code:
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime(3);
video1_video.attachVideo(stream_ns);
stream_ns.play(_root.var);

EDIT: typo and I wouldn't recommend using the variable name as var as it is a reserved word
 
ok heres my exact php code..

PHP:
<?

$url = 'http://www.scifisite.net/media/'.$vid.'.flv'

?>

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="600" id="multitxt" align="middle"> 
  <param name="allowScriptAccess" value="sameDomain" /> 
  <param name="swliveconnect" value="true" /> 
  <param name="menu" value="false" /> 
  <param name="movie" value="media/player.swf" /> 
  <param name="quality" value="high" /> 
  <param name="bgcolor" value="#ffffff" /> 
  <param name="FlashVars" value="var=<?php echo $url ?>" /> 
  <embed src="media/player.swf" quality="high" bgcolor="#ffffff" menu="false" width="800" height="600" name="multitxt" align="middle" allowscriptaccess="sameDomain" swliveconnect="true" FlashVars="var=<?php echo $url ?>" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> 
</object>


and here is my flash script...

Code:
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime(3);
video1_video.attachVideo(stream_ns);
stream_ns.play(_root.var);

The playback things, instant name is video1_video

and it doesnt work :eek:

for example if you goto payer.php?vid=1 then it never loads! although the file does exists
 
I don't have a flv server, so I can't really test it out for you, but try rename "var" as another name as "var" is a reserved word in actionscript.
 
here
<param name="FlashVars" value="var=<?php echo $url ?>" />
and here
stream_ns.play(_root.var);

???

EDIT: ok well i did that, and it is still not working.
I think my problem is in the SWF/FLA file.

do you think you could make one up real fast and send it to me?
If its not too much trouble! :eek:
 
I don't have a flv streaming server, so I cannot demostrate the flv version, but here's something together with that showing loading a img from the variable, if you see in my html, I actually push in 2 variables.
 

Attachments

  • fla.zip
    155.9 KB · Views: 202
I need to do the same thing. Did you ever get this working? If so let me know what you did.

Also I don't think it matters if you have a FLV streaming server or not.
You should be able to use the Flash Video Player component and tell it where to find the flv file on your server and it will play it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.