~mahara-contributors/mahara-adminlang/adminlang-master

« back to all changes in this revision

Viewing changes to htdocs/lib/flowplayer/lib/goasp/src_go/org/goasap/utils/Sequence.as

  • Committer: Ruslan Kabalin
  • Date: 2011-08-03 14:54:09 UTC
  • Revision ID: git-v1:a3409b53a971ec3bad8b5d1329298046d9596381
Revert back to master brach.

The adminlang-master was mistakingly based on the mahara 1.3_STABLE. This is
required for easy merge with the master.

Command used:
for i in `git rev-list
f731cf9b2cf72b61ed6a317acab23a30b9046c8a..afb5850ba246f41b624c162e8d8e6e72c534f239`;
do git revert -n $i; done

Change-Id: I9db8553a66facfaca81492cd978f974c6e7b8892

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Copyright (c) 2007 Moses Gunesch
 
3
 * 
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 
5
 * of this software and associated documentation files (the "Software"), to deal
 
6
 * in the Software without restriction, including without limitation the rights
 
7
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
8
 * copies of the Software, and to permit persons to whom the Software is
 
9
 * furnished to do so, subject to the following conditions:
 
10
 * 
 
11
 * The above copyright notice and this permission notice shall be included in
 
12
 * all copies or substantial portions of the Software.
 
13
 * 
 
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
17
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
18
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
19
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
20
 * THE SOFTWARE.
 
21
 */
 
22
package org.goasap.utils {
 
23
        import org.goasap.interfaces.IPlayable; 
 
24
 
 
25
        /**
 
26
         * Simple playable sequence, composed of groups of playable items.
 
27
         * 
 
28
         * <p>A sequence can be built by passing any item that implements IPlayable
 
29
         * and uses the standard set of PlayableBase play-state constants.
 
30
         * Sequences are composed of SequenceStep instances, which can contain any 
 
31
         * number of child items such as LinearGo or PlayableGroup instances.
 
32
         * Sequences dispatch SequenceEvent.ADVANCE each time a step completes and
 
33
         * the play index advances to the next one, then GoEvent.COMPLETE when done.</p>
 
34
         * 
 
35
         * <p>Other events dispatched include the GoEvent types START, STOP, PAUSE, RESUME,
 
36
         * and CYCLE if the repeater.cycles property is set to a value other than one.</p>
 
37
         * 
 
38
         * <p>All items in each step must dispatch COMPLETE or STOP before a Sequence
 
39
         * will advance. This simple behavior can be limiting, especially with steps that
 
40
         * are composed of groups of items. The Go utility package includes another 
 
41
         * sequencer called SequenceCA, which allows you to define different ways a sequence 
 
42
         * can advance: after a particular item in a step, a particular duration, after 
 
43
         * an event fires, etc.</p>
 
44
         * 
 
45
         * @see SequenceBase
 
46
         * @see SequenceCA
 
47
         * @author Moses Gunesch
 
48
         */
 
49
        public class Sequence extends SequenceBase {
 
50
 
 
51
                // -== Public Properties ==-
 
52
                
 
53
                // Also in super:
 
54
                // length : uint   [Read-only.]
 
55
                // playIndex : int [Read-only.]
 
56
                // steps : Array
 
57
                // start() : Boolean
 
58
                // stop() : Boolean
 
59
                // pause() : Boolean
 
60
                // resume() : Boolean
 
61
                // skipTo(index:Number) : Boolean
 
62
                
 
63
                /**
 
64
                 * Returns the currently-playing SequenceStep.
 
65
                 * @return The currently-playing SequenceStep.
 
66
                 * @see #getStepAt()
 
67
                 * @see #getStepByID()
 
68
                 * @see #steps
 
69
                 * @see #lastStep
 
70
                 */
 
71
                public function get currentStep() : SequenceStep {
 
72
                        return (super._getCurrentStep());
 
73
                }
 
74
                
 
75
                /**
 
76
                 * Returns the final SequenceStep in the current sequence.
 
77
                 * @return The final SequenceStep in the current sequence.
 
78
                 * @see #getStepAt()
 
79
                 * @see #getStepByID()
 
80
                 * @see #steps
 
81
                 * @see #currentStep
 
82
                 */
 
83
                public function get lastStep() : SequenceStep {
 
84
                        return (super._getLastStep());
 
85
                }
 
86
                
 
87
                // -== Public Methods ==-
 
88
                
 
89
                /**
 
90
                 * Constructor.
 
91
                 * 
 
92
                 * @param items         Any number of IPlayable instances (e.g. LinearGo, PlayableGroup,
 
93
                 *                                      SequenceStep) as separate arguments, or a single array of them.
 
94
                 */
 
95
                public function Sequence(...items) {
 
96
                        super((items[ 0 ] is Array) ? items[ 0 ] : items);
 
97
                }
 
98
                
 
99
                /**
 
100
                 * Retrieves any SequenceStep from the steps array.
 
101
                 * @param index         An array index starting at 0.
 
102
                 * @return                      The SequenceStep instance at this index.
 
103
                 * @see #getStepByID()
 
104
                 * @see #currentStep
 
105
                 * @see #lastStep
 
106
                 */
 
107
                public function getStepAt(index:int) : SequenceStep {
 
108
                        return (super._getStepAt(index) as SequenceStep);
 
109
                }
 
110
                
 
111
                /**
 
112
                 * Locates a step with the specified playableID. To search within a step for a
 
113
                 * child by playableID, use the step instance's <code>getChildByID</code> method.
 
114
                 *  
 
115
                 * @param playableID    The step instance's playableID to search for.
 
116
                 * @return                              The SequenceStep with the matching playableID.
 
117
                 * @see #getStepAt()
 
118
                 */
 
119
                public function getStepByID(playableID:*) : SequenceStep {
 
120
                        return (super._getStepByID(playableID) as SequenceStep);
 
121
                }
 
122
                
 
123
                /**
 
124
                 * Adds a single IPlayable instance (e.g. LinearGo, PlayableGroup, SequenceStep) 
 
125
                 * to the end of the steps array, or optionally adds the instance into the last 
 
126
                 * SequenceStep instead of adding it as a new step.
 
127
                 * 
 
128
                 * <p>To remove a step use the <code>removeStepAt</code> method.</p>
 
129
                 * 
 
130
                 * @param item                  The playable item to add to the sequence. Note
 
131
                 *                                              that when new steps are added, any IPlayable
 
132
                 *                                              instance of a type other than SequenceStep is 
 
133
                 *                                              automatically wrapped in a new SequenceStep.
 
134
                 *                                              
 
135
                 * @param addToLastStep If true is passed the item is added to the last
 
136
                 *                                              existing SequenceStep in the steps array. This
 
137
                 *                                              option should be used with individual items that
 
138
                 *                                              you want added as children to the SequenceStep.
 
139
                 *                                              If there are no steps yet this option ignored and
 
140
                 *                                              a new step is created.
 
141
                 *                                              
 
142
                 * @return New length of the steps array.
 
143
                 */
 
144
                public function addStep(item:IPlayable, addToLastStep:Boolean=false): int {
 
145
                        return (super._addStep(item, addToLastStep, SequenceStep));
 
146
                }
 
147
                
 
148
                /**
 
149
                 * Adds a single IPlayable instance (e.g. LinearGo, PlayableGroup, 
 
150
                 * SequenceStep) at a specific index in the steps array. Calling this method 
 
151
                 * stops any sequence play currently in progress.
 
152
                 * 
 
153
                 * @param item          The playable item to splice into the sequence.
 
154
                 * 
 
155
                 * @param index         Position in the array starting at 0, or a negative 
 
156
                 *                                      index like Array.splice.
 
157
                 *                                      
 
158
                 * @return                      New length of the steps array.
 
159
                 */
 
160
                public function addStepAt(item:IPlayable, index:int): int {
 
161
                        return (super._addStepAt(index, item, SequenceStep));
 
162
                }
 
163
 
 
164
                /**
 
165
                 * Removes and returns the SequenceStep at a specific index from the steps 
 
166
                 * array. Calling this method stops any sequence play currently in progress.
 
167
                 * 
 
168
                 * @param index         Position in the array starting at 0, or a negative 
 
169
                 *                                      index like Array.splice.
 
170
                 *                                      
 
171
                 * @return                      The SequenceStep instance removed from the steps array.
 
172
                 */
 
173
                public function removeStepAt(index:int): SequenceStep {
 
174
                        return (super._removeStepAt(index) as SequenceStep);
 
175
                }
 
176
                
 
177
                // Also in super:
 
178
                // length : uint   [Read-only.]
 
179
                // playIndex : int [Read-only.]
 
180
                // steps : Array
 
181
                // start() : Boolean
 
182
                // stop() : Boolean
 
183
                // pause() : Boolean
 
184
                // resume() : Boolean
 
185
                // skipTo(index:Number) : Boolean
 
186
        }
 
187
}
 
 
b'\\ No newline at end of file'