[]自定义组件时,设置组件子节点的image的skin时,路径为layaIde的路径而非项目路径
package laya.customUI
{
import laya.display.Sprite;
import laya.editorUI.HSlider;
import laya.editorUI.Button;
import laya.ui.Image;
/**
* ...
* @author Caixiansheng
*/
public class HProgressSlider extends HSlider
{
/**@private */
protected var _progress:Image
protected var _proMask:Sprite;
public function HProgressSlider(skin:String=null)
{
super(skin);
}
override protected function initialize():void{
super.initialize();
_proMask = new Sprite();
_proMask.graphics.drawRect(0, 0, _progress.width, _progress.height);
_proMask.scaleX = 0;
_progress.mask = _proMask;
_bar.stateNum = 1;
}
override protected function createChildren():void {
super.createChildren();
var index:Number = getChildIndex(_bg);
addChildAt(_progress = new Image(),index + 1);
}
override protected function changeValue():void{
super.changeValue();
_proMask.scaleX = _value / _max;
_proMask.repaint();
console.log("改变值: " + _proMask.scaleX);
}
/**
*@inheritDoc
*/
override public function destroy(destroyChild:Boolean = true):void {
super.destroy(destroyChild);
_proMask && _proMask.destroy(_proMask);
_progress && _progress.destroy(destroyChild);
_proMask = null;
_progress = null;
}
/**
* 进度条皮肤。
* @return
*/
public function get hProgressSkin():String {
return _progress.skin;
}
public function set hProgressSkin(value:String):void {
console.log("设置progress皮肤: " + value);
_progress.skin = value;
}
}
}
如题,自定义组件,设置img的skin皮肤的时候ide报资源加载失败的错误,资源路径应该为项目路径,而非ide路径
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
cuixueying
赞同来自: