Permalink
Browse files

serious bug fixed, about multiple avatar for one master! see below:

  we can't save avatar in master, since there could be multiple
  avatars connect to one master. so we add a on_avatar_init for
  other callback needs
  • Loading branch information...
1 parent b42d913 commit 132477550a314810d89bc0332bb28de8d4b60b20 @godfat committed Jul 6, 2009
Showing with 4 additions and 9 deletions.
  1. +1 −2 Photo.as
  2. BIN example.swf
  3. +2 −3 org/godfat/avatarblock/Avatar.as
  4. +1 −4 org/godfat/avatarblock/Master.as
View
@@ -16,12 +16,11 @@ class Photo extends Master{
return attr('img_attr')['src'];
}
- public override function set avatar(a: Avatar){
+ public override function on_avatar_init(a: Avatar){
if(a){
a.body.useHandCursor = true;
a.body.buttonMode = true;
}
- super.avatar = a;
}
public override function on_click(event: MouseEvent){
View
Binary file not shown.
@@ -24,14 +24,13 @@ public class Avatar{
// init click event
body_.addEventListener(MouseEvent.CLICK, owner_.on_click);
- // init master controll
- owner_.avatar = this;
+ // init callback
+ owner_.on_avatar_init(this);
move(x, y);
}
public function cleanup(){
- owner_.avatar = null;
img_.cleanup();
img_ = null;
parent_.removeChild(body_);
@@ -21,13 +21,10 @@ public class Master{
public function attr(name: String){ return data_[name]; }
public function get avatar_uri(): String{ return ""; }
public function on_click(event: MouseEvent){}
-
- public function get avatar(): Avatar{ return avatar_; }
- public function set avatar(a: Avatar){ avatar_ = a; }
+ public function on_avatar_init(avatar: Avatar){}
private var source_: XMLNode;
private var data_: Dictionary;
- private var avatar_: Avatar;
}
}

0 comments on commit 1324775

Please sign in to comment.