Hi you all,
new to OOP as to AS so be gentle.
Here's my code from a site: the goal would be to have 2 buttons which shows in another tab 2 documents and two other buttons that let the
user to download the files.
I pasted and modified the code, from a sample found on wab, to fit my needs but it won't work.
import flash.display.*;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.FileReference;
import flash.text.TextField;
bloccodoc.docswf_guarda.addEventListener(MouseEvent.CLICK, loadPageswf);
function loadPageswf(event:MouseEvent):void {
聽聽聽 var myURLswf:URLRequest=new URLRequest(''./docs/Technocracy_ITA_Brochure_web_full.swf'');
聽聽聽 navigateToURL(myURLswf,''_blank'');
}
bloccodoc.docpdf_guarda.addEventListener(MouseEvent.CLICK, loadPagepdf);
function loadPagepdf(event:MouseEvent):void {
聽聽聽 var myURLpdf:URLRequest=new URLRequest(''./docs/Technocracy_ITA_Brochure_web_full.pdf'');
聽聽聽 navigateToURL(myURLpdf,''_blank'');
}
bloccodoc.docpdf_dwnl.addEventListener(MouseEvent.CLICK, downLoadButton);
class DownLoadIt extends MovieClip {
聽聽聽 var fileName:String=''Technocracy_ITA_Brochure_web_full_swf.zip'';
聽聽聽 var path:URLRequest=new URLRequest(''./docs/''+fileName);
聽聽聽 var file:FileReference=new FileReference();
聽聽聽 var downLoadButton:MovieClip=new MovieClip();
聽聽聽 var alertIt:TextField=new TextField();
聽聽聽
聽聽聽 function DownLoadIt():void {
聽聽聽聽聽聽聽 downLoadButton.addEventListener(MouseEvent.CLICK, dwnIt);
聽聽聽聽聽聽聽 addChild(alertIt);
聽聽聽聽聽聽聽 alertIt.x=200;
聽聽聽聽聽聽聽 alertIt.y=200;
聽聽聽 }
聽聽聽 function dwnIt(e:MouseEvent) {
聽聽聽聽聽聽聽 file.download(path, fileName);
聽聽聽聽聽聽聽 file.addEventListener(Event.COMPLETE, finishIt);
聽聽聽 }
聽聽聽 /*聽 function drawButton(obj:MovieClip)
聽聽聽 {
聽聽聽 with(obj.graphics)
聽聽聽 {
聽聽聽 beginFill(0xFF0000, 1);
聽聽聽 drawRect(0,0,100,30);
聽聽聽 endFill();
聽聽聽 }
聽聽聽 addChild(obj);
聽聽聽 obj.buttonMode=true;
聽聽聽 }
聽聽聽 */
聽聽聽 function finishIt(e:Event) {
聽聽聽聽聽聽聽 alertIt.text=''File Scarricato! '';
聽聽聽 }
}
Any idea??
thanks in advance.
No comments:
Post a Comment