Re: Any solution for a taske with flash player emb eded in javascript?
|
Hilda Wasah |
|
1/4/2008 1:11:41 AM |
Choodain, Do you have an example of the program uploaded somewhere? Because I don't see a reason for that to be failing. Also if you can post the actionscript code will be very usefull.
Kind regards, Post Comments |
|
thanks so much for the reply Hilda Here is the code....
<!--html code-->
<object type="application/x-shockwave-flash" data="Mp3Player.swf" id="Mp3Player" width="300" height="30"> <param name="movie" value="Mp3Player.swf" /> <embed src="Mp3Player.swf" width="300" height="30" quality=high pluginspage="http://www.macromedia.com/go/getflashplayer" type='application/x-shockwave-flash' id="Mp3Player"> </embed> </object>
<!--ends here--------->
<script>
function playsong(song)//called once click on the url
{ detect_browser("Mp3Player").asFunc(song); }
function detect_browser(song)//for crossbrowser,returns true if it's IE else False
{ alert(navigator.appName); var isIE = navigator.appName.indexOf("Microsoft") != -1; return (isIE) ? window[song]:document[song]; }
Post Comments |
|
Re: Sorry for the late reply!
|
Hilda Wasah |
|
1/4/2008 1:25:04 AM |
Hi! Sorry for the late reply! I've been very bussy. I think the error might bee here
Code: ( javascript ) -
var isIE = navigator.appName.indexOf("Microsoft") != -1; -
return (isIE) ? window[song]:document[song];
More exactly in the last line, you put window[song], but when using the array object notation (like an associative array), the index must be passed as a string, otherwise the script will look for a song variable and it won't find it. If for some reason it works in firefox I don't know why. Is the song a variable? If not correct that, pass it as a string (between quotes) like this window["song"]:document["song"]; Another thing I find strage in your code is that your movie's id is "Mp3Player", that's why I need to know if song is a variable containing this value, "Mp3Player", or what.
Please if you didn't post the full code, post it, because I need to see it completely.
Best regards, Post Comments |
|
Re: Thank you so much for the reply..
|
Chudain Soovay |
|
1/4/2008 1:26:22 AM |
thanks so much for the reply..
song is the path of the file which i want to play. and i think i messed it up in the last post..sorry..
its like this.
<!--indus.html-->
<script> function functin name
{ playsong( 'path of the song') </script>
<!--ind.html ends here-->
<!-- this is js file--> <script> function playsong(song)
{ detect_browser("Mp3Player").asFunc(song); }
</script>
<script> function detect_browser(player_id)
{ var isIE = navigator.appName.indexOf("Microsoft") != -1; return (isIE) ? window[player_id]:document[player_id]; }
</script> <!-- js file ends here-->
Looking for the solution .........
Thanks again for the reply ...
regads, Post Comments |
|
What version of Flash are you using? I totally recomend you to use the ExternalInterface class over the asFunc thingy. ExternalInterface lets u communicate ActionScript with Javascript back and forth. asFunc is totally deprecated since ages. You can find reference of ExternaiInterface here http://www.thescripts.com/forum/thread694359.html
Under the title "Calling ActionScript from JavaScript and vice cersa"
I'm anyway testing your code, to see wher it might be failing.
B est regards Post Comments |
|
Thanks again.When i set allowScriptAccess="always" ,i found it strange. i.e., it never plays the file inFireFox and in IE throws an error like "Object does not support this property or method"..
More interestingly in IE, it throws an error and does not play the file and again if i click on the link it starts playing a song.. i am totally confused with this beavior. i am finding it difficult really...
Please guide me on this...
thanks again..
best regards, Post Comments |
|
Re: Object does not support this property or metho d
|
Chudain Soovay |
|
1/4/2008 1:29:52 AM |
well the error it throws is in the js file.
i.e., exactly in
detect_browser("Player id").asFunc(song to be played)..
gives the error like..Object does not support this property or method
Thanks Post Comments |
|