Jump to content

php variable in flash object


limecity

Recommended Posts

my question is about flash object code and php.

 

how do i embed a php varible into a flash <object> coding?

 

this is my varible : <{$photo.imgsrc_photo}>

 

this is the flash object code : <param name="FlashVars" value="id=undefinedsrc= < == http://imageURL.jpg == > width=600height=600" >

Link to comment
https://forums.phpfreaks.com/topic/53813-php-variable-in-flash-object/
Share on other sites

This is (part of) the code that needs to go in your HTML or PHP page. I've only included the first part of the embed tag; I assume you know everything else:

 

<EMBED src="[flashmovie].swf" FlashVars="myFlashVar=<?php echo(urlencode($myPHPVar));?>&myFlashVar2=<?php echo(urlencode($myPHPVar2));?>"

 

Hopefully that should work! Make sure you add a dynamic text area in flash, and the variable name should match the flash variable (i.e. "myFlashVar" or "myFlashVar2".

thanks for the quick reply.

this is what I did earlier

 

<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="600" width="500" > 
<param name="movie" value="http://www.britepic.com/britepic.swf"> 
<param name="FlashVars" value="id=305546src=  {$photo.imgsrc_photo}  width=500height=600" > 
<param name="allowscriptaccess" value="always"> 
<param name="wmode" value="transparent"> 
<embed src="http://www.britepic.com/britepic.swf" flashvars=";id=305546src=  {$photo.imgsrc_photo}  width=500height=600" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" height="500" width="600">
</embed></object>

 

I was trying to embed the bridepic ad code into my existing cms gallery which the template shows this

 

<a href="<{$photo.ahref_photo}>" target="_blank" onClick="window.open('<{$photo.ahref_photo}>','','width=<{$photo.window_x}>,height=<{$photo.window_y}>');return(false);"> <img src="<{$photo.imgsrc_photo}>" border="0" align="center" vspace="3" hspace="7" alt="<{$photo.title}>" title="<{$photo.title}>" <{$photo.width_height}> /></a>

 

 

do i replace the urlencode with my site's url?

 

I *think* this should work.... just replace from <embed> to </embed> in your code with this:

 

<embed src="http://www.britepic.com/britepic.swf" FlashVars="id=305546&src=<?php echo(urlencode($photo.imgsrc_photo));?>&width=500&height=600"allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" height="500" width="600">
</embed>

 

 

You will have 4 flash vars:

 

id (which is set to 305546 in here)

src (which is the php variable)

width (which is set to 500)

height (which is set to 600)

 

From what I could tell, you wanted all those variables, right? If you don't want any, just move them after the Flashvars="[content]" block. The example below doesn't have the height and width variables... they are listed as separate  embed parameters (although, you already had those listed as the very last parameters, so they now are conflicting).

 

<embed src="http://www.britepic.com/britepic.swf" FlashVars="id=305546&src=<?php echo(urlencode($photo.imgsrc_photo));?>" width="500" height="600" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" height="500" width="600">
</embed>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.