I forgot to mention that there is a risk that your variables can go
out of scope, especially for your receiver.

Might want to consider this is it still doesn't work.

On 10/28/06, Ray Chuan <[EMAIL PROTECTED]> wrote:
Hi,

setMedia should be defined on the LocalConnection instance:

receiving_lc.setMedia = function(file:String, type:String):Void {
  //do stuff
};

On 10/28/06, Martin Scott Goldberg <[EMAIL PROTECTED]> wrote:
> Hi Ray, that didn't work either.  Changed the code to reflect those
> help pages as well, and that didn't work either.  Here's the sending code:
>
> play_button.onRelease = function()
> {
>         var sending_lc:LocalConnection = new LocalConnection();
>         sending_lc.send("_myConnections", "setMedia", "inmylife.mp3",
> "MP3");
> }
>
>
> Here's the recieving code:
>
> _root.my_display.associateController(my_controller);
> _root.my_controller.controllerPolicy = "on";
>
> var receiving_lc:LocalConnection = new LocalConnection();
> function setMedia(file:String, type:String){
>      _root.my_display.setMedia(file, type);
> }
> receiving_lc.allowDomain = function():Boolean {
>   return true;
> }
> receiving_lc.connect("_myConnections");
>
>
>
>
> This is getting really dissheartening that there's this much of a problem
> to do what should be a simple function.
>
>
>
> Marty
>
>
>
> >
> >Hi,
> >in your receiving LocalConnection object add allowDomain:
> >
> >this.receiving_lc.allowDomain = function():Boolean {
> >  return true;
> >}
> >
> >Also, use an underscore at the front of your connection name: 
"_MyConnections".
> >
> >See the docs for more info:
> >
> >http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001422.html
> >http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001425.html
> >
> >
> >On 10/27/06, Martin Scott Goldberg <[EMAIL PROTECTED]> wrote:
> >> >Martin,
> >>
> >>
> >> Sorry I'm just getting back to you, was out of town for a wedding.
> >>
> >>
> >> >
> >> >You have things a bit in a weird order in the receiving swf.
> >> >Also, "receiving_lc" outside and inside the initialize function are 2 
differenct variables/instances.
> >> >"receiving_lc" in the initialize function is local to the function, 
because of the var keyword.
> >> >
> >> >And nested functions are a 'no no'..
> >> >
> >> >If you're coding in the main timeline, try this:
> >> >
> >>
> >> Yes, I'm coding in the main timeline.  I have the following code now
> >> (after modding yours) and I still can't get it to work:
> >>
> >> import mx.utils.Delegate;
> >>
> >> my_display.associateController(my_controller);
> >> my_controller.controllerPolicy = "on";
> >>
> >> function setMedia(file:String, type:String){
> >>      this.my_display.setMedia(file, type);
> >> }
> >>
> >> var receiving_lc:LocalConnection = new LocalConnection();
> >> this.receiving_lc.setMedia = Delegate.create(this, this.setMedia);
> >> this.receiving_lc.connect("myConnections");
> >>
> >>
> >>
> >> In the button movie I have the following code in the main timeline:
> >>
> >> var sending_lc:LocalConnection = new LocalConnection();
> >> sending_lc.connect("myConnections");
> >>
> >> play_button.onRelease = function()
> >> {
> >>         sending_lc.send("myConnections", "setMedia", "inmylife.mp3",
> >> "MP3");
> >> }
> >>
> >>
> >>
> >> For the test HTML, I have following code (created by merging the two
> >> html's created by "publishing":
> >>
> >>
> >> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> >> <head>
> >> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> >> <title>player</title>
> >> </head>
> >> <body bgcolor="#ffffff">
> >> <!--url's used in the movie-->
> >> <!--text used in the movie-->
> >> <!-- saved from url=(0013)about:internet -->
> >> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
> >> 
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0";
> >> width="700" height="200" id="player" align="middle">
> >> <param name="allowScriptAccess" value="sameDomain" />
> >> <param name="movie" value="player.swf" /><param name="quality"
> >> value="high" /><param name="bgcolor" value="#ffffff" /><embed
> >> src="player.swf" quality="high" bgcolor="#ffffff" width="700" height="200"
> >> name="player" align="middle" allowScriptAccess="sameDomain"
> >> type="application/x-shockwave-flash"
> >> pluginspage="http://www.macromedia.com/go/getflashplayer"; />
> >> </object>
> >> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
> >> 
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0";
> >> width="30" height="32" id="play" align="middle">
> >> <param name="allowScriptAccess" value="sameDomain" />
> >> <param name="movie" value="play.swf" /><param name="quality" value="high"
> >> /><param name="bgcolor" value="#ffffff" /><embed src="play.swf"
> >> quality="high" bgcolor="#ffffff" width="30" height="32" name="play"
> >> align="middle" allowScriptAccess="sameDomain"
> >> type="application/x-shockwave-flash"
> >> pluginspage="http://www.macromedia.com/go/getflashplayer"; />
> >> </object>
> >> </body>
> >> </html>
> >>
> >>
> >> Could it be I have to allow connections from this domain?  (I saw another
> >> recent topic on that here).
> >>
> >>
> >> Marty
> >> _______________________________________________
> >> [email protected]
> >> To change your subscription options or search the archive:
> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >> Brought to you by Fig Leaf Software
> >> Premier Authorized Adobe Consulting and Training
> >> http://www.figleaf.com
> >> http://training.figleaf.com
> >>
> >
> >
> >--
> >Cheers,
> >Ray Chuan
> >_______________________________________________
> >[email protected]
> >To change your subscription options or search the archive:
> >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >Brought to you by Fig Leaf Software
> >Premier Authorized Adobe Consulting and Training
> >http://www.figleaf.com
> >http://training.figleaf.com
> >
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


--
Cheers,
Ray Chuan



--
Cheers,
Ray Chuan
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to