Are you building this on the timeline?
Or are you doing it in a class file (separate .as file)?

The beauty of ActionScript 3.0 is that its errors are very
descriptive.
""1013: The private attribute may be used only on class property
definitions.""
Means exactly that. You can only use "private function" if you are
writing the code in a separate .as file.
So by that error I assume you writing this on the timeline.

The first BIG error (a simple mistake thought) is that you are not
declaring a "VAR"iable
YOUR CODE:
myTimer = new Timer(1000, 1);
SHOULD BE
var myTimer:Timer = new Timer(1000, 1);


Here are two example scripts to help clear things up.
To call the first one - on your document properties in FlashCS3
Where it says
class[           ]
type in hello.as and hit ctrl+enter
You should see the output "Hello"

//This is a "class" file - it sits outside of the timeline in a
separate file
//hello.as
package {

import flash.display.MovieClip;

  public class GreetingApp extends MovieClip{
     public function GreetingApp () {
           trace("Hello");
     }
  }
}



Same thing here except call "Timer" instead of "hello"
(essentially its the name of the .as file minus the ".as")

//More specific to your issue
//Timer.as
package
{
    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.utils.Timer;

    public class ShortTimer extends Sprite
    {
        public function ShortTimer()
        {
            // creates a new five-second Timer
            var minuteTimer:Timer = new Timer(1000, 5);

            // designates listeners for the interval and completion
events
            minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
            minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
onTimerComplete);

            // starts the timer ticking
            minuteTimer.start();
        }

        public function onTick(event:TimerEvent):void
        {
            // displays the tick count so far
            // The target of this event is the Timer instance itself.
            trace("tick " + event.target.currentCount);
        }

        public function onTimerComplete(event:TimerEvent):void
        {
            trace("Time's Up!");
        }
    }
}






On Apr 13, 3:07 pm, "[email protected]"
<[email protected]> wrote:
> I am having trouble getting the panTo code (http://code.google.com/
> apis/maps/documentation/flash/basics.html) to work correctly in Flash
> CS3.
>
> private function onMapReady(event:MapEvent):void {
>   setCenter(new LatLng(37.4419, -122.1419), 13,
> MapType.NORMAL_MAP_TYPE);
>   myTimer = new Timer(1000, 1);
>   myTimer.addEventListener("timer", timedFunction);
>   myTimer.start();
>
> }
>
> private function timedFunction(eventArgs:TimerEvent):void {
>   panTo(new LatLng(37.4569, -122.1569));
>
> }
>
> I receive the following error when inputting this code into my flash
> document:
> "1013: The private attribute may be used only on class property
> definitions."
>
> I have done a little reading and it appears I need to declare a class
> when using "private". I tried to get rid of "private" to see if this
> would work and only received the following error:
> "1021: Duplicate function definition."
>
> How do I get this code to work correctly in Flash CS3?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to