A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: LocalConnection

  1. #1
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55

    LocalConnection

    I'm trying to setup a Doc Class which deploys LocalConnection,
    However, because i have it loading as an external package, i can no longer use incoming_lc.client = this;

    How do i know what the name of the object im targeting is?

    package {

    import flash.display.*;
    import flash.net.*;
    import flash.display.*;
    import flash.text.*;

    public class MainStageDocCLass extends MovieClip {

    public var myLoader:Loader = new Loader();


    // create a new LocalConnection instance used to listen
    // for calls from a LocalConnection instance from another movie
    var incoming_lc:LocalConnection = new LocalConnection();

    // create a local connection listening to a connection
    // with the name "lc_example"
    incoming_lc.connect("lc_mainStage");

    public function MainStageDocCLass() {
    loadItems("TopNavigation.swf", 0, 0);
    trace("MainStageDocCLass.as has loaded");
    }
    // define an method which will be called when a message
    // is sent from a LocalConnection instance from another movie
    function methodToExecute(param:String):void {
    sentMessage_txt.text = param;
    }

    // set the client reference of the LocalConnection instance
    // to the object containing the method needing to be called
    incoming_lc.client = this;

    public function loadItems(clip:String, ypos:uint, xpos:uint):void {
    var myLoader:Loader = new Loader();
    addChild(myLoader);
    myLoader.load(new URLRequest(clip));
    myLoader.x = xpos;
    myLoader.y = ypos;


    }
    }
    }

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Yes you can, why not? But when you test your movie make sure you are connected. Add a try-catch method and a textfield to see if you are connected or not.
    - The right of the People to create Flash movies shall not be infringed. -

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