希望能提供访问GLoader[_content2]内容的官方api

GLoader可以装载GComponent, 这个特性很赞.
 
这样可以在GLoader上做动画, 然后所有的装载进入的Component都可以统一动效
 
但是有个问题就是无法再次访问设计期装入的GCompnent内容了,比如要加事件什么的
 
hack了一下代码发现有一个_content2是放这个内容的, 希望能公开一个api方便调用
 
感谢
已邀请:

谷主

赞同来自: jetmouse

既然都看到源码了,看不到有api返回_content2吗。特性介绍官网教程里都有。

jetmouse

赞同来自:

设计期可以用控制器指定GLoader的URL, 这个完全可以写一个blog和特性介绍了,

jetmouse

赞同来自:

_content2是私有的, 没有看到有返回的api呀



class GLoader extends GObject {
_content: MovieClip;
private _url;
private _align;
private _verticalAlign;
private _autoSize;
private _fill;
private _shrinkOnly;
private _showErrorSign;
private _playing;
private _frame;
private _color;
private _contentItem;
private _contentSourceWidth;
private _contentSourceHeight;
private _contentWidth;
private _contentHeight;
private _container;
private _errorSign;
private _content2;
private _updatingLayout;
private static _errorSignPool;
constructor();
dispose(): void;
url: string;
icon: string;
align: AlignType;
verticalAlign: VertAlignType;
fill: LoaderFillType;
shrinkOnly: boolean;
autoSize: boolean;
playing: boolean;
frame: number;
color: cc.Color;
fillMethod: FillMethod;
fillOrigin: FillOrigin;
fillClockwise: boolean;
fillAmount: number;
showErrorSign: boolean;
readonly component: GComponent;
texture: cc.SpriteFrame;
protected loadContent(): void;
protected loadFromPackage(itemURL: string): void;
protected loadExternal(): void;
private onLoaded;
protected freeExternal(texture: cc.SpriteFrame): void;
protected onExternalLoadSuccess(texture: cc.SpriteFrame): void;
protected onExternalLoadFailed(): void;
private setErrorState;
private clearErrorState;
private updateLayout;
private clearContent;
protected handleSizeChanged(): void;
protected handleAnchorChanged(): void;
protected handleGrayedChanged(): void;
hitTest(globalPt: cc.Vec2): GObject;
getProp(index: number): any;
setProp(index: number, value: any): void;
setup_beforeAdd(buffer: ByteBuffer, beginPos: number): void;
}
 

jetmouse

赞同来自:

找到了, 居然叫component

要回复问题请先登录注册