Return to Snippet

Revision: 13732
at May 4, 2009 11:10 by pfeisinger


Initial Code
package ch.pfeisinger.snipplr.view.events {
	import flash.events.Event;	
	
	/**
	 * @author Pfeisinger Markus
	 */

	public class SoundstatusEvent extends Event
	{
		public static const SOUNDCHANGED:String = "soundChanged";
		public var soundOn:Boolean;
		
		public function SoundstatusEvent(soundIsOn:Boolean)
		{
			super(SOUNDCHANGED);
			soundOn = soundIsOn;
		}
	}
}


USAGE for PureMVC:

Component(MovieClip) dispatches Event:
--------------------------------------
dispatchEvent(new SoundstatusEvent(false));

Mediator listens for event:
--------------------------
component.addEventListener(SoundstatusEvent.SOUNDCHANGED, onSoundbuttonClicked);

private function onSoundbuttonClicked(event:SoundstatusEvent):void
{
     trace("Mediator:: onSoundbuttonClicked() "+event.soundOn);
     sendNotification(ApplicationFacade.SOUNDSTATUS_CHANGED, event.soundOn as Boolean);
}

Initial URL

                                

Initial Description

                                

Initial Title
Custom Event With Parameter

Initial Tags
event

Initial Language
ActionScript 3