Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Jun 2007
    Location
    Durham
    Posts
    3

    Integration with FLex2

    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.

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    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.

  3. #3
    Member
    Join Date
    Jun 2007
    Location
    Durham
    Posts
    3

    Wink I did check those flex examples

    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

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    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.

  5. #5
    Member
    Join Date
    Jun 2007
    Location
    Durham
    Posts
    3

    Talking Thanks Alex.....

    I will keep an eye on it

  6. #6
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    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:
    1. import flash.external.ExternalInterface;
    2. #include "lsjavascriptbridge.as"
    3. #include "format.as"
    4. _root.Message.text = "Lightstreamer Live Data";
    5.  
    6. var groupString = "item1 item2 item3 item4 item5 item6 item7 item8";
    7. var schemaString = "stock_name pct_change pct_change last_price time";
    8.  
    9. var bridge = new JavaScriptBridge("flashObject");
    10.  
    11. var myTable = new FlashTable(groupString,schemaString,"MERGE");
    12. myTable.setSnapshotRequired(true);
    13. myTable.setRequestedMaxFrequency(0.35);
    14. myTable.onItemUpdate = function (item, itemUpdate) {
    15.     if (itemUpdate.isValueChanged(1)) {
    16.         var newVal = itemUpdate.getNewValue(1);
    17.         newVal = cutName(newVal,item);
    18.         updateName(item,newVal);
    19.     }
    20.     if (itemUpdate.isValueChanged(2)) {
    21.         var newVal = itemUpdate.getNewValue(2);
    22.         newVal = formactDirection(newVal);
    23.         updateDirection(item,newVal);
    24.     }
    25.     if (itemUpdate.isValueChanged(3)) {
    26.         var newVal = itemUpdate.getNewValue(3);
    27.         newVal = formatDecimal(newVal, 2, true);
    28.         if(newVal > 0){
    29.             newVal  = "+" + newVal;
    30.         }
    31.         updatePerc(item,newVal);
    32.     }
    33.     if (itemUpdate.isValueChanged(4)) {
    34.         var newVal = itemUpdate.getNewValue(4);
    35.         newVal = formatDecimal(newVal, 2, true);
    36.         updateLastPrice(item, newVal);
    37.     }
    38.     if (itemUpdate.isValueChanged(5)) {
    39.         var newVal = itemUpdate.getNewValue(5);
    40.         newVal = formatTime(newVal);
    41.         updateLastTrade(item, newVal);
    42.     }
    43.    
    44. }
    45. myTable.onStart = function() {
    46.     for (var item = 1; item <= 8; item++) {
    47.         updateName(item,"");
    48.         updatePerc(item,"");
    49.         updateLastPrice(item, "");
    50.         updateLastTrade(item, "");
    51.     }
    52. }
    53. bridge.onStatusChange = function(newStatus) {
    54.     Message.text = "Status: " + newStatus;
    55. }
    56.  
    57. bridge.addTable(myTable,"FlashTable1");
    58.  
    59.  
    60. ///////////////////////////////////////////////////////////
    61.  
    62.  
    63.  
    64. onEnterFrame = function () {
    65.     dat = new Date();
    66.    
    67.  
    68.     gg = dat.getDate();
    69.     if(gg < 10){gg = "0" + gg}
    70.    
    71.     mm = (dat.getMonth() + 1);
    72.    
    73.  
    74.     if(mm == 1){mm = "Gen"}
    75.     else if(mm == 2){mm = "Feb"}
    76.     else if(mm == 3){mm = "Mar"}
    77.     else if(mm == 4){mm = "Apr"}
    78.     else if(mm == 5){mm = "May"}
    79.     else if(mm == 6){mm = "Jun"}
    80.     else if(mm == 7){mm = "Jul"}
    81.     else if(mm == 8){mm = "Aug"}
    82.     else if(mm == 9){mm = "Sep"}
    83.     else if(mm == 10){mm = "Oct"}
    84.     else if(mm == 11){mm = "Nov"}
    85.     else if(mm == 12){mm = "Dec"}
    86.    
    87.     aaaa = dat.getFullYear();
    88.    
    89.     _root.CurrentTime = gg + " " + mm + " " + aaaa;
    90. };
    91.  
    92.  
    93.  
    94. function updateInstrument(row) {
    95.     this["instrument"+row].gotoAndPlay(1);
    96. }
    97.  
    98. function updateName(row, newVal) {
    99.     this["instrument"+row].nomeinstrument = newVal;
    100.     this["instrument"+row].gotoAndPlay(1);
    101. }
    102.  
    103. function updateDirection(row, direction) {
    104.     if (direction == "up" and this["row"+row].direction.vardirection == "down") {
    105.         this["row"+row].direction.gotoAndPlay("goUp");
    106.     } else if (direction == "down" and this["row"+row].direction.vardirection == "up") {
    107.         this["row"+row].direction.gotoAndPlay("goDown");
    108.     }
    109.     updateInstrument(row);
    110. }
    111. function updatePerc(row, newVal) {
    112.     this["perc"+row] = newVal+"%";
    113.     this["row"+row].change.gotoAndPlay(1);
    114.     updateInstrument(row);
    115. }
    116. function updateLastPrice(row, newVal) {
    117.     this["lastPrice"+row] = newVal;
    118.     this["row"+row].price.gotoAndPlay(1);
    119.     updateInstrument(row);
    120. }
    121. function updateLastTrade(row, newVal) {
    122.     this["lastTrade"+row] = newVal;
    123.     this["row"+row].trade.gotoAndPlay(1);
    124.     updateInstrument(row);
    125. }
    126.  
    127.  
    128.  
    129. //notify the page that we are ready
    130. bridge.bind();

    Please substitute "& # 9 1 ;" with "[" as the Actionscript highlighting changed the code.

    Hope that helps.

  7. #7
    Member
    Join Date
    Jul 2007
    Location
    durham
    Posts
    1
    Alex,
    Do you have a better idea of the time frame on new Flex SDK?
    cj

  8. #8
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    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

 

 

Similar Threads

  1. GWT integration
    By hamroune in forum Client APIs
    Replies: 1
    Last Post: January 3rd, 2012, 10:26 AM
  2. GWT integration
    By hamroune in forum General
    Replies: 1
    Last Post: January 3rd, 2012, 10:26 AM
  3. Drupal Integration ?
    By stockstreamtest1 in forum Client APIs
    Replies: 2
    Last Post: September 19th, 2011, 11:48 AM
  4. GWT Integration
    By tvseshagiri in forum Client APIs
    Replies: 1
    Last Post: June 7th, 2010, 12:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 06:18 PM.