A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: External API question..

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    6

    Question External API question..

    Hi..is there anyone that knows how to for instance create a string varibale in ActionScript and then send that string from the swf/as file over to C#? so you for instance can send a variable string as I said over to C# and then change a Panels text..

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    look up fscommand, that should point you in the right direction.

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    if I have undertstand that command right, then if i create a button in flash and enters this code for it:
    Code:
    on(release){ fscommand("testFunction", "contact") }
    It will send the "contact" string into my function called "testFunction"...right?

    But that doesnt work, since I have the flash button scen in the ASP file, and not in the C# file...so the code that "prints out" the flash clip is written in ASP/HTML so far...so the question is, do I have to "print out" the flash clip with my C# code, and if i have to, how do I do that?...anyone that has any good ideas?...I know C# and ASP might not belong to this forum, but its worth a try

    Thanks in advance!

    EDIT:

    Oh btw! The C# function called testFunction has the following code:
    Code:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    
    public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            testFunction("welcome");
        }
    
        public void testFunction(string link)
        {
            if (link == "welcome")
            {
                Label1.Text = "Welcome";
            }
            else if (link == "contact")
            {
                Label1.Text = "Contact";
            }
            else { }
    
        }
    }
    not sure if thats of any intresst but...well better give you all the info, might be easier that way
    Last edited by fatbob51; 11-25-2007 at 09:11 AM.

  4. #4
    Senior Member
    Join Date
    Oct 2005
    Posts
    148
    Since you're using an ASP.NET page, you'll need to make a server request in order to execute your testFunction.

    In that case even a simple getURL from flash will work. getURL("mypage.aspx?link="welcome");

    In asp page you'll get the GET parameter using Request.Querystring. Like:

    string link = Request.Querystring["link"];

    then check the value of the link.

    Typically however, you'll want to use the flash "LoadVars()" class to send variables either as Post or Get as LoadVars() can receive variables back from ASP which getURL cannot do.

    If refreshing or redirecting to a new page, messes up your flash movie because it'll start the flash movie over, you'll then either have to use Javascript instead of ASP.NET to display your message or open up a div tag, or if you are comfortable the AJAX extensions with ASP.NET, then it might be possible to use ASP.NET and AJAX to seamlessly control the page elements via ASP.NET rather than Javascript.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center