Ok, say the Flex side needs to call methods on the Flash side.  We set up a LocalConnection so that the Flash side acts as a server and the Flex side connects to it.  In Flash 8:

        lc = new LocalConnection();
        lc.connect("MyFlashServer");   //Give it a unique name
      
        //Define callable methods

        lc.sayHello = function(s: String): Void
        {
           trace(s);
        }

In Flex 2:

   import flash.net.LocalConnection;
   var lc: LocalConnection = new LocalConnection();
   lc.send("MyFlashServer", "sayHello", "hello world");   //Server name, method name, argument

That's the basic mechanism.  Note that this is one-way communication.  You can't return a value from sayHello() back to Flex.  If you need two-way communication, you'll have to set up another LocalConnection but reverse the client and server.


On 4/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I have reached that kind of conclusion myself reading through the archives. What I miss is an example of how to do this, since the documentation is not very complete. I also searched the net without any luck.

Thanks.

Torben Nielsen

-----Original Message-----

From:  "Roger Gonzalez" <[EMAIL PROTECTED]>
Subj:  RE: [flexcoders] Accessing methods/properties (Flash 8 movies in Loader component)
Date:  Sun 9. Apr 2006 0:36
Size:  1K
To:  <flexcoders@yahoogroups.com>

Flash 8 SWFs and Flash 8.5 SWFs run different versions of Actionscript,
and cannot communicate directly.

You need to build a layer using LocalConnection to proxy  communications
between the two different virtual machines.

(Once the next version of Flash Authoring is out, this won't be
necessary.)

-rg


________________________________

        From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com ] On Behalf Of Torben Nielsen
        Sent: Saturday, April 08, 2006 2:35 PM
        To: flexcoders@yahoogroups.com
        Subject: [flexcoders] Accessing methods/properties (Flash 8
movies in Loader component)




        Hi,



        maybe it would be better if I specified what it is that I am
trying to do.



        I am developing an application that loads external Flash 8
movies that contains some movieclips, methods and properties. I load
them into a Loader component like this:



        <mx:Loader id="detailClip" source="assets/IC51030.swf"
width="650" height="400" />



        How can I access a method in the Flash 8 movie loaded into the
Loader component???



        I saw the thread below but I am not able to grab the solution
from these bits and pieces of information. Could somebody help me
please. I need this to work otherwise I have to abandon Flex for this
project and move back into Flash. I really would prefer to make it in
Flex.



        Thanks.



        Best regards.



        Torben Nielsen



________________________________

        From: flexcoders@yahoogroups.com
[mailto: flexcoders@yahoogroups.com] On Behalf Of Torben Nielsen
        Sent: sabato 8 aprile 2006 20.16
        To: flexcoders@yahoogroups.com
        Subject: RE: [flexcoders] Flash 8 swf in Flex 2.0 App?



        Hi,


--- message truncated ---




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to