-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCrate.as
More file actions
45 lines (40 loc) · 1.29 KB
/
Crate.as
File metadata and controls
45 lines (40 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package {
import flash.display.MovieClip;
import flash.events.*;
public class Crate extends MovieClip{
private var _root:*;
private var dy:int;
private var dx:int;
public var xRef:int;
public var yRef:int;
public var isMove:Boolean;
private var popUp;
public function Crate() {
/*addEventListener(Event.ADDED,beginClass);
addEventListener(Event.ENTER_FRAME, eFrame);
addEventListener(Event.REMOVED_FROM_STAGE, destroyThis);*/
addEventListener(Event.ADDED,beginClass);
addEventListener(Event.ENTER_FRAME, eFrame);
//this.clickBox.addEventListener(MouseEvent.MOUSE_UP, whenClicked);
addEventListener(MouseEvent.MOUSE_UP, theClick);
addEventListener(Event.REMOVED_FROM_STAGE, destroyThis);
}
private function beginClass(e:Event):void {
_root = MovieClip(root);//setting the root
//_root.MenuHolder.addChild(this.clickBox);
}
private function eFrame(e:Event):void{
}
public function theClick(Event:MouseEvent):void{
popUp = new dropDown();
popUp.x = this.x + 25;
popUp.y = this.y + 55;
if (this.y >= 500)
popUp.y -= 60;
_root.ObjectHolder.addChild(popUp);
}
private function destroyThis(event:Event = null):void{
this.removeEventListener(Event.ENTER_FRAME, eFrame);
}
}
}