コード例 #1
0
        private void StartHandler(Event e)
        {
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("StartHandler " + _component.Width + ", " + _component.Height);
            }
#endif
            if (null != _maskGraphics)
                return; // already masking this component

            _parent = _component.Parent ?? (_component is Stage ? _component : null);

            if (null == _parent)
                return; // we are not on the display list, so we have nothing to mask indeed

            _maskGraphics = new LoadingMaskAnimator {
                IncludeInLayout = false, 
                X = _component.X, 
                Y = _component.Y, 
                Width = _component.Width, 
                Height = _component.Height,
                //Bounds = (Rectangle) _component.Bounds.Clone() // BEWARE! This was the reference bug (without Clone())!!!!!!!!!
            };

            _parent.AddChild(_maskGraphics);

            LoadingEvent le = e as LoadingEvent;
            if (null != le)
                _maskGraphics.Message = le.Message;

            // critical!
            //_maskGraphics.Transform.Apply();
            _maskGraphics.InvalidateTransform();

            // subscribe to MOVE and RESIZE events of the component
            // we shall be levitating just over the component
            _component.AddEventListener(MoveEvent.MOVE, MoveHandler, EventPhase.Target);
            _component.AddEventListener(ResizeEvent.RESIZE, ResizeHandler, EventPhase.Target);

            _maskGraphics.Play();
        }
コード例 #2
0
        private void Cleanup()
        {
            _maskGraphics.Stop();
            
            _component.RemoveEventListener(MoveEvent.MOVE, MoveHandler, EventPhase.Target);
            _component.RemoveEventListener(ResizeEvent.RESIZE, ResizeHandler, EventPhase.Target);

            if (null != _parent)
                _parent.RemoveChild(_maskGraphics);
            
            _maskGraphics = null;
        }