Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _class:Class = getDefinitionByName("com.site.Class") as Class;
- _class(parent.parent).function();
- trace(Class);
- var class:Class = new Class(this);
- public function Class(objectRef:Object) {
- _parentRef = objectRef;
- }
- import com.site.Class;
- com.site.Class.method();
- //Child.as
- package
- {
- import flash.events.EventDispatcher;
- import flash.events.Event;
- public class Child extends EventDispatcher
- {
- public function doSomething():void
- {
- var e:Event = new Event(Event.COMPLETE);
- dispatchEvent(e);
- }
- public function foo():void
- {
- trace("foo");
- }
- }
- }
- //Parent.as
- package
- {
- import flash.display.Sprite;
- import flash.events.Event;
- public class Parent extends Sprite
- {
- private var child:Child;
- public function Parent():void
- {
- c = new Child();
- c.addEventListener(Event.COMPLETE, onComplete);
- c.foo();//traces foo
- c.doSomething()
- }
- public function onComplete(e:Event):void
- {
- trace("Child broadcast Event.COMPLETE");
- }
- }
- }
- private static const class:Class;
- public static function setClass(_class:Class){
- class = _class;
- }
- public static function getClass(void):Class{
- return class;
- }
- ParentClass(parent).parentFunction();
- ParentClass(stage.getChildAt(0)).parentFunction();
Add Comment
Please, Sign In to add comment