Commit 06ded96a authored by Adrian Hungate's avatar Adrian Hungate

Migration to gitlab

parents
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.xtext.ui.shared.xtextBuilder"/>
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tlspucomponents</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.xtext.ui.shared.xtextBuilder (1).launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.axdt.as3.imp.nature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<project name="tlspucomponents" default="all" basedir=".">
<description>
Build TLSPU Flash Components
</description>
<property environment="env"/>
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
<property name="SRC_DIR" location="src" />
<property name="OUT_DIR" location="bin" />
<property name="TLSPUCOMPONENTS.SWC" location="${OUT_DIR}/tlspucomponents.swc" />
<property name="TLSPUCOMPONENTSTEST.SWF" location="${OUT_DIR}/tlspucomponentstest.swf" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
<target name="all" depends="tlspucomponents" />
<target name="clean">
<delete>
<fileset dir="${OUT_DIR}" includes="*" />
</delete>
</target>
<macrodef name="swc">
<attribute name="classes" />
<attribute name="sourcepath" />
<attribute name="target" />
<sequential>
<mkdir dir="${OUT_DIR}" />
<compc output="@{target}"
include-classes="@{classes}">
<source-path path-element="@{sourcepath}"/>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
</compc>
</sequential>
</macrodef>
<macrodef name="swf">
<attribute name="source" />
<attribute name="target" />
<sequential>
<mkdir dir="${OUT_DIR}" />
<mxmlc
output="@{target}"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
static-link-runtime-shared-libraries="true"
incremental="false"
optimize="false"
target-player="10.2.0"
file="@{source}"
>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="${OUT_DIR}" />
</compiler.library-path>
</mxmlc>
</sequential>
</macrodef>
<target name="tlspucomponents">
<swc sourcepath="${SRC_DIR}" classes="com.tlspu.components.Components" target="${TLSPUCOMPONENTS.SWC}" />
<swf source="${SRC_DIR}/tlspucomponentstest.as" target="${TLSPUCOMPONENTSTEST.SWF}" />
</target>
</project>
\ No newline at end of file
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package com.tlspu.components {
import com.tlspu.components.animations.WaitAnimation;
import com.tlspu.components.sliders.ScrollBar;
import com.tlspu.components.sliders.Slider;
import com.tlspu.components.sliders.SliderEvent;
import com.tlspu.components.logging.Console;
import com.tlspu.components.text.MessageBox;
public class Components {
private function dummy():void {
new WaitAnimation(50, 20, "Buffering");
new ScrollBar();
new Slider();
new SliderEvent("");
new MessageBox(100, 200);
Console.write("");
}
}
}
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package com.tlspu.components.animations {
import com.tlspu.components.logging.Console;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flash.utils.setInterval;
public class WaitAnimation extends Sprite {
/** The text message (In front of the dots) **/
private var _message:TextField;
/** The spinning dots **/
private var _dots:Vector.<Sprite>;
/** Interval for checking primary buffer. **/
private var _interval:Number;
/** difference in values from one dot to the next **/
private var _delta:Number;
public function WaitAnimation(radius:Number, numberOfDots:Number, text:String):void {
var tf:TextFormat = new TextFormat();
tf.font = "Helvetica";
tf.size = radius * 0.8;
_message = new TextField();
_message.alpha = 1.0;
_message.textColor = 0xFFFFFF;
_message.background = false;
_message.autoSize = TextFieldAutoSize.LEFT;
_message.type = TextFieldType.DYNAMIC;
_message.selectable = false;
_message.text = text;
_message.setTextFormat(tf);
_message.x = - _message.width / 2;
_message.y = - _message.height / 2;
_delta = 1.0 / numberOfDots;
_dots = new Vector.<Sprite>(numberOfDots, true);
for (var i:Number=0; i<numberOfDots; i++) {
var dx:Number = Math.cos((i / numberOfDots) * 2 * Math.PI) * radius;
var dy:Number = Math.sin((i / numberOfDots) * 2 * Math.PI) * radius;
_dots[i] = addDot(dx, dy);
setDot(i, i * _delta);
}
addChild(_message);
_interval = setInterval(spinDots, 2000 / numberOfDots);
}
private function spinDots():void {
var value:Number;
for (var dot:Number = 0; dot < _dots.length; dot++) {
value = getDot(dot) - _delta;
if (value < 0) {
value += 1;
}
setDot(dot, value);
}
}
private function getDot(dot:Number):Number {
return _dots[dot].alpha;
}
private function setDot(dot:Number, value:Number):void {
_dots[dot].alpha = value;
_dots[dot].scaleX = value;
_dots[dot].scaleY = value;
}
private function addDot(x:Number, y:Number):Sprite {
var dot:Sprite = new Sprite();
dot.x = x;
dot.y = y;
dot.alpha = 1.0
dot.graphics.lineStyle(3, 0x404040, 0.8);
dot.graphics.beginFill(0xFFFFFF, 0.8);
dot.graphics.drawCircle(0, 0, 5);
addChild(dot);
return dot;
}
}
}
\ No newline at end of file
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package com.tlspu.components.logging {
import flash.external.ExternalInterface;
/** Class that sends log messages to browser console. **/
public class Console {
public static var LOGGING:Boolean = true;
/** Log a message to the console. **/
public static function write(message:*):void {
if(LOGGING && ExternalInterface.available) {
try { // ExternalInterface is not available in all flash hosts (Projectors for example)
ExternalInterface.call('console.log',String(message));
} catch (e:Error) {}
}
}
}
}
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package com.tlspu.components.sliders {
import flash.events.MouseEvent;
public class ScrollBar extends Slider {
public function ScrollBar(min:Number=0, max:Number=100, length:Number=100, horizontal:Boolean=true, inverted:Boolean=false):void {
super(min, max, length, horizontal, inverted);
if (_horizontal) {
draw(length, 15);
} else {
draw(15, length);
}
_thumb.x = _thumb_width / 2;
_thumb.y = _thumb_height / 2;
}
protected override function drawThumb():void {
_thumb.graphics.clear();
if (_horizontal) {
_thumb_width = _height;
_thumb_height = _height;
_min_slide_x = _thumb_width / 2;
_max_slide_x = _width - _thumb_width / 2;
_min_slide_y = _thumb_height / 2;
_max_slide_y = _thumb_height / 2;
} else {
_thumb_width = _width;
_thumb_height = _width;
_min_slide_x = _thumb_width / 2;
_max_slide_x = _thumb_width / 2;
_min_slide_y = _thumb_height / 2;
_max_slide_y = _height - _thumb_height / 2;
}
_thumb.graphics.lineStyle(0, 0xC0C0C0, 1.0);
_thumb.graphics.beginFill(0xE0E0E0, 1.0);
_thumb.graphics.drawRect(-_thumb_width / 2, -_thumb_height / 2, _thumb_width, _thumb_height);
}
/** Callback when the mouse enters **/
protected override function mouseOver(event:MouseEvent):void {
}
/** Callback when the mouse exits **/
protected override function mouseOut(event:MouseEvent):void {
}
}
}
This diff is collapsed.
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package com.tlspu.components.sliders {
import flash.events.Event;
public class SliderEvent extends Event {
public static const SLIDING:String = "tlspuSliderSliding";
public static const CHANGED:String = "tlspuSliderChanged";
public static const DISPLAYPOSITION:String = "tlspuSliderDisplayPosition";
private var _value:Number;
private var _displayValue:String;
public function SliderEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, value:Number=0) {
super(type, bubbles, cancelable);
_value = value;
_displayValue = int(value).toString();
}
public function getValue():Number {
return _value;
}
public function setDisplayValue(displayValue:String):void {
_displayValue = displayValue;
}
public function getDisplayValue():String {
return _displayValue;
}
}
}
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package com.tlspu.components.text {
import com.tlspu.components.logging.Console;
import com.tlspu.components.sliders.ScrollBar;
import com.tlspu.components.sliders.SliderEvents;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.TouchEvent;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFieldAutoSize;
public class ListBox extends Sprite {
private var _vScrollBar:ScrollBar;
private var _hScrollBar:ScrollBar;
private var _textArray:Array;
private var _textBoxes:Array;
private var _selected:Number = -1;
private var _width:Number;
private var _height:Number;
private var _x:Number;
private var _y:Number;
public function ListBox(width:Number, height:Number, x:Number=0, y:Number=0) {
_width = width;
_height = height;
_x = x;
_y = y;
_vScrollBar = new ScrollBar(0, 0);
_hScrollBar = new ScrollBar(0, 0);
}
private function draw():void {
}
public function addItem(text:String):Number {
}
public function removeItem(item:Number):void {
}
public function getItems():Array {
}
public function selectItem(item:Number):void {
}
public function getSelectedItem():Number {
}
}
}
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package com.tlspu.components.text {
import com.tlspu.components.logging.Console;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.text.TextFormatAlign;
import flash.text.TextFormat;
import flash.utils.clearTimeout;
import flash.utils.setTimeout;
public class MessageBox extends Sprite {
/** The text message (In front of the dots) **/
private var _message:TextField;
/** Width and Height of the MessageBox **/
private var _width:Number;
private var _height:Number;
/** Stage location of the MessageBox **/
/** Close timer **/
private var _timer:Number;
public function MessageBox(width:Number, height:Number):void {
_width = width;
_height = height;
visible = false;
graphics.clear();
graphics.lineStyle(0, 0x606060, 1.0);
graphics.beginFill(0x808080, 0.7);
graphics.drawRoundRect(-_width/2, -_height/2, _width, _height, 10, 10);
_message = new TextField();
_message.alpha = 1.0;
_message.textColor = 0xFFFFFF;
_message.background = false;
_message.autoSize = TextFieldAutoSize.CENTER;
_message.type = TextFieldType.DYNAMIC;
_message.selectable = false;
_message.wordWrap = true;
_message.text = "";
_message.width = _width * 0.8;
_message.x = -_message.textWidth / 2;
_message.y = -_message.textHeight / 2;
addChild(_message);
}
public function Show(duration:Number, message:String):void {
var tf:TextFormat = new TextFormat();
tf.align = TextFormatAlign.CENTER;
tf.font = "Helvetica";
tf.size = 18;
Console.write(message);
_message.text = message;
_message.setTextFormat(tf);
_message.x = -_message.width / 2;
_message.y = -_message.height / 2;
visible = true;
_timer = setTimeout(close, duration * 1000);
}
public function close():void {
if (_timer) {
clearTimeout(_timer);
}
visible = false;
}
}
}
\ No newline at end of file
/**
* TLSPU Flash Components
* Copyright (c) 2012 Adrian Hungate
*
* @author Adrian Hungate
*/
package {
import com.tlspu.components.animations.WaitAnimation;
import com.tlspu.components.logging.Console;
import com.tlspu.components.sliders.ScrollBar;
import com.tlspu.components.sliders.Slider;
import com.tlspu.components.sliders.SliderEvent;
import flash.display.Sprite;
import flash.display.LineScaleMode;
import flash.display.CapsStyle;
import flash.display.JointStyle;
[SWF(width="640", height="360", frameRate="30", backgroundColor="#000000")]
public class tlspucomponentstest extends Sprite {
private var hslider:Slider;
private var vslider:Slider;
private var hscroll:ScrollBar;
private var vscroll:ScrollBar;
private var wait1:WaitAnimation;
private var wait2:WaitAnimation;
private var wait3:WaitAnimation;
public function tlspucomponentstest() {
Console.write("Drawing test application");
hslider = new Slider(1800, 7200, 600, true);
hslider.x = 20;
hslider.y = 340;
addChild(hslider);
hslider.addEventListener(SliderEvent.CHANGED, hChangeHandler);
hslider.addEventListener(SliderEvent.DISPLAYPOSITION, hSliderDisplayPosition);
//hslider.addEventListener(SliderEvent.SLIDING, hChangeHandler);
hslider.setPosition(3000);
vslider = new Slider(0, 100, 100, false, true);
vslider.x = 600;
vslider.y = 20;
addChild(vslider);
//vslider.addEventListener(SliderEvent.CHANGED, vChangeHandler);
vslider.addEventListener(SliderEvent.DISPLAYPOSITION, vSliderDisplayPosition);
vslider.addEventListener(SliderEvent.SLIDING, vChangeHandler);
vslider.setPosition(0);
hslider.setFill(vslider.getPosition());
hscroll = new ScrollBar(0, 100, 600, true);
hscroll.x = 20;
hscroll.y = 280;
addChild(hscroll);
vscroll = new ScrollBar(0, 100, 100, false);
vscroll.x = 550;
vscroll.y = 20;
addChild(vscroll);
wait1 = new WaitAnimation(20, 8, "This");
wait1.x = 100;
wait1.y = 100;
addChild(wait1);
wait2 = new WaitAnimation(30, 16, "Is A");
wait2.x = 200;
wait2.y = 100;
addChild(wait2);
wait3 = new WaitAnimation(40, 18, "Test");
wait3.x = 350;
wait3.y = 100;
addChild(wait3);
Console.write("Test application drawn");
}
private function pad(value:Number):String {
var str:String = "";
if (value < 10) {
str = str + "0";
}
str = str + value.toString();
return str;
}
private function hSliderDisplayPosition(event:SliderEvent):void {
var pos:Number = int(event.getValue());
var h:Number = 0;
var m:Number = 0;
var s:Number = 0;
var str:String = "";
h = int(pos / 3600);
pos = pos - (h * 3600);
m = int(pos/60);
s = pos - (m * 60);
str = str + pad(h) + ":" + pad(m) + ":" + pad(s);
event.setDisplayValue(str);
}
private function hChangeHandler(event:SliderEvent):void {
Console.write("H-Change: " + event.getValue())
}
private function vSliderDisplayPosition(event:SliderEvent):void {
event.setDisplayValue(event.getValue().toFixed(1) + "%");
}
private function vChangeHandler(event:SliderEvent):void {
//Console.write("V-Change: " + event.getValue());
hslider.setFill(event.getValue());
vslider.setFill(event.getValue());
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment