RE: [flexcoders] Re: Accessing properties of Embedded Flash SWFs from Flex 3

2008-11-12 Thread Tracy Spratt
In an event handler, does event.target not return a reference to the
dispatching object?

 

Then parentDocument or parentApplication to the root scope?

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Todd
Sent: Wednesday, November 12, 2008 4:05 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Accessing properties of Embedded Flash SWFs
from Flex 3

 

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 mailto:flexcoders%40yahoogroups.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:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
]
On Behalf Of Todd
 Sent: Tuesday, November 11, 2008 11:37 AM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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
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
mailto:flexcoders%40yahoogroups.com
flexcoders%40yahoogroups.com,
 Amy
   amyblankenship@ wrote:
   
--- In
flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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
http://livedocs.adobe.com/flex/3/html/embed_4.html 
   
  
  
  
 
 
 
  --
  Fotis Chatzinikos, Ph.D.
  Founder,
  Phinnovation
  Fotis.Chatzinikos@,
 


 



RE: [flexcoders] Re: Accessing properties of Embedded Flash SWFs from Flex 3

2008-11-11 Thread Subeesh
Hi,

 

You can use Flex Component Kit to create contents from Flash which can be
used as components in Flex

 

Take a look at this link

 

http://blog.flexexamples.com/2007/09/02/installing-the-flex-component-kit-fo
r-flash-cs3/

 

Subeesh

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Todd
Sent: Tuesday, November 11, 2008 10:40 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Accessing properties of Embedded Flash SWFs from
Flex 3

 

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? 

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ,
Todd [EMAIL PROTECTED] wrote:

 Hello All,
 The Flex docs aren't really clear on this, but I'm wondering if it's
 possible to EMBED a SWF written for Flash 9 into a Flex 3 application,
 and then access some properties on it, methods, and click events from
 it. Right now, I get an error:
 
 ReferenceError: Error #1069: Property foo_test not found on
 embedded_asset_object and there is no default value.
 
 I'm using mx:SWFLoader with an id of loadedSWF and some code that
 looks like:
 
 loadedSWFMainTimeline = loadedSWF.content; 
 testProperty = loadedSWFMainTimeline.testProperty; 
 
 Poof Error!
 
 I've also tried casting the loadedSWF.content to Objects and the
 dataClass (which wasn't right)
 loadedSWFMainTimeline = (loadedSWF.content as Object).dataClass;
 testProperty = loadedSWFMainTimeline.testProperty; 
 
 Any ideas? The Flex documentation alludes that this won't work for
 SWFs compiled to Flash Player 8 or earlier, but doesn't really
 mention, nor have samples for FP 9+


 



Re: [flexcoders] Re: Accessing properties of Embedded Flash SWFs from Flex 3

2008-11-11 Thread Fotis Chatzinikos
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 [EMAIL PROTECTED] 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 flexcoders%40yahoogroups.com, Amy
 [EMAIL PROTECTED] wrote:
 
  --- In flexcoders@yahoogroups.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
[EMAIL PROTECTED],


RE: [flexcoders] Re: Accessing properties of Embedded Flash SWFs from Flex 3

2008-11-11 Thread Alex Harui
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.commailto:flexcoders%40yahoogroups.com, Fotis 
Chatzinikos
[EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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.commailto:flexcoders%40yahoogroups.com 
  flexcoders%40yahoogroups.com,
Amy
  amyblankenship@ wrote:
  
   --- In flexcoders@yahoogroups.commailto: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
 [EMAIL PROTECTED],