saumya
04-06-2006, 12:43 PM
Hi,
I have the code below, downloade from Adobe labs, but it its not compiling.Can you tell me whats wrong
/*
Macromedia(r) Source Code License Agreement
Copyright(c) 2005 Macromedia, Inc. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Macromedia, Inc. grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Macromedia" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Macromedia from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package {
import flash.display.Sprite;
import flash.events.TimerEventType;
import flash.events.TimerEvent;
import flash.util.Timer;
import flash.util.trace;
public class TimerExample extends Sprite
{
private var ticks:uint;
public function TimerExample()
{
ticks = 0;
var timer:Timer = new Timer( 1000, 10 ); // delay, repeat
timer.addEventListener( TimerEventType.TIMER, onTick );
timer.start(); // returns immediately
trace("START ---");
}
private function onTick( event:TimerEvent )
{
ticks++;
trace( "Tick " + ticks + "!" );
if( ticks == 10 )
trace("END ---");
}
}
}
I have the code below, downloade from Adobe labs, but it its not compiling.Can you tell me whats wrong
/*
Macromedia(r) Source Code License Agreement
Copyright(c) 2005 Macromedia, Inc. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Macromedia, Inc. grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Macromedia" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Macromedia from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package {
import flash.display.Sprite;
import flash.events.TimerEventType;
import flash.events.TimerEvent;
import flash.util.Timer;
import flash.util.trace;
public class TimerExample extends Sprite
{
private var ticks:uint;
public function TimerExample()
{
ticks = 0;
var timer:Timer = new Timer( 1000, 10 ); // delay, repeat
timer.addEventListener( TimerEventType.TIMER, onTick );
timer.start(); // returns immediately
trace("START ---");
}
private function onTick( event:TimerEvent )
{
ticks++;
trace( "Tick " + ticks + "!" );
if( ticks == 10 )
trace("END ---");
}
}
}