i have a swf in an html page called main.htm - is it possible for the flash to read a variable in the page's url. Eg. main.htm?myVars=here_is_some_text
thanks
Printable View
i have a swf in an html page called main.htm - is it possible for the flash to read a variable in the page's url. Eg. main.htm?myVars=here_is_some_text
thanks
yep have a look at flashvars property http://www.adobe.com/cfusion/knowled...fm?id=tn_16417
That's works well but it's not quite what i need - i need the swf to read in from the URL of the html page: eg. index.html?message=hello!
I suspect i need to find a bit a javascript
http://board.flashkit.com/board/show...71#post2486501
and will both tell you how this is done (link in my footer)
heres an example done for someone else:
http://www.dmstudios.net/urlTest/url...?frameNumber=4
the basic javaScript line that you will need to edit to suit YOUR movie properties..
Code:<script language="JavaScript">
document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'+'width=355 height=255 id=urlTest align=middle><param name=allowScriptAccess value=sameDomain /><param name=movie value="urlTest.swf'+document.location.search+'" /><param name=quality value=high /><param name=bgcolor value=#ffffff /><embed src="urlTest.swf'+document.location.search+'"'+'quality=high bgcolor=#ffffff width=355 height=255 name=urlTest align=middle allowScriptAccess=sameDomain '+'type="application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer" />')
</script>
that's the kiddie...
thanks!
you dont need javascript - it's just a propertyCode:<param name="FlashVars" value="somevar=someval">
I do need javascript because i need to read the HTML PAGE query string.
actually, if you just want to push a variable into a flash file it's more browser/version friendly to simply go "myflash.swf?variable1=blah"
except your calling the .swf......and not the HTML page... sometimes you have hybrid sites...or multiple movies embeded in a page that need to 'feed' of the VAR passed in the URL string.
if i need to read the query string of the page your solution is perfect (tnx again).
i was just pointing out to moagrius that if you merely want to get a variable value into a swf you don't need the 'flashVars' function, just append the name of the swf with the variable name and value, i've used this since flash 4
um. ok.
does anyone know any tutorials on this? i cant get it to work for the life of me
what?? what are you trying to get working?
im having trouble makeing the connection from my one swf to tell it to go to another swf and play a certain frame.
this is the code im using
on(press) {
getURL("http://www.callkarl.ca/main.html?frameName=home");
}
and then in the 2nd swf i have
if (frameName=home) {
gotoAndStop("mark");
}
?? and did you edit the source code in the HTML page that HOUSES the .swf that is supposed to grab the VAR from the URL?
Heres the script you offerd b4
<script language="JavaScript">
document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'+'width=100% height=100% id=urlTest align=middle><param name=allowScriptAccess value=sameDomain /><param name=movie value="main.swf'+document.location.search+'" /><param name=quality value=high /><param name=bgcolor value=#ffffff /><embed src="urlTest.swf'+document.location.search+'"'+'qu ality=high bgcolor=#ffffff width=355 height=255 name=urlTest align=middle allowScriptAccess=sameDomain '+'type="application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer" />')
</script>
since i have to now fix the embeded issue im using this script and trying to edit it with no luck
<script type="text/javascript" src="flashobject.js"></script>
<div id="flashcontent" style="width: 100%px; height: 100%px"></div>
<script type="text/javascript">
var fo = new FlashObject("main.swf", "animationName", "100%", "100%", "8", "#FFFFFF");
fo.addParam("allowScriptAccess", "sameDomain");
fo.addParam("quality", "high");
fo.addParam("scale", "default");
fo.addParam("loop", "false");
fo.write("flashcontent");
</script>
im not really sure which part of have to edit from ur example "main.swf'+document.location.search+'"??
I believe these pats (in bold) to be the parts that would be SPECIFIC to your movie..
as far as changing it to work with IE for the embed issue..havent attempted it yet..sorry, not much help.Code:<script language="JavaScript">
document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'+'width=100% height=100% id=urlTest align=middle><param name=allowScriptAccess value=sameDomain /><param name=movie value="main.swf'+document.location.search+'" /><param name=quality value=high /><param name=bgcolor value=#ffffff /><embed src="urlTest.swf'+document.location.search+'"'+'quality=high bgcolor=#ffffff width=355 height=255 name=urlTest align=middle allowScriptAccess=sameDomain '+'type="application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer" />')
</script>
thanks for ur help, but i still can't get it to work. as u can prolly tell by now im a huge rook andno very little AS. i made a bare-bones example of what im trying to do. can u look at it and tell me what im doing wrong?
well first off (and think is the only thing),..your if(); statement syntax is off.
should be like:
Code:stop();
if (frameName=="home") {
gotoAndStop("home");
}
if (frameName=="info") {
gotoAndStop("info");
}
THANK YOU. that was it
no problem..sometimes its the little things that escape us.. ;)
(done it plenty in my time) LOL