Added setMediaBytes().
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@553 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -45,6 +45,8 @@ import flash.events.TextEvent;
|
|||||||
import flash.geom.Point;
|
import flash.geom.Point;
|
||||||
import flash.geom.Rectangle;
|
import flash.geom.Rectangle;
|
||||||
|
|
||||||
|
import flash.net.URLRequest;
|
||||||
|
|
||||||
import flash.text.TextField;
|
import flash.text.TextField;
|
||||||
import flash.text.TextFieldAutoSize;
|
import flash.text.TextFieldAutoSize;
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ import flash.system.LoaderContext;
|
|||||||
import flash.system.Security;
|
import flash.system.Security;
|
||||||
import flash.system.SecurityDomain;
|
import flash.system.SecurityDomain;
|
||||||
|
|
||||||
import flash.net.URLRequest;
|
import flash.utils.ByteArray;
|
||||||
|
|
||||||
import com.threerings.util.Log;
|
import com.threerings.util.Log;
|
||||||
import com.threerings.util.StringUtil;
|
import com.threerings.util.StringUtil;
|
||||||
@@ -154,6 +156,22 @@ public class MediaContainer extends Sprite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the media to display as a ByteArray.
|
||||||
|
*/
|
||||||
|
public function setMediaBytes (bytes :ByteArray) :void
|
||||||
|
{
|
||||||
|
if (_media != null) {
|
||||||
|
shutdown(false);
|
||||||
|
}
|
||||||
|
_url = null;
|
||||||
|
|
||||||
|
willShowNewMedia();
|
||||||
|
startedLoading();
|
||||||
|
initLoader().loadBytes(bytes, getContext(null));
|
||||||
|
didShowNewMedia();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure our media as an instance of the specified class.
|
* Configure our media as an instance of the specified class.
|
||||||
*/
|
*/
|
||||||
@@ -492,6 +510,10 @@ public class MediaContainer extends Sprite
|
|||||||
*/
|
*/
|
||||||
protected function isImage (url :String) :Boolean
|
protected function isImage (url :String) :Boolean
|
||||||
{
|
{
|
||||||
|
if (url == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// look at the last 4 characters in the lowercased url
|
// look at the last 4 characters in the lowercased url
|
||||||
switch (url.toLowerCase().slice(-4)) {
|
switch (url.toLowerCase().slice(-4)) {
|
||||||
case ".png":
|
case ".png":
|
||||||
|
|||||||
Reference in New Issue
Block a user