Checking the value of a Loader's contentLoaderInfo.childAllowsParent
itself issues a security warning. This is the value to check to SEE if a security exception would be thrown. So things worked, but now that I'm testing security locally I cannot tolerate 10,000 warnings about security filling my trace log, obliterating any other debug logging. Hack it: just remember if we're loading an image and check that value later. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@275 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -171,6 +171,7 @@ public class MediaContainer extends Sprite
|
|||||||
protected function willShowNewMedia () :void
|
protected function willShowNewMedia () :void
|
||||||
{
|
{
|
||||||
_initialized = false;
|
_initialized = false;
|
||||||
|
_isImage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -382,11 +383,12 @@ public class MediaContainer extends Sprite
|
|||||||
// if we're holding a bitmap, do something smarter than the
|
// if we're holding a bitmap, do something smarter than the
|
||||||
// flash built-in and actually check for *GASP* transparent pixels!
|
// flash built-in and actually check for *GASP* transparent pixels!
|
||||||
try {
|
try {
|
||||||
if (shapeFlag && _media is Loader &&
|
// We should be able to test if the media is a Loader (we can),
|
||||||
// the childAllowsParent check here causes a security
|
// then test if childAllowsParent, but even CHECKING that value causes a security
|
||||||
// violation if it doesn't. WHAT THE FLYING FUCK.
|
// exception. WTF?!? That's supposed to be the value to check to AVOID getting a
|
||||||
Loader(_media).contentLoaderInfo.childAllowsParent &&
|
// security exception. So instead, we track whether or not we've
|
||||||
(Loader(_media).content is Bitmap)) {
|
// loaded an image and use that value.
|
||||||
|
if (shapeFlag && _isImage) {
|
||||||
var b :Bitmap = Bitmap(Loader(_media).content);
|
var b :Bitmap = Bitmap(Loader(_media).content);
|
||||||
var p :Point = b.globalToLocal(new Point(x, y));
|
var p :Point = b.globalToLocal(new Point(x, y));
|
||||||
// check that it's within the content bounds, and then check the bitmap directly
|
// check that it's within the content bounds, and then check the bitmap directly
|
||||||
@@ -426,6 +428,7 @@ public class MediaContainer extends Sprite
|
|||||||
protected function getContext (url :String) :LoaderContext
|
protected function getContext (url :String) :LoaderContext
|
||||||
{
|
{
|
||||||
if (isImage(url)) {
|
if (isImage(url)) {
|
||||||
|
_isImage = true;
|
||||||
// load images into our domain so that we can view their pixels
|
// load images into our domain so that we can view their pixels
|
||||||
return new LoaderContext(true,
|
return new LoaderContext(true,
|
||||||
new ApplicationDomain(ApplicationDomain.currentDomain),
|
new ApplicationDomain(ApplicationDomain.currentDomain),
|
||||||
@@ -657,5 +660,8 @@ public class MediaContainer extends Sprite
|
|||||||
|
|
||||||
/** If we're using a Loader, true once the INIT event has been dispatched. */
|
/** If we're using a Loader, true once the INIT event has been dispatched. */
|
||||||
protected var _initialized :Boolean;
|
protected var _initialized :Boolean;
|
||||||
|
|
||||||
|
/** Are we displaying an image? */
|
||||||
|
protected var _isImage :Boolean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user