lufy's legend

标题: 将代码部署到eclipse 上的时候,打包时有错误!!! [打印本页]

作者: 987212385    时间: 2014-5-11 23:29
标题: 将代码部署到eclipse 上的时候,打包时有错误!!!
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script language="javascript1.2" src="lufylegend.ui-0.7.0.min.js"></script>
<script language="javascript1.2" src="lufylegend-1.8.10.js"></script>
<script language="javascript1.2" src="lufylegend-1.8.10.min.js"></script>
<script language="javascript1.2" src="lufylegend-1.8.10.simple.js"></script>
<script language="javascript1.2" src="lufylegend-1.8.10.simple.min.js"></script>

</head>

<body>

<div id="mylegend" style=" border:1px solid #666;position: absolute;left: 0px;top: 0px;"></div>

<script language="javascript1.2">

var H = window.screen.height ;//手机分辨率高度
var W = window.screen.width;//手机分辨率宽度
//相对分辨率高度比例
var ratioH = H / 800;
//相对分辨率宽度比例
var ratioW = W / 480;
document.getElementById("mylegend").style.width = W + "px";//画布的宽度
document.getElementById("mylegend").style.height = H + "px";//画布的高度
document.getElementById("mylegend").style.backgroundColor = "#cccccc";//画布颜色


init(40,"mylegend",W,H,main);
        var layer_yi = new LSprite();//第一层容器
    var layer_er = new LSprite();//第二层容器
        function main(){             //启动函数
                addChild(layer_yi);                //包含第一层容器                       
                addChild(layer_er);                //包含第二层容器       
                the_first_layer_background();//加载第一层背景图片


        }
        var loader_the_first_layer_background;//加载背景图片
        var bitmapdata_the_first_layer_background;//用于保存背景图片
        var bitmap_the_first_layer_background;//用于显示背景图片
        var timing_for_3_seconds ;
       
        var loader_turntable_image;
        var bitmapdata_turntable_image;
        var bitmap_turntable_image;
       
        var sound;//音乐加载
        //第一张背景图片*---------*用于后台加载所有的音乐和图片
        function the_first_layer_background(){
               
                loader_the_first_layer_background = new LLoader();  
                loader_the_first_layer_background.addEventListener(LEvent.COMPLETE,loadBitmapdata_the_first_layer_background);  
                loader_the_first_layer_background.load("images/the_first_layer_background_image.png","bitmapData");  
        }  
        function loadBitmapdata_the_first_layer_background(event){  
                bitmapdata_the_first_layer_background = new LBitmapData(loader_the_first_layer_background.content,0,0,480,800);  
                bitmap_the_first_layer_background = new LBitmap(bitmapdata_the_first_layer_background);
                bitmap_the_first_layer_background.scaleX = ratioW;
                bitmap_the_first_layer_background.scaleY = ratioH;
                layer_yi.addChild(bitmap_the_first_layer_background);
               
               
                turntable_image();//加载转盘图片
                music_player();
                timing_for_3_seconds = setTimeout(the_second_layer_background,3000);
        }
        //第二张背景图片*---------*游戏界面  
        function the_second_layer_background(){
                layer_yi.visible = false;
                bitmap_turntable_image.visible = true;
                sound.play();
        }
        //   转盘图片加载
        function turntable_image(){
               
                loader_turntable_image = new LLoader();  
                loader_turntable_image.addEventListener(LEvent.COMPLETE,loadBitmapdata_turntable_image);  
                loader_turntable_image.load("images/rollbackground.png","bitmapData");  
        }  
        function loadBitmapdata_turntable_image(event){  
                bitmapdata_turntable_image = new LBitmapData(loader_turntable_image.content,0,0,400,400);  
                bitmap_turntable_image = new LBitmap(bitmapdata_turntable_image);
                bitmap_turntable_image.visible = false/*true*/;
                bitmap_turntable_image.scaleX = ratioW;
                bitmap_turntable_image.scaleY = ratioH;
                bitmap_turntable_image.x = 40 * ratioW;
                bitmap_turntable_image.y = 40 * ratioH;
                layer_er.addChild(bitmap_turntable_image);
        }  
        //加载音乐
        function music_player(){
       
                LGlobal.setDebug(true);
                sound = new LSound();
                sound.addEventListener(LEvent.COMPLETE,gameInit);
               
                sound.load("music/倩女幽魂.mp3");

        }
        function gameInit(e){
            //sound.play();
        }
</script>
</body>
</html>


打包时。。。。。。eclipse  提示
“[2014-05-11 23:21:03 - GuessTheMusicGame] F:\adt-bundle-windows-x86-20140321\GuessTheMusicGame\assets\www\music\倩女幽魂.mp3: error: Invalid filename.  Unable to add.”


不知道为什么,,,有解不?





作者: lufy    时间: 2014-5-11 23:59
安卓打包的时候,音乐文件你得用url的形势访问,
解决办法:
1,你得准备一个服务器,将你的音乐放到服务器上,或者直接用网络上的音乐。
2,播放音乐部分用java,javascript调用java代码,来播放音乐。

另外,看了你的代码,关于游戏全屏的部分需要提示你一下,引擎中有游戏全屏的api,直接调用就可以完成全屏适配,而且适用于所有机型。
作者: 987212385    时间: 2014-5-12 07:54
像这样的链接吗??????"http://lufylegend.com/media/LSound/kfighter.mp3"
作者: lufy    时间: 2014-5-12 09:14
987212385 发表于 2014-5-12 07:54
像这样的链接吗??????"http://lufylegend.com/media/LSound/kfighter.mp3"

对,就是这样
作者: 987212385    时间: 2014-5-15 11:03
但是还是有错误啊,,,,还是提示一样的文字
作者: 987212385    时间: 2014-5-15 11:04
“播放音乐部分用java,javascript调用java代码,来播放音乐。”
这个能给我一个案例吗?
不懂哦,,
新手来着
作者: lufy    时间: 2014-5-15 15:37
987212385 发表于 2014-5-15 11:04
“播放音乐部分用java,javascript调用java代码,来播放音乐。”
这个能给我一个案例吗?
不懂哦,,

既然开发app,那么用java来播放音频文件应该会吧,
然后百度一下webview中javascript调用java方法,大把大把的资料呢
作者: 987212385    时间: 2014-5-16 16:12
好吧:L:L:L:L:L:L:L:L:L




欢迎光临 lufy's legend (http://lufylegend.com/forum/) Powered by Discuz! X2.5