Skip to content

Commit

Permalink
Merge pull request #2 from vicker/develop
Browse files Browse the repository at this point in the history
Prototype updated (dated 2006 Feb 16)
  • Loading branch information
vicker committed Feb 23, 2014
2 parents 7f8f331 + 104da51 commit af42d4f
Show file tree
Hide file tree
Showing 23 changed files with 1,569 additions and 328 deletions.
15 changes: 7 additions & 8 deletions src/NavigationMenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</text_format>
</config>
<data>
<NavigationItemMC>
<NavigationItemMC style="global">
<x>20</x>
<y>20</y>
<text>Home</text>
<type>0</type>
<url>index.xml</url>
</NavigationItemMC>
<NavigationItemMC>
<NavigationItemMC style="global">
<x>130</x>
<y>20</y>
<text>About Me</text>
</NavigationItemMC>
<NavigationItemMC>
<x>240</x>
<y>20</y>
<text>Testing Item</text>
<text>Technologies</text>
<type>0</type>
<url>page2.xml</url>
</NavigationItemMC>
</data>
</NavigationMenu>
119 changes: 119 additions & 0 deletions src/as/global/Broadcaster.as
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;
}
}
102 changes: 102 additions & 0 deletions src/as/global/EditPanelMC.as
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 ();
}
}
}
38 changes: 38 additions & 0 deletions src/as/global/MCFilters.as
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;
}
}
8 changes: 8 additions & 0 deletions src/as/global/Observer.as
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;
}
12 changes: 11 additions & 1 deletion src/as/global/StatusMessageMC.as
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// StatusMessageMC class
// *********************
// StatusMessageMC class
// *********************
class as.global.StatusMessageMC extends MovieClip
{
// MC variables
Expand Down Expand Up @@ -64,6 +66,12 @@ class as.global.StatusMessageMC extends MovieClip
{
clearInterval (temp_interval);
}

// hide the mini mc text when transparent reach a certain amount
if (mc_ref._alpha < 40 && n < 0)
{
mc_ref.mini_mc.content_field._visible = false;
}
}

// *************
Expand All @@ -77,6 +85,7 @@ class as.global.StatusMessageMC extends MovieClip
mc_ref.mini_mc.onRollOver = function ()
{
this.class_ref._alpha = 100;
this.class_ref.mini_mc.content_field._visible = true;
clearInterval (this.class_ref.temp_interval);
}

Expand Down Expand Up @@ -126,6 +135,7 @@ class as.global.StatusMessageMC extends MovieClip
{
// make the mc appear first
mc_ref._alpha = 100;
mc_ref.mini_mc.content_field._visible = true;
clearInterval (temp_interval);
temp_interval = setInterval (this, "set_transparent", 5000);

Expand Down
Loading

0 comments on commit af42d4f

Please sign in to comment.