Creator下如何获取资源的绝对路径,比如下图的HelloWorld.png
同问~~
为什么需要获得绝对路径?
有的图标放在了resources, 然后js 代码里需要用到这个图片。
例如之前是这样的代码~~
var imgUrl = cc.url.raw(“resources/OtherPng/pointer12.png”);
cc._canvas.style.cursor = “url(” + imgUrl + “),auto”;
又比如
ima.src = cc.url.raw(imgUrl) + “?v=” + myVersion;
ima.style.position = “absolute”;
用cc.spriteframe类型做脚本属性,然后把资源拖到上面去 这样就相当于动态绑定了吧
不可以的,这个操作html dom节点,不能放在引擎编辑的。
我也想知道这个问题。以前是这样 cc.url.raw(“resources/OtherPng/pointer12.png”),现在不行了
http://docs.cocos.com/creator/1.10/manual/zh/release-notes/raw-asset-migration.html
因为资源加载这块已经重构了。
我就想知道现在如何获取到 资源的绝对路径。
that.bgm1.nativeUrl 这种, 如果有md5cache 用cc.loader.md5Pipe.transformURL(that.bgm1.nativeUrl)转一下
总问这些问题,难道获取绝对路径不是一个需求?头条分享就要本地绝对路径,
但是这个nativeUrl还是一个相对路径啊
cc.assetManager.utils.getUrlWithUuid(uuid, { isNative: !!info.nativeVer, nativeExt: “.png” });