Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-ming.all / easysound.as
blob3c80613c88fa490b2620dae83776e9ed125dacad
1 /***********************************************************************
3 * Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ***********************************************************************
22 * Simple sound test. Can load (streaming or not) and start/stop.
24 * Initial author: Sandro Santilli <strk@keybit.net>
26 ***********************************************************************/
28 #include "widgets.as"
30 if ( !hasOwnProperty('url') )
32 trace("No 'url' passed in querystring, using 'easysound.mp3'");
33 url='easysound.mp3';
36 mySound = new Sound();
38 mySound.onSoundComplete = function()
40 var s = 'onSoundComplete(';
41 for (var i=0; i<arguments.length; ++i) {
42 if ( i ) s += ', ';
43 s += arguments[i];
45 s += ')';
46 trace(s);
49 mySound.onLoad = function(success)
51 var s = "onLoad(";
52 for (var i=0; i<arguments.length; ++i) {
53 if ( i ) s += ', ';
54 s += arguments[i];
56 s += ')';
57 trace(s);
60 s_load = function()
62 trace("Loading sound "+urlin.getText()+". Streaming ? "+streamingcb.checked());
63 mySound.loadSound(urlin.getText(), streamingcb.checked());
66 s_start = function()
68 var off = offIn.getText();
69 var loops = loopsIn.getText();
70 trace("Starting sound at seconds offset "+off+" with loop count "+loops);
71 mySound.start(off, loops); // <startSecs>, <nLoops>
74 s_stop = function()
76 trace("Stopping sound.");
77 mySound.stop();
80 s_getposition = function() {
81 //trace("s_getposition called, position is "+mySound.position);
82 return mySound.position+"/"+mySound.duration;
85 s_pause = function()
87 trace("Pausing sound (basically recording current position in offset and stopping.");
88 offIn.setText( mySound.position );
89 mySound.stop();
92 streamingcb = new Checkbox(_root, "Streaming");
93 urlin = new Input(_root, "URL");
94 urlin.moveTo(100, 0);
95 if ( typeof(url) == 'undefined' ) url = 'easysound.mp3';
96 urlin.setText(url);
98 offIn = new Input(_root, "Offsets seconds");
99 offIn.moveTo(0, 30);
100 offIn.setText(0);
102 loopsIn = new Input(_root, "Loops");
103 loopsIn.setText(0);
104 loopsIn.moveTo(300, 30);
106 loadbtn = new Button(_root, "Load", s_load);
107 loadbtn.moveTo(0, 60);
109 startbtn = new Button(_root, "Start", s_start);
110 startbtn.moveTo(50, 60);
113 pausbtn = new Button(_root, "Pause", s_pause);
114 pausbtn.moveTo(100, 60);
117 stopbtn = new Button(_root, "Stop", s_stop);
118 stopbtn.moveTo(100, 60);
120 infoPosition = new InfoLine(_root, "position", s_getposition);
121 infoPosition.moveTo(0, 120);