Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to make external file linking in as3

Explorer ,
Jun 30, 2013 Jun 30, 2013

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

TOPICS
ActionScript
5.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 03, 2013 Jul 03, 2013

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

Translate
Community Expert ,
Jun 30, 2013 Jun 30, 2013
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 30, 2013 Jun 30, 2013

Is there other why to link the external file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2013 Jun 30, 2013

the mp4 should work.

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 01, 2013 Jul 01, 2013

Boss my target is not only for video. i want to open all formats. (swf, flash.exe, video, sound, PowerPoint, world, PDF etc.. files) Like a URL.

Now I try this code but this is going in the browser. want to open directly. For example If video file then should be open in directly in some video player. if pdf file, should be open directly in pdf reader. if powerpoint file, should be open directly in powerpoint software etc…. Is there any way to do like this?

package  {

          import flash.net.navigateToURL;

          import flash.net.URLRequest;

          import flash.display.SimpleButton;

          import flash.events.MouseEvent;

          public class externallink extends SimpleButton {

                    public function externallink() {

                              this.addEventListener(MouseEvent.CLICK, clickF);

                    }

                    private function clickF(e:MouseEvent):void{

                              var url:String = "Klacid.exe";

                              var request:URLRequest = new URLRequest(url);

                              navigateToURL(request);

                    }

          }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2013 Jul 01, 2013

are you making an air app?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 01, 2013 Jul 01, 2013

no boss, i need this for PC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2013 Jul 01, 2013

are you publishing a swf? 

if yes, will it be embedded in an html file that you'll upload to a server and will be displayed in a browser?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 01, 2013 Jul 01, 2013

Boss, I make one flash file. Inside that I have different button

World template (button)

PowerPoint template (button)

Video template (button)

PDF template (button)

Etc….

I want to link these buttons to different file format on cline event

(I didn’t embed anything, when I click, its open directly in the browser, which I don’t need. I need to open directly in same plate form, world software, powerpint software, PDF reader etc).

Mean to say If I press world template button, file should be open in world software. If I press powerpint template button, file should be open in powerpoint software…..etc)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2013 Jul 01, 2013

when you finish your project will you upload it to a server?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 01, 2013 Jul 01, 2013

You can check my project on this link

http://www.delta-adv.com/nav/Files_Linking.zip

When I click on the button, file is going in the browser that I don’t need (only HTML file button is ok). Need to open all files directly in his software’s (world file should be open in world software. PowerPoint file should be open in PowerPoint software. Video file should be open in any video player…..etc.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2013 Jul 02, 2013

i understand your problem.  you don't need to keep explaining about what's inside your fla.

i'm trying to determine how your published app will be used.  if you're publish an air app or projector app, you can do what you want though you may not realize the problem that will occur if your app is used by someone that does not have powerpoint installed, for example.

attach a screenshot of your publish settings panel (file>publish settings).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 03, 2013 Jul 03, 2013

Need only SWF and EXE files

3.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2013 Jul 03, 2013
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines