DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    2

    Passing variables from ASP.NET to Flash

    I could not find a similar thread to what I've problems with and I'm new to ASP.NET and Flash and I am building an application that requires database and flash. I need to pass variables from aspx to flash. I looked it up and tried the loadvar method. i.e.

    In ClientMenu.aspx:

    page_load()

    Dim strFlash As String = ""
    strFlash = "cname=" & Server.UrlEncode("strClientName") & "&" & "ccardid=" & Server.UrlEncode("ClientCardID") & "&" & "ccpnts=" & Server.UrlEncode("ClientCurrentPoints")
    Response.Write(strFlash)

    In fla:
    .
    .
    loadVariables("ClientMenu.aspx", this);
    .
    .
    onClipEvent (data) {

    flashClientName = cname;
    flashClientCardID = ccardid;
    flashClientPoints = ccpnts;
    }

    The flash loads. The variables load into the flash swf. BUT the variables with its values also appear above the flash image as a single string. i.e. above the flash image, this string appears:

    cname=strClientName&ccardid=ClientCardID&ccpnts=ClientCurrentPoints

    What am I missing?

    Thanks in advance

  2. #2
    Join Date
    Mar 2006
    Posts
    2
    Here's a solution which is by no means professional, but it helped.

    What I did was just to make it invisible using font color=white in addition to strFlash. The image is however still one line lower than where it should have been if the string wasn't there.

    i.e. response.write("<font color=#FFFFFF>" & strFlash & "</font>")

    If anyone has a better solution (calling all tech gurus out there), I'd prefer that. Thanks.

  3. #3
    Join Date
    Mar 2006
    Posts
    16

    Try using this

    Check this example which is given in flash LoadVariable Function Help -

    before this create "params.txt" file and save this in it in the same folder of .fla file :

    var1="hello"&var2="goodbye"&done="done"

    _________________________________________________________

    this.createEmptyMovieClip("target_mc", this.getNextHighestDepth());
    loadVariables("params.txt", target_mc);
    function checkParamsLoaded() {
    if (target_mc.done == undefined) {
    trace("not yet.");
    } else {
    trace("finished loading. killing interval.");
    trace("-------------");
    for (i in target_mc) {
    trace(i+": "+target_mc[i]);
    }
    trace("-------------");
    clearInterval(param_interval);
    }
    }
    var param_interval:Number = setInterval(checkParamsLoaded, 100);
    _________________________________________________________

    you will get an idea!

    setInterval is threading concept! just look at how it is done if u are not getting threading part!

    cheers...
    (actually in hurry, thats why couldnt answer in detailed...)

Similar Threads

  1. Flash to ASP.NET
    By emad in forum ASP.NET
    Replies: 1
    Last Post: 10-25-2005, 07:31 AM
  2. ASP.NET vs. Flash vs. Java
    By Michael Gautier in forum .NET
    Replies: 3
    Last Post: 09-10-2002, 12:23 PM
  3. Free ASP.NET Web Matrix Design/Editor Tool Released
    By ASPSmith Training in forum dotnet.announcements
    Replies: 0
    Last Post: 06-18-2002, 03:39 AM
  4. Flash mx
    By sam in forum Web
    Replies: 0
    Last Post: 03-15-2002, 12:01 AM
  5. passing Session variables in Form
    By Bill Heffner in forum ASP.NET
    Replies: 0
    Last Post: 11-13-2001, 05:34 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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links