To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 09-30-2004, 04:21 PM   #1
jenniferlgoode
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.
jenniferlgoode is offline   Reply With Quote
Old 09-30-2004, 04:33 PM   #2
jbum
Senior Member
 
jbum's Avatar
 
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
__________________
jbum is offline   Reply With Quote
Old 09-30-2004, 04:42 PM   #3
jenniferlgoode
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)
}

}
jenniferlgoode is offline   Reply With Quote
Old 09-30-2004, 05:49 PM   #4
jenniferlgoode
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)
jenniferlgoode is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:19 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.