/ Published in: ActionScript 3
Expand |
Embed | Plain Text
package { import flash.display.MovieClip; import flash.events.MouseEvent; import customEvents.CustomDataEvent; public class Component extends MovieClip { // Some simple test data that can be grabbed from flex. public var myTestData:String = "THIS DATA CAME FROM THE SWF!"; public function Component() { // Create event listeners. btn_push.addEventListener(MouseEvent.CLICK, onMouseClick); } private function onMouseClick(e:MouseEvent):void { // Create an anonymous object and store a bit of data in it. var myObj = new Object(); myObj.testString = "This is data coming from my data object!"; // Dispatch a CustomDataEvent. The Object that is passed is stored inside // of the event and can be accessed by anything that catches the data. dispatchEvent(new CustomDataEvent(CustomDataEvent.SAVE_DATA, myObj, true)); } // This function is to be called from the Flex project to show you can // call public functions in a SWF. public function testFunction():void { btn_push.visible = false; } } }
You need to login to post a comment.
