Code error
Using Animate CC, I have developed hundreds of Flash animations to help teachers instruct full classes of music students.
With the decline of Flash Player, I am moving to an AIR application that can load/unload swfs with a button click.
With this code, I get the following errors (Line 14 is the “removeChild” line.):
Scene 1, Layer 'Action', Frame 1, Line 14, Column 13 1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'Action', Frame 1, Line 15, Column 2 1084: Syntax error: expecting identifier before var.
Scene 1, Layer 'Action', Frame 1, Line 15, Column 19 1084: Syntax error: expecting rightbrace before colon.
- StageScaleMode.EXACT_FIT
- import flash.display.Loader;
- import flash.net.URLRequest;
- var Xpos:Number = 0
- var Ypos:Number = 40
- var swf:MovieClip;
- var loader:Loader = new Loader();
- //Btns universal function
- function btnClick(event:MouseEvent);void{
- removeChild(loader);
- var newSWFRequest:URLRequest = new URLRequest("RhythmBee/" + event.target.name + ".swf");
- loader.load(newSWFRequest);
- loader.x = Xpos;
- loader.y = Ypos;
- addChild(loader);
- }
- /// btn listeners
- Unit1.addEventListener(MouseEvent.Click.btnClick);
Any help will be appreciated.
