samedi 24 septembre 2016

actionscript 3 two class two stage one movieclip

I have 1 classA in stage1 and 1 classB in stage2. On stage1 there is a movieclip instance name MC. On stage2 there is a movieclip instance name MC (same instance name as stage1).

classA:

package {

    public class classA extends MovieClip {

    public function classA(): void {

        }
        public function prenditutti(obj: MovieClip): void{
            //mc is movieclip in stage1 and work correctly
            MC.addChild(obj);
       }
    }
}

classB: (I use it in stage2 and there is a movieclip instance, like in stage1, named mc)

package {

    import livingroom;

    public class classB extends MovieClip {
        //calamita_inventario is a movieclip linkage in library
        public var calamita_inv_cost: calamita_inventario = new calamita_inventario(); 

        public var LR: classA = new classA();

        public function classB() {
            // constructor code
        }

        public function prendicalamita(e: MouseEvent) {
            LR.prenditutti(calamita_inv_cost);
            //I should see in stage2 inside a MC my movieclip calamita_inv_cost, but doesn't work.
        }
    }
}

But in stage2 i can't see addChild. need help

Aucun commentaire:

Enregistrer un commentaire