/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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); }