protected void LoadFromPackage(string itemURL)
{
_contentItem = UIPackage.GetItemByURL(itemURL);
if (_contentItem != null)
{
_contentItem.Load();
if (_contentItem.type == PackageItemType.Image)
{
_image.texture = _contentItem.texture;
_image.scale9Grid = _contentItem.scale9Grid;
_image.scaleByTile = _contentItem.scaleByTile;
_activeObject = _image;
_contentSourceWidth = _contentItem.width;
_contentSourceHeight = _contentItem.height;
UpdateLayout();
}
else if (_contentItem.type == PackageItemType.MovieClip)
{
if (_movieClip == null)
{
_movieClip = new MovieClip();
if (grayed)
{
_movieClip.SetGrayed(true);
}
_container.AddChild(_movieClip);
}
_contentSourceWidth = _contentItem.width;
_contentSourceHeight = _contentItem.height;
_movieClip.interval = _contentItem.interval;
_movieClip.SetData(_contentItem.texture, _contentItem.frames);
_movieClip.boundsRect = new Rect(0, 0, _contentSourceWidth, _contentSourceHeight);
_movieClip.playing = _playing;
_movieClip.currentFrame = _frame;
_activeObject = _movieClip;
UpdateLayout();
}
else
{
SetErrorState();
}
}
else
{
SetErrorState();
}
}