Andy,
from the docs
LocalConnection.send(connectionName:String, methodName:String, args:Object)
Martin,
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:
//begin code
import mx.utils.Delegate;
function setMP3(file:String, type:String){
this.my_display.setMedia(file, type);
}
var receiving_lc:LocalConnection = new LocalConnection();
this.receiving_lc.setMP3 = Delegate.create(this, this.setMP3);
this.receiving_lc.connect("myConnections");
// end code
if you prefer using an initialize function:
//begon code
import mx.utils.Delegate;
var receiving_lc:LocalConnection;
function setMP3(file:String, type:String){
this.my_display.setMedia(file, type);
}
function initialize(){
this.receiving_lc = new LocalConnection();
this.receiving_lc.setMP3 = Delegate.create(this, this.setMP3);
this.receiving_lc.connect("myConnections");
}
this.initialize();
// end code
In the sending swf:
var sending_lc:LocalConnection = new LocalConnection();
sending_lc.send("setMP3", "inmylife.mp3", "MP3");
regards,
Muzak
----- Original Message -----
From: "Andy Herrman" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, October 19, 2006 4:58 PM
Subject: Re: [Flashcoders] LocalConnection and Media Components?
> I'm pretty new at this, so I'm not sure how much help I can really be,
> but I'll give it a shot.
>
> One thing I just noticed is that in your code for the button movie you
> instantiate the LocalConnection but don't call connect(). If what you
> gave there is all of your code than that's probably the problem.
>
> You seem to be including the name of the connection when you call
> 'send'. I don't think this is right (at least from the way I'm used
> to using it). Instead, you'd do something like this:
>
> var sending_lc:LocalConnection = new LocalConnection();
> sending_lc.connect("myConnections");
> play_button.onRelease = function()
> {
> sending_lc.send("methodToExecute", "C:/inmylife.mp3", "MP3");
> }
>
> Try that and see if it helps.
>
> -Andy
>
> On 10/18/06, Martin Scott Goldberg <[EMAIL PROTECTED]> wrote:
>> Hi Andy,
>>
>> I started with a working player, meaning I had a working flash movie that
>> played the local mp3 in the web browser window. So the locality shouldn't
>> be an issue. I then tried extending it with the LocalConnection material.
>>
>> I've been trying to do some things to check out what's being called and
>> what isn't, and it looks like my processing function in the player never
>> gets called.
>>
>> Is it a possibility of an html problem? I'm publishing the player movie,
>> publishing the button movie, and then clipping and pasting the object
>> definition from the button movie html in to the player movie html.
>>
>> The other issue is I don't know if the MediaDisplay component can have its
>> associated file changed midstream?
>>
_______________________________________________
[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