Skip to main content
Inspiring
August 15, 2013
Frage

Load swf file, AS3 Class (for windows, IOS and android)

  • August 15, 2013
  • 1 Antwort
  • 1228 Ansichten

I try this code

package  {          

    import flash.display.SimpleButton;

    import flash.display.MovieClip;

    import flash.events.MouseEvent;

    import flash.display.Loader;

    import flash.events.Event;

    import flash.system.ApplicationDomain;

    import flash.net.URLRequest;

    import flash.system.LoaderContext

         

          public class load2 extends SimpleButton {

               var loadit:Loader;           

               public function load2() {

                    this.addEventListener(MouseEvent.MOUSE_DOWN, loadfile);

               }

                                               

               private function loadfile(event:MouseEvent):void {

                       trace("you clicked me");

                       loadit = new Loader();

                       this.parent.addChild(loadit);

                       var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

                       loadit.load(new URLRequest("s02.swf"), _lc);

               }

          }

}

but I got compiler error

Dieses Thema wurde für Antworten geschlossen.

1 Antwort

Ned Murphy
Legend
August 15, 2013

I don't see where that error applies to the load2 file but might instead be pointing to another file that calls upon the load2 class, as though it were being instantiated without it being imported.

71081Autor
Inspiring
August 15, 2013

How we can solve this problem?

Ned Murphy
Legend
August 15, 2013

Show the code from any other file involved, maybe the main.fla?