Example #1
0
	public void SetHandlers(ButtonEventHandlers handler)
	{
		if (m_handler == null)
			m_handler = new ButtonEventHandlers();
		else
			m_handler.Clear();
		m_handler.Add(handler);
	}
Example #2
0
        public Button(LWF lwf, Movie parent, int objId, int instId)
            : base(lwf, parent, Format.Object.Type.BUTTON, objId, instId)
        {
            m_invert = new Matrix();
            m_hitX = Int32.MinValue;
            m_hitY = Int32.MinValue;

            if (objId >= 0) {
            m_data = lwf.data.buttons[objId];
            m_dataMatrixId = m_data.matrixId;
            }

            m_handler = lwf.GetButtonEventHandlers(this);
            if (m_handler != null && m_handler.load != null)
            m_handler.load(this);
        }
Example #3
0
        public Button(LWF lwf, Movie parent, int objId, int instId,
			int matrixId = -1, int colorTransformId = -1)
            : base(lwf, parent, Format.Object.Type.BUTTON, objId, instId)
        {
            m_matrixId = matrixId;
            m_colorTransformId = colorTransformId;

            m_invert = new Matrix();
            m_hitX = Int32.MinValue;
            m_hitY = Int32.MinValue;

            if (objId >= 0) {
            m_data = lwf.data.buttons[objId];
            m_dataMatrixId = m_data.matrixId;
            }

            m_handler = lwf.GetButtonEventHandlers(this);
            if (m_handler != null)
            m_handler.Call(EventType.LOAD, this);
        }
Example #4
0
 public void SetHandlers(ButtonEventHandlers handler)
 {
     m_handler = handler;
 }
Example #5
0
        public void SetButtonEventHandler(int instId,
		ButtonEventHandler press = null, ButtonEventHandler release = null,
		ButtonEventHandler rollOver = null, ButtonEventHandler rollOut = null,
		ButtonKeyPressHandler keyPress = null, ButtonEventHandler load = null,
		ButtonEventHandler unload = null, ButtonEventHandler enterFrame = null,
		ButtonEventHandler update = null, ButtonEventHandler render = null)
        {
            if (instId < 0 || instId >= m_instances.Length)
            return;

            ButtonEventHandlers handlers;
            if (load != null || unload != null || enterFrame != null ||
                update != null || render != null || rollOver != null ||
                rollOut != null || press != null || release != null ||
                keyPress != null) {
            handlers = new ButtonEventHandlers(load, unload, enterFrame, update,
                render, rollOver, rollOut, press, release, keyPress);
            } else {
            handlers = null;
            }
            m_buttonEventHandlers[instId] = handlers;
        }
Example #6
0
        public void SetButtonEventHandler(string instanceName,
		ButtonEventHandler press = null, ButtonEventHandler release = null,
		ButtonEventHandler rollOver = null, ButtonEventHandler rollOut = null,
		ButtonKeyPressHandler keyPress = null, ButtonEventHandler load = null,
		ButtonEventHandler unload = null, ButtonEventHandler enterFrame = null,
		ButtonEventHandler update = null, ButtonEventHandler render = null)
        {
            int instId = SearchInstanceId(GetStringId(instanceName));
            if (instId >= 0) {
            SetButtonEventHandler(instId, press, release, rollOver, rollOut,
                keyPress, load, unload, enterFrame, update, render);
            return;
            }

            if (!instanceName.Contains("."))
            return;

            if (m_buttonEventHandlersByFullName == null)
            m_buttonEventHandlersByFullName =
                new ButtonEventHandlersDictionary();

            if (load != null ||
                unload != null || enterFrame != null || update != null ||
                render != null || rollOver != null || rollOut != null ||
                press != null || release != null || keyPress != null) {
            m_buttonEventHandlersByFullName[instanceName] =
                new ButtonEventHandlers(load, unload, enterFrame, update,
                    render, rollOver, rollOut, press, release, keyPress);
            } else {
            m_buttonEventHandlersByFullName.Remove(instanceName);
            }
        }
Example #7
0
	public void ClearButtonEventHandler(
		int instId, ButtonEventHandlers.Type type)
	{
		if (instId < 0 || instId >= m_instances.Length)
			return;

		ButtonEventHandlers handlers = m_buttonEventHandlers[instId];
		if (handlers == null)
			return;

		handlers.Clear(type);

		Button button = SearchButtonInstanceByInstanceId(instId);
		if (button != null)
			button.SetHandlers(handlers);
	}
Example #8
0
	public void ClearButtonEventHandler(
		string instanceName, ButtonEventHandlers.Type type)
	{
		int instId = SearchInstanceId(GetStringId(instanceName));
		if (instId >= 0) {
			ClearButtonEventHandler(instId, type);
			return;
		}

		if (m_buttonEventHandlersByFullName == null)
			return;

		ButtonEventHandlers handlers;
		if (!m_buttonEventHandlersByFullName.TryGetValue(
				instanceName, out handlers))
			return;

		handlers.Clear(type);

		Button button = SearchButtonInstance(instanceName);
		if (button != null)
			button.SetHandlers(handlers);
	}
Example #9
0
	public void Add(ButtonEventHandlers handlers)
	{
		if (handlers == null)
			return;

		foreach (var h in handlers.load)
			load.Add(h.Key, h.Value);
		foreach (var h in handlers.unload)
			unload.Add(h.Key, h.Value);
		foreach (var h in handlers.enterFrame)
			enterFrame.Add(h.Key, h.Value);
		foreach (var h in handlers.update)
			update.Add(h.Key, h.Value);
		foreach (var h in handlers.render)
			render.Add(h.Key, h.Value);
		foreach (var h in handlers.press)
			press.Add(h.Key, h.Value);
		foreach (var h in handlers.release)
			release.Add(h.Key, h.Value);
		foreach (var h in handlers.rollOver)
			rollOver.Add(h.Key, h.Value);
		foreach (var h in handlers.rollOut)
			rollOut.Add(h.Key, h.Value);
		foreach (var h in handlers.keyPress)
			keyPress.Add(h.Key, h.Value);
	}
Example #10
0
	public int AddButtonEventHandler(string instanceName,
		ButtonEventHandler load = null, ButtonEventHandler unload = null,
		ButtonEventHandler enterFrame = null, ButtonEventHandler update = null,
		ButtonEventHandler render = null, ButtonEventHandler press = null,
		ButtonEventHandler release = null, ButtonEventHandler rollOver = null,
		ButtonEventHandler rollOut = null,
		ButtonKeyPressHandler keyPress = null)
	{
		interactive = true;

		int instId = SearchInstanceId(GetStringId(instanceName));
		if (instId >= 0) {
			return AddButtonEventHandler(instId,
				load, unload, enterFrame, update, render,
				press, release, rollOver, rollOut, keyPress);
		}

		if (!instanceName.Contains("."))
			return -1;

		if (m_buttonEventHandlersByFullName == null)
			m_buttonEventHandlersByFullName =
				new ButtonEventHandlersDictionary();

		ButtonEventHandlers handlers;
		if (!m_buttonEventHandlersByFullName.TryGetValue(
				instanceName, out handlers)) {
			handlers = new ButtonEventHandlers();
			m_buttonEventHandlersByFullName[instanceName] = handlers;
		}

		int id = GetEventOffset();
		handlers.Add(id, load, unload, enterFrame, update, render,
			press, release, rollOver, rollOut, keyPress);

		Button button = SearchButtonInstance(instanceName);
		if (button != null)
			button.SetHandlers(handlers);
		return id;
	}
Example #11
0
        public void ClearButtonEventHandler(
		int instId, ButtonEventHandlers.Type type)
        {
            if (instId < 0 || instId >= m_instances.Length)
            return;

            ButtonEventHandlers handlers = m_buttonEventHandlers[instId];
            if (handlers == null)
            return;

            handlers.Clear(type);
        }
Example #12
0
        public void ClearButtonEventHandler(
		string instanceName, ButtonEventHandlers.Type type)
        {
            int instId = SearchInstanceId(GetStringId(instanceName));
            if (instId >= 0) {
            ClearButtonEventHandler(instId, type);
            return;
            }

            if (m_buttonEventHandlersByFullName == null)
            return;

            ButtonEventHandlers handlers =
            m_buttonEventHandlersByFullName[instanceName];
            if (handlers == null)
            return;

            handlers.Clear(type);
        }
Example #13
0
        public void AddButtonEventHandler(string instanceName,
		ButtonEventHandler load = null, ButtonEventHandler unload = null,
		ButtonEventHandler enterFrame = null, ButtonEventHandler update = null,
		ButtonEventHandler render = null, ButtonEventHandler press = null,
		ButtonEventHandler release = null, ButtonEventHandler rollOver = null,
		ButtonEventHandler rollOut = null,
		ButtonKeyPressHandler keyPress = null)
        {
            int instId = SearchInstanceId(GetStringId(instanceName));
            if (instId >= 0) {
            AddButtonEventHandler(instId,
                load, unload, enterFrame, update, render,
                press, release, rollOver, rollOut, keyPress);
            return;
            }

            if (!instanceName.Contains("."))
            return;

            if (m_buttonEventHandlersByFullName == null)
            m_buttonEventHandlersByFullName =
                new ButtonEventHandlersDictionary();

            ButtonEventHandlers handlers =
            m_buttonEventHandlersByFullName[instanceName];
            if (handlers == null) {
            handlers = new ButtonEventHandlers();
            m_buttonEventHandlersByFullName[instanceName] = handlers;
            }

            Button button = SearchButtonInstance(instId);
            if (button != null)
            button.SetHandlers(handlers);

            handlers.Add(load, unload, enterFrame, update, render,
            press, release, rollOver, rollOut, keyPress);
        }
Example #14
0
        public void AddButtonEventHandler(int instId,
		ButtonEventHandler load = null, ButtonEventHandler unload = null,
		ButtonEventHandler enterFrame = null, ButtonEventHandler update = null,
		ButtonEventHandler render = null, ButtonEventHandler press = null,
		ButtonEventHandler release = null, ButtonEventHandler rollOver = null,
		ButtonEventHandler rollOut = null,
		ButtonKeyPressHandler keyPress = null)
        {
            if (instId < 0 || instId >= m_instances.Length)
            return;

            ButtonEventHandlers handlers = m_buttonEventHandlers[instId];
            if (handlers == null) {
            handlers = new ButtonEventHandlers();
            m_buttonEventHandlers[instId] = handlers;
            }

            Button button = SearchButtonInstanceByInstanceId(instId);
            if (button != null)
            button.SetHandlers(handlers);

            handlers.Add(load, unload, enterFrame, update, render,
            press, release, rollOver, rollOut, keyPress);
        }
Example #15
0
 public void SetHandlers(ButtonEventHandlers handler)
 {
     if (m_handler != null)
     m_handler.Add(handler);
     else
     m_handler = handler;
 }
	public void Add(ButtonEventHandlers handlers)
	{
		if (handlers == null)
			return;

		handlers.load.ForEach(h => load.Add(h));
		handlers.unload.ForEach(h => unload.Add(h));
		handlers.enterFrame.ForEach(h => enterFrame.Add(h));
		handlers.update.ForEach(h => update.Add(h));
		handlers.render.ForEach(h => render.Add(h));
		handlers.press.ForEach(h => press.Add(h));
		handlers.release.ForEach(h => release.Add(h));
		handlers.rollOver.ForEach(h => rollOver.Add(h));
		handlers.rollOut.ForEach(h => rollOut.Add(h));
		handlers.keyPress.ForEach(h => keyPress.Add(h));
	}
Example #17
0
	public int AddButtonEventHandler(int instId,
		ButtonEventHandler load = null, ButtonEventHandler unload = null,
		ButtonEventHandler enterFrame = null, ButtonEventHandler update = null,
		ButtonEventHandler render = null, ButtonEventHandler press = null,
		ButtonEventHandler release = null, ButtonEventHandler rollOver = null,
		ButtonEventHandler rollOut = null,
		ButtonKeyPressHandler keyPress = null)
	{
		interactive = true;

		if (instId < 0 || instId >= m_instances.Length)
			return -1;

		ButtonEventHandlers handlers = m_buttonEventHandlers[instId];
		if (handlers == null) {
			handlers = new ButtonEventHandlers();
			m_buttonEventHandlers[instId] = handlers;
		}

		int id = GetEventOffset();
		handlers.Add(id, load, unload, enterFrame, update, render,
			press, release, rollOver, rollOut, keyPress);

		Button button = SearchButtonInstanceByInstanceId(instId);
		if (button != null)
			button.SetHandlers(handlers);
		return id;
	}