LocalConnection Object Resources

One of the things that Macromedia Central makes extensive use of is the ActionScript LocalConnection object. Below is the beginning of a list of resources I have begun to put together that discuss the LocalConnection object. I figured that it might be useful for some people, so here it is.

If you know of any articles or resources that I missed, then post them in the comments.

9 Responses to LocalConnection Object Resources

  1. chris kief says:

    One thing that should be pointed out with LocalConnection and AS2 is that the class was not flagged as dynamic.What does this mean and how does it prove problematic? Let’s look at an example:// Code in the receiving moviereceiving_lc = new LocalConnection();receiving_lc.methodToExecute = function(param1, param2){// Code to be executed}receiving_lc.connect(“lc_name”);// Code in the sending moviesending_lc = new LocalConnection();sending_lc.send(“lc_name”, “methodToExecute”, dataItem1, dataItem2);This code does not produce a compiler error. Now let’s use strong typing:// Code in the receiving movievar receiving_lc:LocalConnection = new LocalConnection();receiving_lc.methodToExecute = function(param1, param2){// Code to be executed}receiving_lc.connect(“lc_name”);// Code in the sending movievar sending_lc:LocalConnection = new LocalConnection();sending_lc.send(“lc_name”, “methodToExecute”, dataItem1, dataItem2);Whoops! Now we’ve got a problem. The compiler doesn’t like the fact that we’ve added a property:**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: There is no property with the name ‘methodToExecute’.receiving_lc.methodToExecute = function(param1, param2)In order to prevent these errors, you have to set the class to dynamic (LocalConnection.as in the Classes folder):dynamic intrinsic class LocalConnection { }chris

  2. You can always subclass it!!That is probably the best way to do it now with AS2dynamic class illCommunication extends localConnectionthat’s probably your best best

  3. chris kief says:

    That just doesn’t make any sense. Why should I need to subclass LocalConnection just to be able to use it with AS2?The whole purpose of the send() method is to invoke a method on a remote LocalConnection object. Without the dynamic designation, there’s no way to add that method! That’s just silly.Other classes that need the ability to add and access dynamic properties at runtime such as MovieClip and LoadVars were flagged as dynamic – why not LocalConnection?

  4. Hey Gang,I’m suprised something like this slipped through the cracks. In any case, to fix this problem, open the LocalConnection class file (look in the Flash 2004 directory) and add the dynamic keyword to its class name, then restart Flash. You’ll be good to go from then on. :)Example:intrinsic dynamic class LocalConnection{Best,Derek

  5. Sorry Chris, I should have read your complete post. You solution is elegant ;)Best,Derek

  6. chris kief says:

    I’m suprised as well Derek that something like this was missed. Not a big deal to fix – but it sure threw me the first time I ran across the compiler error.Same thing happened when I referenced System.onStatus – that one is missing completely from the intrinsic class definition.

  7. arfan says:

    sir please solve my problemwen i am trying to link in flashof this codegetURL(“www.najmimfg.com”.”_self”);there is a error appear**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Expected a field name after ‘.’ operator.getURL(“www.najmimfg.com”.”_self”);Total ActionScript Errors: 1 Reported Errors: 1

  8. FlashLit. says:

    Quirks of Dynamic Classes

    I’ve been converting some of my AS1.0 classes over to AS2.0 and I’ve run across a few quirks.The first has to do with the for…in construct causing compiler errors when iterating through properties on certain classes. It all seems to come down to dy…

  9. You have a interesting articles here. Also if you think my site is a good resource for your visitors,maybe you’ll review it and comment it in one of your blog’s articles. Or even have a small link in your links area, if you have something like that. Thank you very muchkeep up the good work!!!!Send flowers, flowers delivery Flower Delivery online flowers delivery uk flowers same day delivery