Professional Web Applications Themes

ASP and FLASH INtegration - Macromedia Flash Data Integration

Hi Guys and Gals, Im having a bit of trouble integrating dynamic variables pulled from a databse using an ASP script with a flash movie. Background: I need to send variables stored in a ms sql db to a flash movie to display several values. The dyanmic element comes in because i am using an ID to select the values from the db e.g id1 = joe bloggs id2 = paul smith etc When i am hardcoding the id in the asp script the variables are sent to the flash movie no probs and they display correctly. I am also ...

  1. #1

    Default ASP and FLASH INtegration

    Hi Guys and Gals,

    Im having a bit of trouble integrating dynamic variables pulled from a databse
    using an ASP script with a flash movie.

    Background:

    I need to send variables stored in a ms sql db to a flash movie to display
    several values.

    The dyanmic element comes in because i am using an ID to select the values
    from the db e.g id1 = joe bloggs id2 = paul smith

    etc

    When i am hardcoding the id in the asp script the variables are sent to the
    flash movie no probs and they display correctly.

    I am also printing the asp code on the page and that all displaying fine.

    HOWEVER, the issue arises when i make the asp code dynamic and by that i mean
    I am using request.querystring to pull the id

    from the URL - The print out of the asp code is still displaying the correct
    variables, BUT they are not being passed to the

    flash movie at all - the placeholder is blank there isn't event an error!!.


    Couple of things to note ?

    - if you change the id bit of the url in the dynamic script to the printed asp
    code changes
    - THE FLASH MOVIE IS IDENTIAL in both scenarios
    - all variable names have remained the same
    - it is NOT a location of file issue as we have tested the dynamic code files
    In another folder and no joy
    - we are not using any other file includes or asp code in any of the page ?
    all other code has been stripped out

    THE ISSUE WE HAVE IS THAT THE PRINTED VARIABLES ARE NOT BEING PASSED TO THE
    FLASH MOBIE in scenario 2 where the asp code is

    looking for the participant id dynamically (i.e from the URL)


    Really could do with some help here!!!

    Berti_2001

    berti_2001 Guest

  2. #2

    Default Re: ASP and FLASH INtegration

    Hello,

    I don't know ASP but I do know PHP. The concept for printing variables to
    send to Flash is the same in any language. So the idea is to send back to
    Flash a string of variables with values that are separated by ampersands and
    contain no line breaks.
    In PHP, a typical query/result routine would look like this.

    // After a successful connection to the server and database
    $sql = "SELECT id FROM tableName";
    $query = mysql_query($sql) or die(mysql_error());
    $i = 1;
    while($row = mysql_fetch_row($query)){
    echo "id". $id . "=". $row[0] ."&"; // echo is used more often than print
    $i++;
    }
    // Displays id1=Joe Bloggs&id2=Paul Smith&id3=Mary Lamb...etc

    Is this how you're printing out your results from your query? If so, then good
    thats what it's supposed to look like.

    So then in Flash (using Actionscript 2.0), you would load the data using the
    LoadVars object.

    var lv:LoadVars = new LoadVars();
    lv.load("myASP.asp");
    lv.onLoad = function(success:Boolean)
    {
    if(success){
    trace(this.loaded) // displays the data string above
    } else {
    trace("Error");
    }
    };

    Do you have a similar routine in your Flash movie? If so, then thats good
    because LoadVars is the preferred method to load dynamic data into Flash.

    There is another method to load dynamic data called loadVariables.
    e.g. loadVariables("myASP.asp", this));

    This does the same thing but doesn't give you much control over the data it's
    loading. If you are using this method then I suggest you switch to the
    LoadVars object as it has methods that allow you to test if data has loaded
    properly or not. Also by creating an instance of the LoadVars object you can
    access your data easily by using dot notation. Using the LV object in the
    script above you can get the value for id1 like this

    lv.id1 // displays Joe Bloggs

    If you're publishing and testing your files locally(thru IIS) then when your
    SWF window appears go to Debug>List Variables and see if any data is loaded
    into Flash.

    Thats about all I know. I hope something in here helps you?


    Noelbaland Guest

Similar Threads

  1. ASP/Flash Integration Help
    By Magnix in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: January 21st, 05:31 PM
  2. Flash and FTP integration
    By zer0efx in forum Macromedia Flash Data Integration
    Replies: 1
    Last Post: February 2nd, 04:12 PM
  3. Flash and C++ Integration
    By Knale in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: September 27th, 04:47 PM
  4. CFW flash integration
    By mohanmathew in forum Coldfusion Flash Integration
    Replies: 0
    Last Post: August 16th, 04:59 AM
  5. .NET and flash integration
    By j_o_w_a in forum Coldfusion Flash Integration
    Replies: 1
    Last Post: August 3rd, 10:35 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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139