LocalConnection.  Why?
 
Browser support.
 
I've seen no reports on Flashcoders, Flexcoders, or blogs about LocalConnection "not working".  I've seen a few for ExternalInterface.  Usually they are work aroundable, but that's one more thing to worry about in an already diffucult profession.
 
Secondly, relying on the browser makes your code less portable.  For example, I can add 5 lines of code in my Flex 1.5 apps, and make them work as executable applications.  If you used ExternalInterface, you couldn't do that.
 
Third, ExternalInterface blocks.  While this could be viewed as a nice thing by Win32/fat client developers, it is actually a bottleneck.  It doesn't scale; meaning, if a process takes 20 seconds, so to will your app not do anything for 20 seconds.  LocalConnection is asynchronous, and Flash Developers (and soon to be Flex developers) are used to this style of development: register for an event, do something, act on the response.  In the meantime, you can do other stuff like play animations, have the user do other things in the app, etc.  The process in the other app has no direct impact on the app making the call.  If, however, you're Flex app you are talking to is having a recursion puke... well, that's an indirect impact, but you can't really control that; bad code is bad code.  Fix it.
 
Fourth, security.  ExternalInterface has more tendrils in the browser, and thus is bound by the weird (weird to me) security restrictions a browser places on it, like iframes, etc.  LocalConnection follows the standard rules of Flash Player.  Easier to debug, and easier to fix via crossdomain.xml, and underscore's in front of the name.
 
Bottom line, you can still control SWF's that you embed that are Flash 8, they are just stripped of code; they still retain their labels.  Additionally, as I've said before, plans by various individuals are in the works for utilizing Socket to communicate to these SWF's.  In the meantime, LocalConnection enforced via Interfaces is your best bet.
 
 
----- Original Message -----
Sent: Tuesday, July 18, 2006 12:18 PM
Subject: Re: [flexcoders] SWF Loader

Hi Jesse,

Would you recommend LocalConnection over ExternalInterface for this type of communication? Just wondering what the pitfalls of using ExternalInterface might be.


On 7/12/06, JesterXL <[EMAIL PROTECTED]> wrote:

Sorry, I posted the wrong link earlier:
----- Original Message -----
Sent: Wednesday, July 12, 2006 9:25 AM
Subject: Re: [flexcoders] SWF Loader

Jester,
 
Does this mean that there is no way of getting a loaded swf to play, pause or stop without using localConnection ?
JL
 
----- Original Message -----
From: JesterXL
Sent: Wednesday, July 12, 2006 3:07 PM
Subject: Re: [flexcoders] SWF Loader

It's an AVM1Movie, not a MovieClip. Unfortunately, this prevents you from
talking to the SWF; you have to use LocalConnection, or some other binary
socket way.

Have you tried with Flash 9 Alpha yet? I haven't had time but I bet this'd
work.

----- Original Message -----
From: "flexnewbie06" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 12, 2006 8:48 AM
Subject: [flexcoders] SWF Loader

I am trying to cast swf as MovieClip in Flex 2.0. The SWF was
created with Flash 8...I get an coercion error...is this something
that can not be done or maybe I am doing it incorrectly.

I have posted the error and my code. Any Suggestions?

TypeError: Error #1034: Type Coercion failed: cannot convert
flash.display::[EMAIL PROTECTED] to flash.display.MovieClip.
at EPlayer/::test()
at EPlayer/___Button1_click()

CODE:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.core.FlexMovieClip;
import mx.controls.SWFLoader;

function test():void{
var myMovieClip:MovieClip = MovieClip(mySWF.content);
myMovieClip.gotoAndPlay(1);
}
]]>
</mx:Script>

<mx:Panel height="406" width="525"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"
y="10" x="10">

<mx:SWFLoader id="mySWF" source="RFP intro.swf" height="338"
width="459"/>

</mx:Panel>

<mx:Button label="test" x="300" y="424" click="test();"/>
</mx:Application>

--
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




--

Derek Vadneau __._,_.___

--
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