annieUI.FacePhoto Class
有时我们需要从外部获取一张个人头像,将它变成方形或者圆形展示出来。 又希望他能按照我们的尺寸展示,这个时候你就需要用到FacePhoto类啦。
Item Index
Methods
- _changeMouseCount
- _onDispatchBubbledEvent
- addChild
- addChildAt
- addEventListener
- dispatchEvent
- DisplayObject
- FacePhoto
- getBounds
- getChildAt
- getChildByName
- getChildIndex
- getDrawRect
- getWH
- globalToLocal
- hasEventListener
- hitTestPoint
- init
- localToGlobal
- removeAllChildren
- removeAllEventListener
- removeChild
- removeChildAt
- removeEventListener
- render
- startDrag
- stopDrag
- update
Methods
_changeMouseCount
-
type
-
isAdd
增加或删除相应mouse或touch侦听记数
_onDispatchBubbledEvent
-
type
-
updateMc
addChildAt
-
child
-
index
Parameters:
-
child
annie.DisplayObject -
index
Number从0开始
addEventListener
-
type
-
listener
给对象添加一个侦听
Parameters:
Example:
this.addEventListener(annie.Event.ADD_TO_STAGE,function(e){trace(this);}.bind(this));
dispatchEvent
-
event
-
data
广播侦听
Parameters:
-
event
annie.Event | String广播所带的事件对象,如果传的是字符串则直接自动生成一个的事件对象,事件类型就是你传入进来的字符串的值
-
data
Object广播后跟着事件一起传过去的其他任信息,默认值为null
Returns:
如果有收听者则返回true
Example:
var mySprite=new annie.Sprite(),
yourEvent=new annie.Event("yourCustomerEvent");
yourEvent.data='Flash2x';
mySprite.addEventListener("yourCustomerEvent",function(e){
trace(e.data);
})
mySprite.dispatchEvent(yourEvent);
DisplayObject
()
public
FacePhoto
()
public
构造函数
Example:
var circleface = new annieUI.FacePhoto(),
rectFace=new annieUI.FacePhoto();
//圆形头像
circleface.init('http://test.annie2x.com/biglong/logo.jpg', 100, 0);
circleface.x = 260;
circleface.y = 100;
s.addChild(circleface);
//方形头像
rectFace.init('http://test.annie2x.com/biglong/logo.jpg', 200, 1);
rectFace.x = 260;
rectFace.y = 400;
s.addChild(rectFace);
getBounds
()
Any
public
Returns:
getChildAt
-
index
Parameters:
-
index
Number从0开始
Returns:
getChildByName
-
name
-
isOnlyOne
-
isRecursive
Parameters:
Returns:
getChildIndex
-
child
Parameters:
-
child
annie.DisplayObject子对象
Returns:
getWH
()
Width: number, height: number
public
如果需要同时获取宽和高的值,建议使用此方法更有效率
Returns:
}
hasEventListener
-
type
是否有添加过此类形的侦听
Parameters:
-
type
String侦听类形
Returns:
如果有则返回true
hitTestPoint
-
globalPoint
-
isMouseEvent
Parameters:
-
globalPoint
annie.Point -
isMouseEvent
Boolean
Returns:
init
-
src
-
radio
-
maskType
被始化头像,可反复调用设置不同的遮罩类型或者不同的头像地址
removeAllChildren
()
public
removeAllEventListener
()
public
移除对象中所有的侦听
removeEventListener
-
type
-
listener
移除对应类型的侦听
render
-
renderObj
Parameters:
-
renderObj
annie.IRender
startDrag
-
isCenter
-
bounds
启动鼠标或者触摸拖动
Parameters:
-
isCenter
Boolean指定将可拖动的对象锁定到指针位置中心 (true),还是锁定到用户第一次单击该对象的位置 (false) 默认false
-
bounds
annie.Rectangle相对于显圣对象父级的坐标的值,用于指定 Sprite 约束矩形
stopDrag
()
public
停止鼠标或者触摸拖动
update
-
isDrawUpdate
Parameters:
-
isDrawUpdate
Object不是因为渲染目的而调用的更新,比如有些时候的强制刷新 默认为true
Properties
_MECO
Unknown
private
全局的鼠标事件的监听数对象表
_texture
Any
protected
缓存起来的纹理对象。最后真正送到渲染器去渲染的对象
Default: null
height
Unknown
public
获取或者设置显示对象在父级里的y方向的高,不到必要不要用此属性获取高 如果你要同时获取款高,建议使用getWH()方法获取宽和高
instanceId
Unknown
public
每一个annie引擎对象都会有一个唯一的id码。
Example:
//获取 annie引擎类对象唯一码
trace(this.instanceId);
instanceType
Unknown
public
每一个annie类都有一个实例类型字符串,通过这个字符串,你能知道这个实例是从哪个类实例而来
name
String
public
每一个显示对象都可以给他启一个名字,这样我们在查找子级的时候就可以直接用this.getChildrndByName("name")获取到这个对象的引用
Default: ""
stage
Stage
public
此显示对象所在的舞台对象,如果此对象没有被添加到显示对象列表中,此对象为空。
Default: null;
width
Unknown
public
获取或者设置显示对象在父级里的x方向的宽,不到必要不要用此属性获取高 如果你要同时获取款高,建议使用getWH()方法获取宽和高