protected void LoadFromPackage(string itemURL)
{
_contentItem = UIPackage.GetItemByURL(itemURL);
if (_contentItem != null)
{
_contentItem.Load();
if (_contentItem.type == PackageItemType.Image)
{
_content.texture = _contentItem.texture;
_content.scale9Grid = _contentItem.scale9Grid;
_content.scaleByTile = _contentItem.scaleByTile;
_content.tileGridIndice = _contentItem.tileGridIndice;
_contentSourceWidth = _contentItem.width;
_contentSourceHeight = _contentItem.height;
UpdateLayout();
}
else if (_contentItem.type == PackageItemType.MovieClip)
{
_contentSourceWidth = _contentItem.width;
_contentSourceHeight = _contentItem.height;
_content.interval = _contentItem.interval;
_content.swing = _contentItem.swing;
_content.repeatDelay = _contentItem.repeatDelay;
_content.SetData(_contentItem.texture, _contentItem.frames, new Rect(0, 0, _contentSourceWidth, _contentSourceHeight));
UpdateLayout();
}
else
SetErrorState();
}
else
SetErrorState();
}