|
|
|
#1 |
|
Junior Member
Join Date: Sep 2004
Posts: 3
|
Variables and External sources
I have an mp3player that loads an external mp3 file and plays. It works just fine if the url/location is hardcoded in the swf file.
however, i need to be able to have the url passed to the flash externally so that a number of users may utilize this single swf build. example: current location need to be filename.mp3 or http://www.domain.com/123/filename.mp3 however, i need this location to be edited per use of the swf. in php i know i could call it such as: $myLocation = "123"; http://www.domain.com/$myLocation/filename.mp3 or $myLocation = "http://www.domain.com/123/filename.mp3"; (the "123" is what changes for each page use) how do i do this within actionscripting? Here is the code i have that is working just fine... until i need to use a full url that changes for each page the swf is use on. onClipEvent (load) { if (playing!=true) { playing=true; soundIsLoaded=1 myMusic=new Sound(); myMusic.loadSound("myMusic.mp3",true) } } Limitations: 1. because of the server set up, i am always required to call items using full absolute urls/paths. 2. php, cfm, xml etc are not available for use with this. -- the goal is to be able to give an webmaster a copy of the swf and the code to embed it on their html page... and that's it. Thank you! And I apologize in advance if this has been answered or its so simple one would feel the need to roll ones eyes. I'm stuck.
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
In the HTML code that embeds the movie, there is an object tag and an embed tag.
Both of these tags contain references to the .swf file you are using, like so: <param name="movie" value="bellcurve.swf" /> ... <embed src="bellcurve.swf" ... etc.> In both cases, you can load up variables after the swf, like so: <param name="movie" value="bellcurve.swf?myVar=xxx&myVar2=yyy" /> ... <embed src="bellcurve.swf?myVar=xxx&myVar2=yyy" ... etc.> And then when the movie runs, these variables will be available for your use in actionscript (attached to _root). I would suggest that you pass the desired URL to the movie this way. - Jim |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2004
Posts: 3
|
thank you thank you...
i was just trying to figure out how to go that route. Lets say i use.... <param name="movie" value="bellcurve.swf?myVar=http://domain.com/123/myMusic.mp3"> where or how do i call myVar within the code below? I tried: myMusic.loadSound(myVar, true) what am i missing? onClipEvent (load) { if (playing!=true) { playing=true; soundIsLoaded=1 myMusic=new Sound(); myMusic.loadSound("myMusic.mp3",true) } } |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Sep 2004
Posts: 3
|
you can also add variables by doing this:
<param name="flashvars" value="myVar=varValue"> and then in the flash all you have to do to call the variables is us _root.myVar etc. etc. thanks!! (this is working for me...not sure if this is just my servers, or anyone using flash 6 or above) |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|