I need to retrieve data from Yahoo finance, then display it on a webpage - from the following url:
http://finance.yahoo.com/d/quotes.csv?s=SNA.V&f=l1sd1
I'm able to format and display the text within my swf, however once its uploaded to the internet - the text either won't show up, or the flash player shows a security error "flash player is trying to communicate with finance.yahoo.com"
I've tried to feed the data through to my own domain, but I'm not sure how to program for it. I've found php examples online, but I'm not sure how to implement them either. I need the stock quote price to display and update either once a day, or only when the swf loads. Currently I'm using the following code to retrieve the data (within flash):
fl_TextLoader:URLLoader = new URLLoader();
var fl_TextURLRequest:URLRequest = new URLRequest("http://finance.yahoo.com/d/quotes.csv?s=SNA.V&f=l1sd1");
fl_TextLoader.addEventListener(Event.COMPLETE, fl_CompleteHandler);
function fl_CompleteHandler(event:Event):void
{
var fl_TF:TextField;
var fl_TextToDisplay:String = new String(fl_TextLoader.data);
var textData:String = new String(fl_TextLoader.data);
var myTextFormat:TextFormat = new TextFormat();
trace(textData);
fl_TF = new TextField();
fl_TF.autoSize = TextFieldAutoSize.LEFT;
fl_TF.background = false;
fl_TF.textColor = 333333;
fl_TF.border = false;
fl_TF.scaleZ = 200;
fl_TF.maxChars = 22;
fl_TF.x = 665;
fl_TF.y = 579;
fl_TF.text = fl_TextToDisplay;
myTextFormat.font = "Calibri";
myTextFormat.size = 18;
addChild(fl_TF);
}
fl_TextLoader.load(fl_TextURLRequest);
Hi
You can find a complete tutorial here for using Yahoo Finance in Flash.
Source and example also available.
Although it looks like a Phone App it can be used anywhere.
Hope it helps.
North America
Europe, Middle East and Africa
Asia Pacific