actionscript 3 - Adding a child to the stage from a class AS3 -
actionscript 3 - Adding a child to the stage from a class AS3 -
i'm trying basic, add together film clip library stage. created class called link extends movieclip. have 2 film clips in library, first 1 loaded contains buttons should remove first film clip , load second. however, unable load sec using addchild(). i'm hoping there obvious i'm missing. i'm new as3. here code link class:
package classes.gen1p0 { import flash.display.simplebutton; import flash.display.*; import flash.events.*; import fl.controls.*; import fl.transitions.easing.*; import fl.transitions.tweenevent; public class link extends movieclip { public var links:vector.<simplebutton > = new vector.<simplebutton >; public var sourcemap:redmc = new redmc ; public var sourcemap2:bluemc = new bluemc ; public var panzoommap:panzoommap = new panzoommap(sourcemap,704,556.3); public var diagram:panzoommap = new panzoommap(sourcemap2,704.45,556.3); public var zoomcontrols:zoomcontrols = new zoomcontrols(panzoommap); public var zoomcontrols2:zoomcontrols = new zoomcontrols(diagram); public var navwindow:navigatorwindow = new navigatorwindow(panzoommap); public var navwindow2:navigatorwindow = new navigatorwindow(diagram); public function link() { } ///////////////////////////// //vector links ///////////////////////////// public function linkvector():void { (var m:int = 0; m < 2; m++) { var linknumb:simplebutton = runwise_gen_1p0_electrical_schematic.sourcemap.panner.schematic.link_movies.getchildat(m); if ((linknumb simplebutton)) { links.push(linknumb); var linkname:string = links[m].name; } } (var n:int = 0; n<links.length; n++) { links[n].addeventlistener(mouseevent.click, linkto); } function linkto(e:event):void { addchild(diagram); diagram.x = 291.35; diagram.y = 22.15; runwise_gen_1p0_electrical_schematic.panzoommap.parent.removechild(runwise_gen_1p0_electrical_schematic.panzoommap); switch (e.target.name) { case "ppos": trace ("ppos"); break; case "pykpos": trace ("pykpos"); break; } } } //end code here }
}
should simple
var _link:link = new link(); addchild(_link);
note: typically when create class in as3 utilize uppercase first letter of class name
public class link extends movieclip
actionscript-3 flash
Comments
Post a Comment