Hi all,
I am writing here because I am trying to show an animation with the help of the Animation Watchface example when an activity is started or recorded and make it disappear when finished, similar to the native apps of the watch. So far, I am able to show the animation, but I am having issues trying to stop it and set visibility to false.
class AnimationDelegate extends WatchUi.AnimationDelegate {
private var _view;
//! Constructor
//! @param view The watch face view
public function initialize(view) {
_view = view;
WatchUi.AnimationDelegate.initialize();
}
//! Handle an animation event
//! @param event The animation event
//! @param options A dictionary of animation options
public function onAnimationEvent(event as AnimationEvent, options as Dictionary) as Void {
System.println("I am on function onAnimationEvent");
if (event == WatchUi.ANIMATION_EVENT_COMPLETE) {
_view.stop(); -> This is my problematic line
_view.setVisible(false);
} else if (event == WatchUi.ANIMATION_EVENT_CANCELED) {
_view.stop();
} else {
System.println("on unknown event");
}
}
}
class Marcador_tenis_padel_activityView extends WatchUi.View {
//Declaration of variables
function initialize() {
View.initialize();
_foregroundAnimationLayer = new WatchUi.AnimationLayer(animResource, null);
}
// Load your resources here
function onLayout(dc as Dc) as Void {
setLayout(Rez.Layouts.MainLayout(dc));
System.println("Setting layout as I am on function onLayout!");
addLayer(_foregroundAnimationLayer);
}
//! Play the animation
public function play() as Void {
_foregroundAnimationLayer.setVisible(true);
var animationRez = _foregroundAnimationLayer.getResource();
var x = 0;
var y = 0;
// reset the x and z (layer) to the new coordinates
_foregroundAnimationLayer.setLocation(x, y);
// start the playback
_foregroundAnimationLayer.play({:delegate=>new $.AnimationDelegate(self)});
}
}
function onHide() as Void {
if($.showingMainMenu == false)
{
if(_foregroundAnimationLayer != null)
{
play();
}
}
}
My problem comes with the line which says _view.stop(), as the app crashes saying "\nError: Symbol Not Found Error\nDetails: Could not find symbol 'stop'\nStack: \n - onAnimationEvent()...". Any idea of the cause of error?
Thanks,
Javier