dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: c# and flash how to ?

  1. #1
    Member
    Join Date
    Oct 2003
    Posts
    34

    c# and flash how to ?

    hello,
    how can i integrate c# and flash in a windows offline application???
    making the interface with flash and the back end code with c#
    thanks

  2. #2
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Check out some tutorials/examples about using OCXes with C# and once you have the basics down, the OCX you want is Flash.OCX and it normally lives in C:\Windows\System32\Macromed\Flash (the part in italics will vary from machine to machine).

  3. #3
    Member
    Join Date
    Oct 2003
    Posts
    34
    thanks
    but what about the flash part?
    i have found an example connecting c# and flash each sending a message to the other but i can't understand the flash part


    this code is on frame1
    and the button that sends to c# is with instance name buttonSend_mc
    /////////////////////////////////////////////////////////////////
    // C-Sharp-Message-Broadcaster
    /////////////////////////////////////////////////////////////////
    _root.bcCSharpMessage = function (varName, oldVal, newVal)
    {
    arguments.callee.broadcastMessage("onCSharpMessage ", newVal);
    }
    ASBroadcaster.initialize(_root.bcCSharpMessage);

    _root.onLoad = function ()
    {
    this.CSharpMessage = null;
    this.watch("CSharpMessage", this.bcCSharpMessage);
    }


    /////////////////////////////////////////////////////////////////
    // Test
    /////////////////////////////////////////////////////////////////

    // Receive from C-Sharp
    obj = new Object();
    obj.onCSharpMessage = function (strMessage)
    {
    _root.flashoutput_txt.text += strMessage + "\n";
    }
    _root.bcCSharpMessage.addListener(obj);


    // Send to C-Sharp
    _root.buttonSend_mc.onRelease = function ()
    {
    fscommand("flashMessage", "Hi C-Sharp");
    }
    can you help me understanding it

  4. #4
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    There are only two ways to move data between Flash and a container application. The first is FSCommand and it only moves data out from Flash to the container application through an FSCommand event. The second method is via the SetVariable/GetVariable COM methods exposed by the Flash OCX.

    The example you gave is pure ActionScript which means it only deals with one side of the equation. The FSCommand sends data out to C#, but the piece that's missing is how C# is sending "messages" to Flash.

  5. #5
    Member
    Join Date
    Oct 2003
    Posts
    34
    thanks for reply,
    1. i do some how understand the fscommand part but what is above (the part that is recieving the message from c#) i can't understand as i do know C# a little


    2. also "flashMessage" in the fscommand, what is it for ?is it a reserved command in action script ???? it is not documented..........


    3. what is flash OCX ???

    anyway here is the example

    http://www.flashfanatiker.de/archives/000032.html


    please let me know as soon as possible what did you understand
    thanks
    Last edited by certified; 12-26-2003 at 05:15 AM.

  6. #6
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    If you don't know what the Flash OCX is then you have a little more work to do before you can start writing C# code to use it! hOK has it all laid out for you on his page with lots of explanations and all the "missing" parts you need are there.

    There is a link to an article on Mike Chambers page from, July 29, 2003, that describes how to set up the Flash OCX in C# and all the C# code to call the OCX SetVariable method to send data back to Flash is there too.

    When you are handling the FSCommands in your C# code, Flash doesn't do any of the processing for you so none of the predefined FSCommands will work. You have to do everything yourself, which means you can use whatever FSCommands you like. You can implement existing commands or you can just can make them up!

    The code that is receiving "events" from Flash is just watching for certain variables to change (they are changed when you call SetVariable from C#), so there's nothing magical there it's just Flash.

  7. #7
    Member
    Join Date
    Oct 2003
    Posts
    34
    thanks,
    but what is Mike Chambers and
    how can i read data from data row in the flash movie??
    Last edited by certified; 01-01-2004 at 05:07 AM.

  8. #8
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    This is from hok's blog entry at www.flashfanatiker.de, Mike Chambers wrote the article about C# and Flash that hok used as his starting point.

    For more details go to the excellent articel by Mike Chambers:
    http://www.markme.com/mesh/archives/002977.cfm
    Once you are "outside" Flash, none of the Flash constructs you take for granted like XML objects, components etc are available to you. If you need to get at this data you have to expose it to the outside world as simple variables or object properties and tell the external application where to find it.

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