[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10386: Improve widgets set, add inf
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10386: Improve widgets set, add info line for position update on enter frame. |
Date: |
Wed, 03 Dec 2008 22:42:30 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10386
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-12-03 22:42:30 +0100
message:
Improve widgets set, add info line for position update on enter frame.
modified:
testsuite/misc-ming.all/easysound.as
testsuite/misc-ming.all/widgets.as
=== modified file 'testsuite/misc-ming.all/easysound.as'
--- a/testsuite/misc-ming.all/easysound.as 2008-12-03 21:00:58 +0000
+++ b/testsuite/misc-ming.all/easysound.as 2008-12-03 21:42:30 +0000
@@ -1,3 +1,30 @@
+/***********************************************************************
+ *
+ * Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *
+ ***********************************************************************
+ *
+ * Simple sound test. Can load (streaming or not) and start/stop.
+ *
+ * Initial author: Sandro Santilli <address@hidden>
+ *
+ ***********************************************************************/
+
#include "widgets.as"
if ( typeof(url) == 'undefined' )
@@ -21,8 +48,10 @@
s_start = function()
{
- trace("Starting sound.");
- mySound.start(0, 2); // <startSecs>, <nLoops>
+ var off = offIn.getText();
+ var loops = loopsIn.getText();
+ trace("Starting sound at seconds offset "+off+" with loop count
"+loops);
+ mySound.start(off, loops); // <startSecs>, <nLoops>
};
s_stop = function()
@@ -31,18 +60,46 @@
mySound.stop();
};
+s_getposition = function() {
+ //trace("s_getposition called, position is "+mySound.position);
+ return mySound.position;
+};
+
+s_pause = function()
+{
+ trace("Pausing sound (basically recording current position in offset
and stopping.");
+ offIn.setText( mySound.position );
+ mySound.stop();
+};
+
streamingcb = new Checkbox(_root, "Streaming");
-urlin = new Input(_root, "URL:");
+urlin = new Input(_root, "URL");
urlin.moveTo(100, 0);
if ( typeof(url) == 'undefined' ) url = 'easysound.mp3';
urlin.setText(url);
+offIn = new Input(_root, "Offsets seconds");
+offIn.moveTo(0, 30);
+offIn.setText(0);
+
+loopsIn = new Input(_root, "Loops");
+loopsIn.setText(0);
+loopsIn.moveTo(300, 30);
+
loadbtn = new Button(_root, "Load", s_load);
-loadbtn.moveTo(0, 50);
+loadbtn.moveTo(0, 60);
startbtn = new Button(_root, "Start", s_start);
-startbtn.moveTo(50, 50);
+startbtn.moveTo(50, 60);
+
+/*
+pausbtn = new Button(_root, "Pause", s_pause);
+pausbtn.moveTo(100, 60);
+*/
stopbtn = new Button(_root, "Stop", s_stop);
-stopbtn.moveTo(100, 50);
+stopbtn.moveTo(100, 60);
+
+infoPosition = new InfoLine(_root, "position", s_getposition);
+infoPosition.moveTo(0, 120);
=== modified file 'testsuite/misc-ming.all/widgets.as'
--- a/testsuite/misc-ming.all/widgets.as 2008-12-03 21:00:58 +0000
+++ b/testsuite/misc-ming.all/widgets.as 2008-12-03 21:42:30 +0000
@@ -1,9 +1,49 @@
+/***********************************************************************
+ *
+ * Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *
+ ***********************************************************************
+ *
+ * Set of widget to use in 'makeswf' based quick tests
+ *
+ * Initial author: Sandro Santilli <address@hidden>
+ *
+ ***********************************************************************/
+
+function Widget(where) {
+ //trace("Widget ctor called");
+ if ( ! arguments.length ) return;
+ if ( ! where.hasOwnProperty('nextHighestDepth') )
where.nextHighestDepth=1;
+ var d = where.nextHighestDepth++;
+ var nam = 'clip'+d;
+ this.clip = where.createEmptyMovieClip(nam, d);
+}
+
+Widget.prototype.moveTo = function(x, y)
+{
+ this.clip._x = x;
+ this.clip._y = y;
+};
function Checkbox(where, label) {
- if ( ! where.hasOwnProperty('nextHighestDepth') )
where.nextHighestDepth=1;
- var d = where.nextHighestDepth++;
- var nam = 'cb'+d;
- this.clip = where.createEmptyMovieClip(nam, d);
+
+ super(where);
+
this.size = 10;
this.clip.createEmptyMovieClip('box', 1);
@@ -40,6 +80,8 @@
this.clip.label.text = label;
}
+Checkbox.prototype = new Widget();
+
Checkbox.prototype.check = function()
{
trace("Making check visible");
@@ -58,25 +100,12 @@
return this.clip.check._visible;
};
-Checkbox.prototype.valueOf = function()
-{
- return this.checked();
-};
-
-Checkbox.prototype.moveTo = function(x, y)
-{
- this.clip._x = x;
- this.clip._y = y;
-};
-
// ------------------------------------------------------------------
function Button(where, label, cb)
{
- if ( ! where.hasOwnProperty('nextHighestDepth') )
where.nextHighestDepth=1;
- var d = where.nextHighestDepth++;
- var nam = 'bt'+d;
- this.clip = where.createEmptyMovieClip(nam, d);
+ super(where);
+
this.clip.createEmptyMovieClip('eh', 1); // event handler
this.clip.onRelease = cb;
@@ -99,20 +128,13 @@
}
}
-Button.prototype.moveTo = function(x, y)
-{
- this.clip._x = x;
- this.clip._y = y;
-};
+Button.prototype = new Widget();
//-------------------
function Input(where, label)
{
- if ( ! where.hasOwnProperty('nextHighestDepth') )
where.nextHighestDepth=1;
- var d = where.nextHighestDepth++;
- var nam = 'bt'+d;
- this.clip = where.createEmptyMovieClip(nam, d);
+ super(where);
this.clip.createTextField('label', 3, 0, 0, 0, 0, 0);
this.clip.label.autoSize = true;
@@ -122,15 +144,11 @@
this.clip.inp.autoSize = false;
this.clip.inp.type = 'input';
this.clip.inp.border = true;
- this.clip.inp.text = 'your input here';
- this.clip.inp._x = this.clip.label._x+this.clip.label._width+10;
+ //this.clip.inp.text = 'your input here';
+ this.clip.inp._x = this.clip.label._x+this.clip.label._width+5;
}
-Input.prototype.moveTo = function(x, y)
-{
- this.clip._x = x;
- this.clip._y = y;
-};
+Input.prototype = new Widget();
Input.prototype.setText = function(txt)
{
@@ -142,6 +160,39 @@
return this.clip.inp.text;
};
-Input.prototype.toStrinpg = getInput;
-
-
+Input.prototype.toString = getInput;
+
+
+// -------------------------------------------
+
+function InfoLine(where, label, cb)
+{
+ super(where);
+
+ this.clip.createEmptyMovieClip('eh', 1); // event handler
+
+ this.clip.createTextField('label', 3, this.size+this.size, 0, 0, 0);
+ this.clip.label.autoSize = true;
+ this.clip.label.text = label;
+
+ this.clip.createTextField('inp', 4, 0, 0, 100, 20); // TODO: take as
params
+ this.clip.inp.autoSize = false;
+ this.clip.inp.type = 'dynamic';
+ this.clip.inp.border = true;
+ this.clip.inp.text = 'your input here';
+ this.clip.inp._x = this.clip.label._x+this.clip.label._width+5;
+ trace('this clip inp is: '+this.clip.inp);
+
+ this.clip.onEnterFrame = function() {
+ info = cb();
+ //trace("cb: "+cb()+" inp:"+inp+" clip:"+clip+" this:"+this);
+ this.inp.text = info;
+ };
+}
+
+InfoLine.prototype = new Widget();
+
+InfoLine.prototype.setText = function(txt)
+{
+ this.clip.inp.text = txt;
+};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10386: Improve widgets set, add info line for position update on enter frame.,
Sandro Santilli <=