Hi guys:
Can we have a tutorial on Lightstreamer with Flex2? I can not open those .fla files that come with the download. Could you please post the source code here? Thanks a bunch.;)
Printable View
Hi guys:
Can we have a tutorial on Lightstreamer with Flex2? I can not open those .fla files that come with the download. Could you please post the source code here? Thanks a bunch.;)
Hi,
I guess you are referring to the Flash/Flex integration through the JavaScript Bridge (a new integration SDK will be released soon based on a native ActionScript client library).
You can find the integration bridges (JS and AS) in the Lightstreamer distribution under "Lightstreamer\DOCS-SDKs\sdk_client_flash_flex(js_bridge)\lib".
The full API docs are under "\Lightstreamer\DOCS-SDKs\sdk_client_flash_flex(js_bridge)\jsdoc".
Two examples, with full source code, are under "\Lightstreamer\DOCS-SDKs\sdk_client_flash_flex(js_bridge)\examples".
Hope that helps.
Hi Alex.
What I was looking for is Integration with FLex2(http://www.adobe.com/products/flex/), which uses mxml scripts and action scripts. By the way. I do not have any program that can open the .fla src files. Could u please post the src code here? I might be able to adapt it for Flex 2
Hi Yan,
We will release a full native Flex SDK pretty soon (presumibly in July). It will be based on ActionScript 3.0 and will leverage mxml.
Regarding the FLA source code, we'll post it as soon as possible (I'm afraid we won't be able to do that before next week). The FLA file is the editable project file saved by the Flash development program.
:D I will keep an eye on it
Hi,
Find attached the Actionscript code from the file demoFlashSmall.fla.
Note that it is not the complete source as the .fla file is a binary file (not a mxml file) so that the visual part is not included here:
Code Actionscript:
import flash.external.ExternalInterface; #include "lsjavascriptbridge.as" #include "format.as" _root.Message.text = "Lightstreamer Live Data"; var groupString = "item1 item2 item3 item4 item5 item6 item7 item8"; var schemaString = "stock_name pct_change pct_change last_price time"; var bridge = new JavaScriptBridge("flashObject"); var myTable = new FlashTable(groupString,schemaString,"MERGE"); myTable.setSnapshotRequired(true); myTable.setRequestedMaxFrequency(0.35); myTable.onItemUpdate = function (item, itemUpdate) { if (itemUpdate.isValueChanged(1)) { var newVal = itemUpdate.getNewValue(1); newVal = cutName(newVal,item); updateName(item,newVal); } if (itemUpdate.isValueChanged(2)) { var newVal = itemUpdate.getNewValue(2); newVal = formactDirection(newVal); updateDirection(item,newVal); } if (itemUpdate.isValueChanged(3)) { var newVal = itemUpdate.getNewValue(3); newVal = formatDecimal(newVal, 2, true); if(newVal > 0){ newVal = "+" + newVal; } updatePerc(item,newVal); } if (itemUpdate.isValueChanged(4)) { var newVal = itemUpdate.getNewValue(4); newVal = formatDecimal(newVal, 2, true); updateLastPrice(item, newVal); } if (itemUpdate.isValueChanged(5)) { var newVal = itemUpdate.getNewValue(5); newVal = formatTime(newVal); updateLastTrade(item, newVal); } } myTable.onStart = function() { for (var item = 1; item <= 8; item++) { updateName(item,""); updatePerc(item,""); updateLastPrice(item, ""); updateLastTrade(item, ""); } } bridge.onStatusChange = function(newStatus) { Message.text = "Status: " + newStatus; } bridge.addTable(myTable,"FlashTable1"); /////////////////////////////////////////////////////////// onEnterFrame = function () { dat = new Date(); gg = dat.getDate(); if(gg < 10){gg = "0" + gg} mm = (dat.getMonth() + 1); if(mm == 1){mm = "Gen"} else if(mm == 2){mm = "Feb"} else if(mm == 3){mm = "Mar"} else if(mm == 4){mm = "Apr"} else if(mm == 5){mm = "May"} else if(mm == 6){mm = "Jun"} else if(mm == 7){mm = "Jul"} else if(mm == 8){mm = "Aug"} else if(mm == 9){mm = "Sep"} else if(mm == 10){mm = "Oct"} else if(mm == 11){mm = "Nov"} else if(mm == 12){mm = "Dec"} aaaa = dat.getFullYear(); _root.CurrentTime = gg + " " + mm + " " + aaaa; }; function updateInstrument(row) { this["instrument"+row].gotoAndPlay(1); } function updateName(row, newVal) { this["instrument"+row].nomeinstrument = newVal; this["instrument"+row].gotoAndPlay(1); } function updateDirection(row, direction) { if (direction == "up" and this["row"+row].direction.vardirection == "down") { this["row"+row].direction.gotoAndPlay("goUp"); } else if (direction == "down" and this["row"+row].direction.vardirection == "up") { this["row"+row].direction.gotoAndPlay("goDown"); } updateInstrument(row); } function updatePerc(row, newVal) { this["perc"+row] = newVal+"%"; this["row"+row].change.gotoAndPlay(1); updateInstrument(row); } function updateLastPrice(row, newVal) { this["lastPrice"+row] = newVal; this["row"+row].price.gotoAndPlay(1); updateInstrument(row); } function updateLastTrade(row, newVal) { this["lastTrade"+row] = newVal; this["row"+row].trade.gotoAndPlay(1); updateInstrument(row); } //notify the page that we are ready bridge.bind();
Please substitute "& # 9 1 ;" with "[" as the Actionscript highlighting changed the code.
Hope that helps.
Alex,
Do you have a better idea of the time frame on new Flex SDK?
cj
Hi,
The new Flex SDK is currently under beta testing. If you are interested in trying the current pre-release, please just get back to support@lightstreamer.com.
Cheers