-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from vicker/develop
Prototype updated (dated 2006 Feb 16)
- Loading branch information
Showing
23 changed files
with
1,569 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// ***************** | ||
// broadcaster class | ||
// ***************** | ||
class as.global.Broadcaster | ||
{ | ||
private var changed_flag:Boolean; // state that if the value is changed | ||
private var observers_array:Array; // an array of all the observers | ||
|
||
private var broadcaster_type:Number; // the type of broadcaster | ||
|
||
// *********** | ||
// constructor | ||
// *********** | ||
public function Broadcaster (t:Number) | ||
{ | ||
changed_flag = false; | ||
observers_array = new Array (); | ||
broadcaster_type = t; | ||
} | ||
|
||
// ************ | ||
// add observer | ||
// ************ | ||
public function add_observer (o:as.global.Observer):Boolean | ||
{ | ||
// preventing null observer | ||
if (o == null) | ||
{ | ||
return false; | ||
} | ||
|
||
// preventing already registered observer | ||
for (var i in observers_array) | ||
{ | ||
if (observers_array [i] == o) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
// putting observer into the array | ||
observers_array.push (o); | ||
return true; | ||
} | ||
|
||
// *************** | ||
// remove observer | ||
// *************** | ||
public function remove_observer (o:as.global.Observer):Boolean | ||
{ | ||
for (var i in observers_array) | ||
{ | ||
if (observers_array [i] == o) | ||
{ | ||
observers_array.splice (i, 1); | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
// ********* | ||
// broadcast | ||
// ********* | ||
public function broadcast (o:Object):Void | ||
{ | ||
// if nothing... make it null | ||
if (o == undefined) | ||
{ | ||
o = null; | ||
} | ||
|
||
// if not changed, skip it | ||
if (!changed_flag) | ||
{ | ||
return; | ||
} | ||
|
||
// invoke the changer | ||
for (var i in observers_array) | ||
{ | ||
switch (broadcaster_type) | ||
{ | ||
case 1: | ||
{ | ||
// edit mode broadcaster | ||
observers_array [i].broadcaster_event (o); | ||
break; | ||
} | ||
case 2: | ||
{ | ||
// exporter broadcaster | ||
observers_array [i].export_xml (); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
// flag down | ||
changed_flag = false; | ||
} | ||
|
||
// *************** | ||
// clear observers | ||
// *************** | ||
public function clear_observers ():Void | ||
{ | ||
observers_array = new Array (); | ||
} | ||
|
||
// **************** | ||
// set changed flag | ||
// **************** | ||
public function set_changed_flag ():Void | ||
{ | ||
changed_flag = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// ***************** | ||
// EditPanelMC class | ||
// ***************** | ||
class as.global.EditPanelMC extends MovieClip | ||
{ | ||
// private variables | ||
private var mc_ref:MovieClip; // interface for the edit panel mc | ||
private var target_ref:MovieClip; // reference to the controlling mc | ||
|
||
private var interval_id:Number; // temp store for interval id | ||
|
||
// *********** | ||
// constructor | ||
// *********** | ||
public function EditPanelMC () | ||
{ | ||
mc_ref = this; | ||
|
||
setup_move_button (); | ||
} | ||
|
||
// ************** | ||
// set target ref | ||
// ************** | ||
public function set_target_ref (m:MovieClip):Void | ||
{ | ||
target_ref = m; | ||
} | ||
|
||
// ************ | ||
// set position | ||
// ************ | ||
public function set_position (x:Number, y:Number):Void | ||
{ | ||
var temp_obj:Object; | ||
var temp_width:Number; | ||
var temp_height:Number; | ||
|
||
temp_obj = _root.sys_func.get_movie_size (); | ||
temp_width = temp_obj.width; | ||
temp_height = temp_obj.height; | ||
|
||
// fix position if out bound | ||
if (x < 0) { x = 0; } | ||
if (y < 0) { y = 0; } | ||
if (x + mc_ref._width > temp_width) { x = temp_width - mc_ref._width; } | ||
if (y + mc_ref._height > temp_height) { y = temp_height - mc_ref._height; } | ||
|
||
x = x + 5; | ||
y = y - 5; | ||
|
||
mc_ref._x = x; | ||
mc_ref._y = y; | ||
|
||
// show the edit panel | ||
mc_ref._visible = true; | ||
mc_ref.enabled = false; | ||
} | ||
|
||
// ********** | ||
// throw away | ||
// ********** | ||
public function throw_away ():Void | ||
{ | ||
mc_ref._x = 0; | ||
mc_ref._y = -100; | ||
|
||
mc_ref._visible = false; | ||
mc_ref.enabled = false; | ||
} | ||
|
||
// ***************** | ||
// setup move button | ||
// ***************** | ||
public function setup_move_button ():Void | ||
{ | ||
mc_ref.move_button ["class_ref"] = mc_ref; | ||
|
||
// onpress override | ||
mc_ref.move_button.onPress = function () | ||
{ | ||
this.class_ref.target_ref.startDrag (); | ||
|
||
this.class_ref.interval_id = setInterval (this.class_ref.target_ref, "pull_edit_panel", 75); | ||
} | ||
|
||
// onrelease override | ||
mc_ref.move_button.onRelease = function () | ||
{ | ||
this.class_ref.stopDrag (); | ||
this.class_ref.target_ref.stopDrag (); | ||
|
||
clearInterval (this.class_ref.interval_id); | ||
} | ||
|
||
// onreleaseoutside override | ||
mc_ref.move_button.onReleaseOutside = function () | ||
{ | ||
this.onRelease (); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// *************** | ||
// MCFilters Class | ||
// *************** | ||
class as.global.MCFilters extends MovieClip | ||
{ | ||
// *********** | ||
// constructor | ||
// *********** | ||
public function MCFilters () | ||
{ | ||
// actually nothing is necessary for MCFilters | ||
} | ||
|
||
// ********************* | ||
// set brightness filter | ||
// ********************* | ||
public function set_brightness_filter (m:MovieClip):Void | ||
{ | ||
var matrix_array:Array; | ||
var matrix_filter:flash.filters.ColorMatrixFilter; | ||
|
||
matrix_array = [1, 0, 0, 0, 100, | ||
0, 1, 0, 0, 100, | ||
0, 0, 1, 0, 100, | ||
0, 0, 0, 1, 0]; | ||
|
||
matrix_filter = new flash.filters.ColorMatrixFilter (matrix_array); | ||
m.filters = [matrix_filter]; | ||
} | ||
|
||
// ************* | ||
// remove filter | ||
// ************* | ||
public function remove_filter (m:MovieClip):Void | ||
{ | ||
m.filters = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// ****************** | ||
// Observer interface | ||
// ****************** | ||
interface as.global.Observer | ||
{ | ||
// change mode function | ||
public function broadcaster_event (o:Object):Void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.