# Passing variable into Flash

**URL:** <https://forum.kirupa.com/t/passing-variable-into-flash/153845>\
**Category:** Uncategorized\
**Created:** [July 5, 2005, 8:44am UTC](https://forum.kirupa.com/t/passing-variable-into-flash/153845 "2005-07-05T08:44:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kedar](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@kedar](https://forum.kirupa.com/u/kedar)\
**Post date:** [July 5, 2005, 8:44am UTC](https://forum.kirupa.com/t/passing-variable-into-flash/153845/1 "2005-07-05T08:44:51Z")

</div>

i’m trying to play a soundfile from external source passing a varible into flash which is called through php.the reason for doing this is without making changes in flash scripting i can play any sound just changing the file name in html. for the refernece i have attached .fla file and also the source code i have used in php. please help me to make it work.

can i do this this way?

source code are …

in flashfile

//soundUrl = “[http://jennl.com/mp3/10011.mp3](http://jennl.com/mp3/10011.mp3)”;  
// create sound object, assign properties and events  
function createSoundObject(){  
translation = new Sound(); // define sound object  
return;  
}  
// create initial sound object  
createSoundObject();

// load and/or play song  
function playSnd(){  
// check playstate  
if(isPlaying){  
status = “playing”;  
return; // deactivate button during play/load  
} else {  
isPlaying = true;  
}  
translation.loadSound(soundUrl,true); // sound automtically plays afer loading  
status = “loading”;  
onEnterFrame = showPlayState; // start tracking playstate  
}

// stop both playback and download  
function stopSnd(){  
translation.stop(); // stop playback  
delete translation; // stop download  
createSoundObject(); // create a new sound object  
isPlaying = false;  
onEnterFrame = null; // stop tracking playstate  
status = “stopped”;  
title = “hit play”;  
}  
// pause sound  
function pauseSnd(){  
translation.stop();  
isPlaying = false;  
onEnterFrame = null; // stop tracking playstate  
status = “paused”;  
}  
stopSnd();  
// assign button events  
playBtn.onRelease = function () {  
playSnd();  
}  
pauseBtn.onRelease = function () {  
pauseSnd();  
}  
stopBtn.onRelease = function () {  
stopSnd();  
}  
stop(); // prevent timeline looping

php codes are …

\<object classid=‘clsid27cdb6e-ae6d-11cf-96b8-444553540000’ codebase=‘[http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0](http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0)’ width=‘70’ height=‘18’ id=‘player’ align=‘middle’\> \<param name=‘allowScriptAccess’ value=‘sameDomain’ /\> \<param name=‘FlashVars’ value=‘soundUrl=…/mp3/10011.mp3’\> \<param name=‘movie’ value=’/flash/player.swf’ /\> \<param name=‘quality’ value=‘high’ /\> \<param name=‘bgcolor’ value=’#ffffff’ /\> \<embed src=’/flash/player.swf’ quality=‘high’ bgcolor=’#ffff00’ width=‘150’ height=‘100’ name=‘player’ align=‘middle’ allowScriptAccess=‘sameDomain’ type=‘application/x-shockwave-flash’ pluginspage=‘[http://www.macromedia.com/go/getflashplayer](http://www.macromedia.com/go/getflashplayer)’ /\> \</object\>"
