actionscript 3 - Send data from Flash to Starling class -
i want send data mainclass (flash class) starling class. here code of 2 classes. need pass data between them.
package { import flash.display.sprite; import flash.events.event; public class mainclass extends sprite { private var mystarling:starling; public function mainclass () { super(); stage.addeventlistener(event.resize,onresize); } private function shangedor(e:stageorientationevent):void { // code } private function onresize(e:event):void { mystarling = new starling(main,stage); mystarling.start(); } } }
main.as class of starling :
package { import starling.core.starling; import starling.display.sprite; public class main extends starling.display.sprite { private var theme:aeondesktoptheme; public function main() { super(); this.addeventlistener(starling.events.event.added_to_stage,addtostage); } private function addtostage(e:starling.events.event):void { this.theme = new aeondesktoptheme( this.stage ); drawcomponent(); } private function drawcomponent():void { //code } } }
is there way pass data between flash , starling? created event class listen flash, dispatch starling class data need flash class didn't work.
fast solution , useful in cases: make static
function in mainclass
, call when main
instance ready (in addtostage
example)
Comments
Post a Comment