OK, I've found some old posts now that I've been pointed that
direction.   

I'm still struggling, though, in one of your old posts you mention
doing something along the following:

  [Embed("SimpleCS3.swf")]
  public var simpleCS3:Class;

and an instance of it called `foo':
  public var foo:DisplayObject;
  private function makeOne():void
  {
    foo = new simpleCS3();
  }

The main class of that swf will end up in `bar' if you do this:
 
var bar:MovieClip =
Loader(DisplayObjectContainer(foo).getChildAt(0)).content;

SO, back to my application:

I'm using a SWFLoader with an id of loadedSWF, and the source set to
the Embeded Class.  on CreationComplete, I bind to the appropraite
Click events inside the SWF, and all works well.

Then inside the click event, I want to access properties on the
embedded SWF.

Now I try something similar to your sample I just found, but I get all
sorts of casting errors, I've tried:
var bar:MovieClip =  DisplayObjectContainer(loadedSWF.content).content
as MovieClip;
and 
var bar:MovieClip =
Loader(DisplayObjectContainer(loadedSWF.content)).content as MovieClip;
and  
var bar:MovieClip = DisplayObjectContainer(loadedSWF.content) as
MovieClip;

I assume that once I get the appriopriate MovieClitp, my call to the
property to get at the ARray will be as simple as movieClip.propertyname?

Thanks,
--Todd

--- In flexcoders@yahoogroups.com, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> An embedded SWF is wrapped in a MovieClipLoader.  There should be
some old threads about how to dig into that to get to the actual SWF
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Todd
> Sent: Tuesday, November 11, 2008 11:37 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Accessing properties of Embedded Flash
SWFs from Flex 3
> 
> 
> From my readings around the web, the Flex compiler strips all timeline
> information from the SWF when embedding. I now have found a suggested
> workaround over at Grant Skinner's Blog, however, it's dependent upon
> all the code written on the timeline being put into a Class (this is
> how I interpreted the workaround).
> 
> I'm going to look into probably using the Flash Component Tooklkit for
> Flex and seeing if the dev can wrap up the Flash stuff into a
> component and seeing where to go from there.
> 
> --- In
flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>,
"Fotis Chatzinikos"
> <fotis.chatzinikos@> wrote:
> >
> > hm, it seems that when embeded the compiler does not have enough
> info to see
> > if your variable is there or not (you mention that loading the swf
> > dynamically works)...
> >
> > I remember reading somewhere in this forum that there is a
compiler flag
> > that makes things less strict and your error would get away, but...
> never
> > used it myself cannot remember the setting search the forum or
> google for it
> >
> > On Tue, Nov 11, 2008 at 8:10 PM, Todd <tprekaski@> wrote:
> >
> > > The "symbol" that I'm trying to get out of Flash is a global Array
> > > defenition, so I'm not sure it's working. I did try embedding the
> > > name of the public global array as a seperate embed.
> > >
> > > I'm not too interested in the Flex Component Kit for Flash, as this
> > > component is already written.
> > >
> > > My main goal is just accessesing the global flash variable from
within
> > > Flex.
> > >
> > > --- In
flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
<flexcoders%40yahoogroups.com>,
> "Amy"
> > > <amyblankenship@> wrote:
> > > >
> > > > --- In
flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
> <flexcoders%40yahoogroups.com>, "Todd"
> > > <tprekaski@> wrote:
> > > > >
> > > > > OK, a little more research tells me that the Flex compiler
> strips out
> > > > > all timeline code from the embedded Flash timeline.
> > > > >
> > > > > So, now my question becomes: How do I expose a property from
FLASH
> > > > > that is accessible from Flex?
> > > >
> > > > I know you've already gotten an answer about the Component Kit,
> but I
> > > > think if you're not doing anything complex, you can just embed the
> > > > symbol from the library. I believe that does respect the
> timeline code.
> > > >
> > > > http://livedocs.adobe.com/flex/3/html/embed_4.html
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Fotis Chatzinikos, Ph.D.
> > Founder,
> > Phinnovation
> > Fotis.Chatzinikos@,
> >
>


Reply via email to