A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: LocalConnection, this time explained much better! - plus

  1. #1
    Junior Member
    Join Date
    Jul 2003
    Posts
    7

    LocalConnection, this time explained much better! - plus

    localConnection problem

    I have 2 swf files. one is in my computer (send.swf), the other is in my friend's computer (receive.swf).
    I want to send a message from send.swf to receive.swf through the internet.
    In order to do so,
    I read about the object "localConnection" and I know how to send a message when the files (send.swf and receive.swf) are stored in a website (or in different websites) because i know their domains.
    But what I want is to send a message when the file send.swf is in my computer and receive.swf is in my friend's computer.
    I don't know how to connect between the files,
    Can you help me connect between the files?

    - Someone told me that I need to use a side server script,
    (asp 4 example).
    I have some experience in asp but, how???

    - Isn't there an other way? Maybe to define a domain to my computer
    and to my friend's computer?

  2. #2
    Lifesaver Lightwave Network's Avatar
    Join Date
    Sep 2002
    Location
    Denver, CO, USA
    Posts
    649
    Typically, one would use Flash Communication Server to accomplish the "Instant Messenger" application in Flash (this is actually what I did.)

    Any instant messenger connects with a SERVER. The server stores the names of everyone that's connected, contains username/password info, passes messeges, etc.

    So, if all you want is a peer-to-peer messenger, you CAN accomplish this with Flash Studio Pro, as it has socket connectivity. It's not the easiest thing in the world to understand right away, particularly if you've never used FSP and if this is your first data communication project. But, it's very possible, and easy to understand once you get the hang of it.

    http://www.multidmedia.com for Flash Studio Pro.

    As far as ASP goes, I think creating an IM program would probably not work--I'm pretty fluent in ASP, and I can't think of a really good way to use Flash to pass messages. You CAN use XML, but I'm pretty stupid in that area.

    Hope this helps.
    Last edited by Lightwave Network; 07-07-2003 at 02:01 PM.


    ... gimme just one more line of code to ease the pain.

    http://www.ln.tv
    http://www.davevillano.com
    http://www.premierloftsdenver.com
    http://www.backyard.cc -- coming soon!


  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    191
    As far as using ASP to pass messages, you can accomplish this by using the Session and Application object. By creating a user array in the Application object and passing data to a flash movie via XML, you can get a fairly decent chat app going.

    It's no commuunication server, but it doesn't require anything other than Flash MX and a Win2K based web account.

    "...and I know how to send a message when the files (send.swf and receive.swf) are stored in a website (or in different websites) because i know their domains"

    yaniv_86a,
    do you have any good examples of your lcoalconnection code? If so, I'd be happy to send oyu the ASP and FLA for my chat app.

  4. #4
    if you have enough experiece in C/C++/Java ... you can create a server then use Flash MX's XMLSockets to connect and communicate, but that may be a bit advanced for what you need to do

    j

  5. #5
    Lifesaver Lightwave Network's Avatar
    Join Date
    Sep 2002
    Location
    Denver, CO, USA
    Posts
    649
    Nebulus,

    I'm curious about the ASP app--does it require that you refresh the browser every time you update the "chat room" or can you get the Application/Session vars without this method?

    Any info is appreciated!


    ... gimme just one more line of code to ease the pain.

    http://www.ln.tv
    http://www.davevillano.com
    http://www.premierloftsdenver.com
    http://www.backyard.cc -- coming soon!


  6. #6
    Senior Member
    Join Date
    Jan 2001
    Posts
    191
    Flash takes care of all the post/get methods without any browser refresh.

    When you start the app, you get a login screen to enter a nickname. This posts to an ASP page that checks the application object for a similar name, IP ban status, and if you were previously kicked.

    Once you get the all clear, it sends you a welcome message, available rooms, and users all in an XML format.

    The flash app can then parse the XML and fill out the chat application. IT refreshes every 3 seconds to get/post the latest posts. All the user's information - nickname, IP, ban/kick status, current room, and message queue is stuffed into an array. All the parsing and management is done on the server side, and Flash acts only as the client.

    I'm also working on an admin portal as well. So far, you can edit the chat variables, kick and ban users, as well as view their transcripts (admin can view anybody's, a user can only view theirs).

    I've got a lot of work to do on it so far, but the back end code is pretty solid - I'm real picky about error trapping

  7. #7
    Lifesaver Lightwave Network's Avatar
    Join Date
    Sep 2002
    Location
    Denver, CO, USA
    Posts
    649
    Sounds great! I'm a nut about error-handling/trapping, too, so I completely feel your pain. Hehe.

    Thanks for the tips, though--I never thought to use ASP in this manner. Great idea!


    ... gimme just one more line of code to ease the pain.

    http://www.ln.tv
    http://www.davevillano.com
    http://www.premierloftsdenver.com
    http://www.backyard.cc -- coming soon!


  8. #8
    Junior Member
    Join Date
    Jul 2003
    Posts
    7

    You Rule !!!

    Thanks!!!
    All of you gave me a lot to do and understand.
    please try and explain more about xml, it'll really help!
    Real big thanks!!!
    yaniv

  9. #9
    Lifesaver Lightwave Network's Avatar
    Join Date
    Sep 2002
    Location
    Denver, CO, USA
    Posts
    649
    http://www.devguru.com/ should help you out with that.


    ... gimme just one more line of code to ease the pain.

    http://www.ln.tv
    http://www.davevillano.com
    http://www.premierloftsdenver.com
    http://www.backyard.cc -- coming soon!


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