mardi 14 mars 2017

ActionScript 3.0 .fla file working, .swf file exported not working

I have another problem with an acrionscript swf file. I'm reading some text from a CSV file. I create the fla file and when I test it in the animate editor it works and I can see all the text inside the CSV file into a TextField. If I export the .swf and run it with Adobe Flash Player 11.4 r402 I can't see the text that there is in the CSV File. I created this fla file made up of one photogram in which I wrote this code:

import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.filesystem.*;
import flash.text.TextField;

var pathToFile:String = File.applicationDirectory.resolvePath('ex.csv').nativePath;

var requestedFile:URLRequest = new URLRequest(pathToFile);

var myTextField:TextField = new TextField();

myTextField.autoSize = TextFieldAutoSize.LEFT;

var documentLoader = new URLLoader();

documentLoader.addEventListener(Event.COMPLETE, onload);

documentLoader.load(requestedFile);

function onload(evt:Event):void
{
  myTextField.text = evt.target.data;
  addChild(myTextField);
}

How can I make the .swf file working? There is a way to read data from a CSV file into a .swf file? Thank you to everybody!

Aucun commentaire:

Enregistrer un commentaire