| Package | com.threerings.media |
| Class | public class MediaContainer |
| Inheritance | MediaContainer flash.display.Sprite |
| Subclasses | ScalingMediaContainer |
| Property | Defined by | ||
|---|---|---|---|
| _h : int The unscaled height of our content.
| MediaContainer | ||
| _initialized : Boolean If we're using a Loader, true once the INIT event has been dispatched.
| MediaContainer | ||
| _isImage : Boolean Are we displaying an image?
| MediaContainer | ||
| _media : DisplayObject Either a Loader or a VideoDisplay.
| MediaContainer | ||
| _url : String The unaltered URL of the content we're displaying.
| MediaContainer | ||
| _w : int The unscaled width of our content.
| MediaContainer | ||
| Method | Defined by | ||
|---|---|---|---|
|
MediaContainer(url:String = null)
Constructor.
| MediaContainer | ||
|
containerDimensionsUpdated(newWidth:Number, newHeight:Number):void
Called by MediaWrapper as notification that its size has changed.
| MediaContainer | ||
|
getContentHeight():int
Get the height of the content, bounded by the maximum.
| MediaContainer | ||
|
getContentWidth():int
Get the width of the content, bounded by the maximum.
| MediaContainer | ||
|
getMaxContentHeight():int
Get the maximum allowable height for our content.
| MediaContainer | ||
|
getMaxContentWidth():int
Get the maximum allowable width for our content.
| MediaContainer | ||
|
getMedia():DisplayObject
Get the media.
| MediaContainer | ||
|
getMediaScaleX():Number
Get the X scaling factor to use on the actual media.
| MediaContainer | ||
|
getMediaScaleY():Number
Get the Y scaling factor to use on the actual media.
| MediaContainer | ||
|
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
Note: This method is NOT used in normal mouseOver calculations.
| MediaContainer | ||
|
isContentInitialized():Boolean
Return true if the content has been initialized.
| MediaContainer | ||
|
setMedia(url:String):void
Configure the media to display.
| MediaContainer | ||
|
setMediaBytes(bytes:ByteArray):void
Set the media to display as a ByteArray.
| MediaContainer | ||
|
setMediaClass(clazz:Class):void
Configure our media as an instance of the specified class.
| MediaContainer | ||
|
setMediaObject(disp:DisplayObject):void
Configure an already-instantiated DisplayObject as our media.
| MediaContainer | ||
|
setShutdownOnRemove(enable:Boolean = true):void
Sets whether this MediaContainer automatically shuts down when removed
from the stage.
| MediaContainer | ||
|
shutdown(completely:Boolean = true):void
Unload the media we're displaying, clean up any resources.
| MediaContainer | ||
|
toString():String
| MediaContainer | ||
| Method | Defined by | ||
|---|---|---|---|
|
addListeners(info:LoaderInfo):void
Add our listeners to the LoaderInfo object.
| MediaContainer | ||
|
configureMask(rect:Rectangle):void
Configure the mask for this object.
| MediaContainer | ||
|
contentDimensionsUpdated():void
Called when we know the true size of the content.
| MediaContainer | ||
|
createVideoUI(player:VideoPlayer):DisplayObject
Create the actual display for the VideoPlayer.
| MediaContainer | ||
|
didShowNewMedia():void
A place where subclasses can configure things after we've setup new media.
| MediaContainer | ||
|
getContext(url:String):LoaderContext
Return the LoaderContext that should be used to load the media
at the specified url.
| MediaContainer | ||
|
getMaskRectangle():Rectangle
Get the mask area, or null if no mask is needed.
| MediaContainer | ||
|
getSecurityDomain(imageURL:String):SecurityDomain
Return the security domain to use for the specified image url.
| MediaContainer | ||
|
handleComplete(event:Event):void
Callback function to receive COMPLETE events for swfs or images.
| MediaContainer | ||
|
handleError(event:ErrorEvent):void
A callback to receive IO_ERROR and SECURITY_ERROR events.
| MediaContainer | ||
|
handleInit(event:Event):void
Handles the INIT event for content loaded with a Loader.
| MediaContainer | ||
|
handleProgress(event:ProgressEvent):void
A callback to receive PROGRESS events.
| MediaContainer | ||
|
handleShutdownOnRemove(event:Event):void
Handle shutting us down when we're removed.
| MediaContainer | ||
|
initLoader():Loader
Initialize a Loader as our _media, and configure it however needed to prepare
loading user content.
| MediaContainer | ||
|
isImage(url:String):Boolean
Does the specified url represent an image?
| MediaContainer | ||
|
removeListeners(info:LoaderInfo):void
Remove our listeners from the LoaderInfo object.
| MediaContainer | ||
|
setupBrokenImage(w:int = -1, h:int = -1):void
Display a 'broken image' to indicate there were troubles with
loading the media.
| MediaContainer | ||
|
setupSwfOrImage(url:String):void
Configure this sprite to show an image or flash movie.
| MediaContainer | ||
|
setupVideo(url:String):void
Configure this sprite to show a video.
| MediaContainer | ||
|
showNewMedia(url:String):void
| MediaContainer | ||
|
shutdownMedia():void
Do whatever is necessary to shut down the media.
| MediaContainer | ||
|
startedLoading():void
Called when we've started loading new media.
| MediaContainer | ||
|
stoppedLoading():void
Called when we've stopped loading, which may be as a result of
completion, an error while loading, or early termination.
| MediaContainer | ||
|
updateContentDimensions(ww:int, hh:int):void
Called during loading as we figure out how big the content we're
loading is.
| MediaContainer | ||
|
updateLoadingProgress(soFar:Number, total:Number):void
Update the graphics to indicate how much is loaded.
| MediaContainer | ||
|
willShowNewMedia():void
A place where subclasses can initialize things prior to showing new media.
| MediaContainer | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when we've shown new media. | MediaContainer | |||
| Dispatched when we've initialized our content. | MediaContainer | |||
| Dispatched when the size of the media being loaded is known. | MediaContainer | |||
| Dispatched when we've unloaded our content... | MediaContainer | |||
| Constant | Defined by | ||
|---|---|---|---|
| SIZE_KNOWN : String = "mediaSizeKnown" [static] A ValueEvent we dispatch when our size is known.
| MediaContainer | ||
| Constant | Defined by | ||
|---|---|---|---|
| log : Log
[static] A log instance that can be shared by sprites.
| MediaContainer | ||
| _h | property |
protected var _h:intThe unscaled height of our content.
| _initialized | property |
protected var _initialized:BooleanIf we're using a Loader, true once the INIT event has been dispatched.
| _isImage | property |
protected var _isImage:BooleanAre we displaying an image?
| _media | property |
protected var _media:DisplayObjectEither a Loader or a VideoDisplay.
| _url | property |
protected var _url:StringThe unaltered URL of the content we're displaying.
| _w | property |
protected var _w:intThe unscaled width of our content.
| MediaContainer | () | constructor |
public function MediaContainer(url:String = null)Constructor.
Parametersurl:String (default = null) |
| addListeners | () | method |
protected function addListeners(info:LoaderInfo):voidAdd our listeners to the LoaderInfo object.
Parametersinfo:LoaderInfo |
| configureMask | () | method |
protected function configureMask(rect:Rectangle):voidConfigure the mask for this object.
Parametersrect:Rectangle |
| containerDimensionsUpdated | () | method |
public function containerDimensionsUpdated(newWidth:Number, newHeight:Number):voidCalled by MediaWrapper as notification that its size has changed.
ParametersnewWidth:Number |
|
newHeight:Number |
| contentDimensionsUpdated | () | method |
protected function contentDimensionsUpdated():voidCalled when we know the true size of the content. Subclasses may override and use this opportunity to do their thing, too.
| createVideoUI | () | method |
protected function createVideoUI(player:VideoPlayer):DisplayObjectCreate the actual display for the VideoPlayer.
Parametersplayer:VideoPlayer |
DisplayObject |
| didShowNewMedia | () | method |
protected function didShowNewMedia():voidA place where subclasses can configure things after we've setup new media.
| getContentHeight | () | method |
public function getContentHeight():intGet the height of the content, bounded by the maximum.
Returnsint |
| getContentWidth | () | method |
public function getContentWidth():intGet the width of the content, bounded by the maximum.
Returnsint |
| getContext | () | method |
protected function getContext(url:String):LoaderContextReturn the LoaderContext that should be used to load the media at the specified url.
Parametersurl:String |
LoaderContext |
| getMaskRectangle | () | method |
protected function getMaskRectangle():RectangleGet the mask area, or null if no mask is needed.
ReturnsRectangle |
| getMaxContentHeight | () | method |
public function getMaxContentHeight():intGet the maximum allowable height for our content.
Returnsint |
| getMaxContentWidth | () | method |
public function getMaxContentWidth():intGet the maximum allowable width for our content.
Returnsint |
| getMedia | () | method |
public function getMedia():DisplayObjectGet the media. If the media was loaded using a URL, this will likely be the Loader object holding the real media.
ReturnsDisplayObject |
| getMediaScaleX | () | method |
public function getMediaScaleX():NumberGet the X scaling factor to use on the actual media.
ReturnsNumber |
| getMediaScaleY | () | method |
public function getMediaScaleY():NumberGet the Y scaling factor to use on the actual media.
ReturnsNumber |
| getSecurityDomain | () | method |
protected function getSecurityDomain(imageURL:String):SecurityDomainReturn the security domain to use for the specified image url.
ParametersimageURL:String |
SecurityDomain |
| handleComplete | () | method |
protected function handleComplete(event:Event):voidCallback function to receive COMPLETE events for swfs or images.
Parametersevent:Event |
| handleError | () | method |
protected function handleError(event:ErrorEvent):voidA callback to receive IO_ERROR and SECURITY_ERROR events.
Parametersevent:ErrorEvent |
| handleInit | () | method |
protected function handleInit(event:Event):voidHandles the INIT event for content loaded with a Loader.
Parametersevent:Event |
| handleProgress | () | method |
protected function handleProgress(event:ProgressEvent):voidA callback to receive PROGRESS events.
Parametersevent:ProgressEvent |
| handleShutdownOnRemove | () | method |
protected function handleShutdownOnRemove(event:Event):voidHandle shutting us down when we're removed. Only called if setShutdownOnRemove() was enabled.
Parametersevent:Event |
| hitTestPoint | () | method |
public override function hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):BooleanNote: This method is NOT used in normal mouseOver calculations. Normal mouseOver stuff seems to be completely broken for transparent images: the transparent portion is a 'hit'. I've (Ray) tried just about everything to fix this, more than once. But if someone oescall this method (we do, in whirled), then attempt to do the right thing.
Parametersx:Number |
|
y:Number |
|
shapeFlag:Boolean (default = false) |
Boolean |
| initLoader | () | method |
protected function initLoader():LoaderInitialize a Loader as our _media, and configure it however needed to prepare loading user content.
ReturnsLoader |
| isContentInitialized | () | method |
public function isContentInitialized():BooleanReturn true if the content has been initialized. For most content, this is true if the media is non-null, but for anything loaded with a Loader, it is only true after the INIT event is dispatched.
ReturnsBoolean |
| isImage | () | method |
protected function isImage(url:String):BooleanDoes the specified url represent an image?
Parametersurl:String |
Boolean |
| removeListeners | () | method |
protected function removeListeners(info:LoaderInfo):voidRemove our listeners from the LoaderInfo object.
Parametersinfo:LoaderInfo |
| setMedia | () | method |
public function setMedia(url:String):voidConfigure the media to display.
Parametersurl:String |
| setMediaBytes | () | method |
public function setMediaBytes(bytes:ByteArray):voidSet the media to display as a ByteArray.
Parametersbytes:ByteArray |
| setMediaClass | () | method |
public function setMediaClass(clazz:Class):voidConfigure our media as an instance of the specified class.
Parametersclazz:Class |
| setMediaObject | () | method |
public function setMediaObject(disp:DisplayObject):voidConfigure an already-instantiated DisplayObject as our media.
Parametersdisp:DisplayObject |
| setShutdownOnRemove | () | method |
public function setShutdownOnRemove(enable:Boolean = true):voidSets whether this MediaContainer automatically shuts down when removed from the stage. By default this is not enabled.
Parametersenable:Boolean (default = true) |
| setupBrokenImage | () | method |
protected function setupBrokenImage(w:int = -1, h:int = -1):voidDisplay a 'broken image' to indicate there were troubles with loading the media.
Parametersw:int (default = -1) |
|
h:int (default = -1) |
| setupSwfOrImage | () | method |
protected function setupSwfOrImage(url:String):voidConfigure this sprite to show an image or flash movie.
Parametersurl:String |
| setupVideo | () | method |
protected function setupVideo(url:String):voidConfigure this sprite to show a video.
Parametersurl:String |
| showNewMedia | () | method |
protected function showNewMedia(url:String):voidParameters
url:String |
| shutdown | () | method |
public function shutdown(completely:Boolean = true):voidUnload the media we're displaying, clean up any resources.
Parameterscompletely:Boolean (default = true) — if true, we're going away and should stop
everything. Otherwise, we're just loading up new media.
|
| shutdownMedia | () | method |
protected function shutdownMedia():voidDo whatever is necessary to shut down the media.
| startedLoading | () | method |
protected function startedLoading():voidCalled when we've started loading new media. Will not be called for new media that does not require loading.
| stoppedLoading | () | method |
protected function stoppedLoading():voidCalled when we've stopped loading, which may be as a result of completion, an error while loading, or early termination.
| toString | () | method |
public override function toString():String
Returns
String |
| updateContentDimensions | () | method |
protected function updateContentDimensions(ww:int, hh:int):voidCalled during loading as we figure out how big the content we're loading is.
Parametersww:int |
|
hh:int |
| updateLoadingProgress | () | method |
protected function updateLoadingProgress(soFar:Number, total:Number):voidUpdate the graphics to indicate how much is loaded.
ParameterssoFar:Number |
|
total:Number |
| willShowNewMedia | () | method |
protected function willShowNewMedia():voidA place where subclasses can initialize things prior to showing new media.
| complete | event |
| init | event |
flash.events.Event
Dispatched when we've initialized our content. This is merely a redispatch of the INIT event we get from the loader.
| mediaSizeKnown | event |
com.threerings.util.ValueEvent
Dispatched when the size of the media being loaded is known.
| unload | event |
flash.events.Event
Dispatched when we've unloaded our content... always. The LoaderInfo's UNLOAD event is only dispatched if the INIT event has already been dispatched and not if you cancel a load before it INIT.
| log | constant |
protected static const log:LogA log instance that can be shared by sprites.
| SIZE_KNOWN | constant |
public static const SIZE_KNOWN:String = "mediaSizeKnown"A ValueEvent we dispatch when our size is known. Value: [ width, height ].