Skip to main content
Inspiring
June 30, 2013
Answered

How to make external file linking in as3

  • June 30, 2013
  • 1 reply
  • 5539 views

I want to open different format external files(*.wmv, *.mp4, *.pdf, *.ppt, *.doc etc) on click event, I try this for *.wmv but got some error.

--------------------------------------------------------------------------------

package  {

          import flash.display.SimpleButton;

          import flash.events.MouseEvent;

          import flash.net.navigateToURL;

          import flash.net.URLRequest;

 

          public class clickbutton extends SimpleButton {

 

                    public function clickbutton() {

                              this.addEventListener(MouseEvent.CLICK, clickF);

                    }

 

                    private function clickF(e:MouseEvent):void{

                              var nc:NetConnection = new NetConnection();

                              nc.connect(null);

                              var ns:NetStream = new NetStream(nc);

                              videoPlayer.attachNetStream(ns);

                              var listener:Object = new Object();

                              listener.onMetaData = function(evt:Object):void {};

                              ns.client = listener;

                              ns.play("video_test.wmv");

                    }

          }

}

--------------------------------------------------------------------------------

Please tell me correct code

This topic has been closed for replies.
Correct answer kglad

Need only SWF and EXE files


you don't need the swf.

you're creating a projector (.exe) file.

if you know users will have the programs and default settings to open those file types, you can use fscommand to open them (as long as they files are in an fscommand subdirectory).

you'll need to use an executable helper file, too:  http://www.northcode.com/blog.php/2007/08/07/Conquering-FSCommand-EXEC-Part-1-Proxy

1 reply

kglad
Community Expert
Community Expert
June 30, 2013
71081Author
Inspiring
June 30, 2013

Is there other why to link the external file?

kglad
Community Expert
Community Expert
June 30, 2013

the mp4 should work.

some of the rest might work in an air or projector app.