API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LVideo Class

Extends LMedia
Defined in: media/LVideo.js:1

Available since 1.6.0

This class creates a LVideo object.

Constructor

LVideo

() public

Defined in media/LVideo.js:1

Available since 1.6.0

Example:

var backLayer;
var video;
function main () {
    backLayer = new LSprite();
    addChild(backLayer);
    video = new LVideo();
    ......
    backLayer.addEventListener(LMouseEvent.MOUSE_UP,onup);
}
function onup (e) {
    ......
    var url = "./sample.";
    video.load(url+"mp4,"+url+"3gp,"+url+"mov,"+url+"3g2,"+url+"ogv,"+url+"webm");
    video.addEventListener(LEvent.COMPLETE,loadOver);
}
function loadOver (e) {
    var layer = new LSprite();
    layer.addChild(video);
    backLayer.addChild(layer);
    video.play();
}

Methods

addEventListener

(
  • type
  • listener
)
public

Inherited from LEventDispatcher: events/LEventDispatcher.js:16

Available since 1.8.0

Registers an event listener object with an LEventDispatcher object so that the listener receives notification of an event. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.

After you successfully register an event listener, you cannot change its priority through additional calls to addEventListener(). To change a listener's priority, you must first call removeListener(). Then you can register the listener again with the new priority level.

If you no longer need an event listener, remove it by calling removeEventListener(), or memory problems could result.

Parameters:

  • type String

    The type of event.

  • listener Function

    The listener function that processes the event.

callParent

(
  • functionName
  • arguments
)
public

Inherited from LObject: main/LObject.js:22

Available since 1.6.0

call the method of parent。

Parameters:

  • functionName String

    function's name

  • arguments Array

    Fixed value : arguments

Example:

function funA(){
    LExtends(this,LObject,[]);
}
funA.prototype.myName = function(){
    return "AAA";
}
function funB(){
    LExtends(this,funA,[]);
}
funB.prototype.myName = function(){
    return "BBB";
}
function funC(){
    LExtends(this,funA,[]);
}
funC.prototype.myName = function(){
    return this.callParent("myName",arguments);
}
LInit(1000/50,"legend",800,150,main);
function main(){
    LGlobal.setDebug(true);
    var objB = new funB();
    trace(objB.myName());//BBB
    var objC = new funC();
    trace(objC.myName());//AAA
}

close

() public

Inherited from LMedia: media/LMedia.js:217

Available since 1.7.0

Close the currently playing audio/video.

dispatchEvent

(
  • event
)
Boolean public

Inherited from LEventDispatcher: events/LEventDispatcher.js:59

Available since 1.8.0

Dispatches an event into the event flow. The event target is the LEventDispatcher object upon which the dispatchEvent() method is called.

Parameters:

  • event LEvent | String

    The Event object that is dispatched into the event flow. If the event is being redispatched, a clone of the event is created automatically. After an event is dispatched, its target property cannot be changed, so you must create a new copy of the event for redispatching to work.

Returns:

Boolean:

A value of true if the event was successfully dispatched. function MyEventObject(){ var self = this; LExtends(self,LSprite,[]); self.graphics.drawRect(1,"#000000",[0,0,100,100],true,"#000000"); self.graphics.drawRect(1,"#FF0000",[100,0,100,100],true,"#FF0000"); self.addEventListener(LMouseEvent.MOUSE_UP,self.onclick); self.addEventListener(MyEventObject.CLICK_LEFT,function(event){ trace("dispatchEvent"); }); self.addEventListener(MyEventObject.CLICK_RIGHT,function(event){ trace("dispatchEvent event.name = " + event.name); }); } MyEventObject.CLICK_LEFT = "click_left"; MyEventObject.CLICK_RIGHT = "click_right"; MyEventObject.prototype.onclick = function(event){ var self = event.clickTarget; if(event.selfX < 100){ self.dispatchEvent(MyEventObject.CLICK_LEFT); }else{ var event = new LEvent(MyEventObject.CLICK_RIGHT); event.name = "LEvent Test"; self.dispatchEvent(event); } }

getBounds

(
  • targetCoordinateSpace
)
LRectangle public

Inherited from LDisplayObject: display/LDisplayObject.js:258

Available since 1.7.7

Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object.

Parameters:

  • targetCoordinateSpace LDisplayObject

    The display object that defines the coordinate system to use.

Returns:

LRectangle:

The rectangle that defines the area of the display object relative to the targetCoordinateSpace object's coordinate system.

getCurrentTime

() Int public

Inherited from LMedia: media/LMedia.js:108

Available since 1.7.0

Get the time of reproducing.

Returns:

Int:

the time of reproducing.

getDataURL

() Base64 Image public

Inherited from LDisplayObject: display/LDisplayObject.js:306

Available since 1.7.7

Get a string of base64-encoded image.

Returns:

Base64 Image:

a string of base64-encoded image.

getRootCoordinate

() LPoint public

Inherited from LDisplayObject: display/LDisplayObject.js:237

Available since 1.7.7

Get the coordinates (Relative to the canvas).

Returns:

LPoint:

a LPoint object。

getVolume

() Float public

Inherited from LMedia: media/LMedia.js:128

Available since 1.7.0

Get the volume of media.

Returns:

Float:

the volume.

hasEventListener

(
  • type
)
Boolean public

Inherited from LEventDispatcher: events/LEventDispatcher.js:122

Available since 1.8.0

Checks whether the LEventDispatcher object has any listeners registered for a specific type of event. This allows you to determine where an LEventDispatcher object has altered handling of an event type in the event flow hierarchy.

Parameters:

  • type String

    The type of event.

Returns:

Boolean:

A value of true if a listener of the specified type is registered; false otherwise.

load

(
  • url
)
public

Inherited from LMedia: media/LMedia.js:68

Available since 1.7.0

Initiates loading of an external media file from the specified URL.

To support different browsers, you can look like this

medio.load("medias/a.mp3,medias/a.wav,medias/a.ogg");

Parameters:

  • url String

    A URL that points to an external media file.

play

(
  • startTime
  • loops
)
public

Inherited from LMedia: media/LMedia.js:138

Available since 1.7.0

play the media file.

Parameters:

  • startTime Float

    The initial position in milliseconds at which playback should start.

  • loops Int

    Defines the number of times a sound loops back to the startTime value before the sound channel stops playback.

playSegment

(
  • startTime
  • segment
  • loops
)
public

Inherited from LMedia: media/LMedia.js:175

Available since 1.9.0

play segment of audio.

Parameters:

  • startTime Float

    The initial position in milliseconds at which playback should start.

  • segment Float

    length。

  • loops Int

    Defines the number of times a sound loops back to the startTime value before the sound channel stops playback.

playTo

(
  • startTime
  • endTime
  • loops
)
public

Inherited from LMedia: media/LMedia.js:187

Available since 1.9.0

play segment of audio.

Parameters:

  • startTime Float

    start time.

  • endTime Float

    end time.

  • loops Int

    Defines the number of times a sound loops back to the startTime value before the sound channel stops playback.

remove

() public

Inherited from LDisplayObject: display/LDisplayObject.js:379

Available since 1.7.7

Remove self from the parent container.

removeAllEventListener

() public

Inherited from LEventDispatcher: events/LEventDispatcher.js:50

Available since 1.8.0

Removes all the listeners from the LEventDispatcher object.

removeEventListener

(
  • type
  • listener
)
public

Inherited from LEventDispatcher: events/LEventDispatcher.js:29

Available since 1.8.0

Removes a listener from the LEventDispatcher object. If there is no matching listener registered with the LEventDispatcher object, a call to this method has no effect.

Parameters:

  • type String

    The type of event.

  • listener Function

    The listener object to remove.

setVolume

(
  • value
)
public

Inherited from LMedia: media/LMedia.js:118

Available since 1.7.0

Set the volume of media.

Parameters:

  • value Float

    the volume。

stop

() public

Inherited from LMedia: media/LMedia.js:199

Available since 1.7.0

Pauses the currently playing audio/video.

Properties

alpha

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:55

Available since 1.6.0

Indicates the alpha transparency value of the object specified. Valid values are 0 (fully transparent) to 1 (fully opaque). The default value is 1. Display objects with alpha set to 0 are active, even though they are invisible.

Default: 0

blendMode

String public

Inherited from LDisplayObject: display/LDisplayObject.js:91

Available since 1.8.0

A value from the LBlendMode class that specifies which blend mode to use. A bitmap can be drawn internally in two ways. If you have a blend mode enabled or an external clipping mask, the bitmap is drawn by adding a bitmap-filled square shape to the vector render. If you attempt to set this property to an invalid value, runtimes set the value to LBlendMode.NORMAL.

Default: null

filters

Array public

Inherited from LDisplayObject: display/LDisplayObject.js:100

Available since 1.6.0

An indexed array that contains each filter object currently associated with the display object.

Default: null

length

Int public

Inherited from LMedia: media/LMedia.js:15

Available since 1.7.0

The length of LSound object or LVideo object

mask

LDisplayObject public

Inherited from LDisplayObject: display/LDisplayObject.js:82

Available since 1.6.0

The calling display object is masked by the specified mask object. To ensure that masking works when the Stage is scaled, the mask display object must be in an active part of the display list. The mask object itself is not drawn. Set mask to null to remove the mask.

Default: null

objectIndex

Int public

Inherited from LObject: main/LObject.js:11

Available since 1.6.0

ID of the object

playing

Boolean public

Inherited from LMedia: media/LMedia.js:25

Available since 1.7.0

The LSound object or LVideo object is playing.

rotate

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:73

Available since 1.6.0

Indicates the rotation of the LDisplayObject instance, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement my_video.rotate = 450 is the same as my_video.rotate = 90.

Default: 0

scaleX

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:37

Available since 1.6.0

Indicates the horizontal scale (percentage) of the object as applied from the registration point. The default registration point is (0,0). 1.0 equals 100% scale.

Default: 1

scaleY

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:46

Available since 1.6.0

Indicates the vertical scale (percentage) of an object as applied from the registration point of the object. The default registration point is (0,0). 1.0 is 100% scale.

Default: 1

visible

Boolean public

Inherited from LDisplayObject: display/LDisplayObject.js:64

Available since 1.6.0

Whether or not the display object is visible. Display objects that are not visible are disabled. For example, if visible=false for an LInteractiveObject instance, it cannot be clicked.

Default: true

x

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:17

Available since 1.6.0

Indicates the x coordinate of the LDisplayObject instance relative to the local coordinates of the parent LDisplayObjectContainer. If the object is inside a LDisplayObjectContainer that has transformations, it is in the local coordinate system of the enclosing LDisplayObjectContainer. Thus, for a LDisplayObjectContainer rotated 90° counterclockwise, the LDisplayObjectContainer's children inherit a coordinate system that is rotated 90° counterclockwise. The object's coordinates refer to the registration point position.

Default: 0

y

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:26

Available since 1.6.0

Indicates the y coordinate of the LDisplayObject instance relative to the local coordinates of the parent LDisplayObjectContainer. If the object is inside a LDisplayObjectContainer that has transformations, it is in the local coordinate system of the enclosing LDisplayObjectContainer. Thus, for a LDisplayObjectContainer rotated 90° counterclockwise, the LDisplayObjectContainer's children inherit a coordinate system that is rotated 90° counterclockwise. The object's coordinates refer to the registration point position.

Default: 0

Events

LEvent.COMPLETE

Inherited from LMedia: media/LMedia.js:255

when the media is loaded

LEvent.COMPLETE

LEvent.ENTER_FRAME

[broadcast event] Dispatched when the playhead is entering a new frame.

LEvent.ENTER_FRAME