开发者

how to use base param in flash

I have a flash file(full link to flash looks like http://localhost:8888/PROJECT/swf/audio/player.swf) which loads mp3-file(link to mp3 I send with php through flashvars)

I've embed dynamically(with swfobject) this swf to my page. It's ok. Then I send ajax-request to script, which reloading div with flash. Div is empty.

Experimentally I found out that I've trouble with relative paths. Flash file embed with this address ./swf/audio/player.swf and mp3-address is ./media/audio/user/1/random.mp3. Relative to the root dir those paths are correct.

But if I change mp3-address with ../../media/audio/user/1/random.mp3 everything works as it should!

I've searched and found that there is 'base' param in flash, which set the root dir for flash relative paths. I try use it like this: va开发者_StackOverflowr params = {base:"http://localhost:8888/PROJECT/"}; but without result.

How do I solve this?


The swf's starting location for relative paths is based on the base param. If base is not set, it will default to the position of the html page holding the .swf, wherever the swf is.

http://localhost:8888/PROJECT/media/audio/user/1/random.mp3

This should be the path to you mediea if the param is set as .../PROJECT/

Be carefull with dots in front of paths in AS2, (a single .), it will fail in AS2 sometimes. Try with or without slashes at the end of the base path or at the start of the relative path. Simple things like that can mess up the paths so that they are not readable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜