• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Text from url into flash files


tbwcf

Active Member
#1
Hi All,

Does anyone know how to pull text from a url into a swf file on a webpage basically like how you would pass info from one web form page to another using javascript.

So your url might be www.bob.com/index.php?name=Dave

Then somewhere in your swf file you would have the field / element with id=name which would display the text "Dave" pulled in from the url....

I'm in the process of working it out but if anyone can speed up the process it would be appreciated!

Let me know if I'm unclear and I'll try to explain

Thanks in advance

Andy
 
C

chrismitchell

Guest
#2
If you can get the text go dynamically go to a text file then it can be done by dynamic text from Flash to load from that txt file Andy.. I will have a look through my old Flash books for more info :)
 

CSparkes

Senior Member
#3
Theres a couple of ways of doing it.

For example Filename would be got from the url by php etc......

If using objext to display flash have this in html
<param name="FlashVars" value="xmlFilename=FILENAME" />

Then in actionscript, off top of head something like _root. xmlFilename That bit is case sensitive.
 

CSparkes

Senior Member
#6
Ok, dont know how to grab for PHP but coldfusion would be like

<cfoutput><param name="FlashVars" value="urlName=#url.name#" /> </cfoutput>

Then in flash actionscript have fild.name = ( _root. urlName);
 
#7
As mentioend by CSparkes, you need to use FlashVars;

Using FlashVars to pass variables to a SWF

That page you linked too is not working from the URL, what is actually happening is that the ASP is reading the URL and variables and writing them into the flash tags... if you look at the source you can see this...

OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0

WIDTH=500 HEIGHT=100%>

<PARAM NAME=movie VALUE="http://buy-for-cheap.com/spare/funny/walmart.swf?text=IS+GASH"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="http://buy-for-cheap.com/spare/funny/walmart.swf?text=IS+GASH" quality=high bgcolor=#FFFFFF WIDTH=539 HEIGHT=400 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
That is where flash is reading it from.
 

tbwcf

Active Member
#9
Hi Darren yeah that's pretty much it, it does pull info from the url then adds to the end of the swf?=etcetc from the looks it can be done with php javascript or whatever takes your fancy I'm gonna get jiggy with it this morning
 
#10
tbwcf said:
Hi Darren yeah that's pretty much it, it does pull info from the url then adds to the end of the swf?=etcetc from the looks it can be done with php javascript or whatever takes your fancy I'm gonna get jiggy with it this morning
Javascript is messy and client side. Unless you need to allow the user external control (for e.g. buttons outside of the flash, like on the webpage to change the flash video) then stay away :)

PHP/ASP etc are all server side and much cleaner. As you can see from my example PHP code or CSparkes example ColdFusion it is very little code that is needed.

If you have any problems and need some code. Just shout :)