RE: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-16 Thread Merrill, Jason
>>My understanding from looking around is that with the document class
in Flash 9, 
>>you can only add items to the stage through code. That seems to negate
a lot of the 
>>advantage of using a graphical interface..
 
Remember, it's not really Flash 9, it's really just Flash 8 with a
preview of AS 3.0, even if they are calling it Flash 9 Pro AS3 preview
- Flash 8 with a compiler to compile to Flash 9 player/AS3.  When Flash
9 comes out, I'm sure you'll be able to add items to the stage through
the GUI.  I think they kinda made a mistake calling it "Flash 9 Pro AS3
Preview", it's confused a lot of people.  At least the docs on their
site explain it well. 
 
http://www.adobe.com/devnet/flash/articles/flash9_as3_preview.html
 

Jason Merrill 
Bank of America
Learning & Organizational Effectiveness 
  
  
  
  
  

 




From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of slangeberg
Sent: Friday, February 16, 2007 10:58 PM
    To: flexcoders@yahoogroups.com
    Subject: Re: [flexcoders] Can't we access MovieClips contained
in embedded SWF's?



Mike, 

I tried setting up a document class for Flash 9, but when you
place named items on stage, you get this error:

ReferenceError: Error #1056: Cannot create property square_mc on
com.cpile.flextoflash.FlexToFlashMain .
at
flash.display::Sprite/flash.display:Sprite::constructChildren()
at flash.display::Sprite$iinit()
at flash.display::MovieClip$iinit()
at com.cpile.flextoflash::FlexToFlashMain$iinit()

Adobe guys, is this correct? My understanding from looking
around is that with the document class in Flash 9, you can only add
items to the stage through code. That seems to negate a lot of the
advantage of using a graphical interface... ok, so you could have a clip
in your library that has the stage set up... hmmm that may do it! I'll
write back when I have something. Otherwise, what i have sent is an
effective way to access items on the stage. 

-Scott


On 2/16/07, slangeberg <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

Yeah, sorry. I'm not 100%, but you should be able to
reference your loaded movie by that class type (your document class),
from within Flex. I believe another gentleman referred to that, in this
thread. Hold on, I did it, with a loader... I'll try to attach code. 

The proxy is just a design idea, meaning you define an
interface to your movie in your class, instead of referencing elements
within the movie from Flex. Then, the only thing that will break your
flash / flex connection is to break that interface. For instance, your
map(?) class could have functions like: 

showPlat( id:Object );

where the class implementation can decide what to do
with the call, instead of having your flex app nose through the
contents. That's a good design practice to get into:

'Always code to interfaces, not implementations.' 

Ok, so here's one of those do as I say, deals.. Also, my
implementation may be a bit different here, than what we were talking
about. This was a quick fix to enable custom loading logic, for the
default Flex 2 application loading bar. In this case, I'm actually
assigning the class under the 'linkage' option of my library clip
(progress bar) to point to: com.tc.view.preload.ProgressBarSymbol, and
publishing in Flash 9. Then, when you instantiate the class in Flex 2,
you'll get a direct link. In your case, i would suggest a document
class, for the entire movie.

//I just used this class to enable me to access a
loading bar quick. If this was going to 
//scale / change, I would have defined public methods to
update this view. 
//I swear!!
package com.tc.view.preload
{
import flash.display.*;
import flash.text.TextField;

[Embed(source="/library.swf",
symbol="com.tc.view.preload.ProgressBarSymbol")]
public class ProgressBarSymbol extends Sprite 
{
public var progress_bar:MovieClip;  
public var loading_text:TextField; 
}
}

//And instantiated in Flex 2 by using:

var bar:ProgressBarSymbol = new ProgressBarSymbol(); 
this.addChild( bar ); 

Hope this gives ideas, not

Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-16 Thread slangeberg

Mike,

I tried setting up a document class for Flash 9, but when you place named
items on stage, you get this error:

ReferenceError: Error #1056: Cannot create property square_mc on
com.cpile.flextoflash.FlexToFlashMain.
   at flash.display::Sprite/flash.display:Sprite::constructChildren()
   at flash.display::Sprite$iinit()
   at flash.display::MovieClip$iinit()
   at com.cpile.flextoflash::FlexToFlashMain$iinit()

Adobe guys, is this correct? My understanding from looking around is that
with the document class in Flash 9, you can only add items to the stage
through code. That seems to negate a lot of the advantage of using a
graphical interface... ok, so you could have a clip in your library that has
the stage set up... hmmm that may do it! I'll write back when I have
something. Otherwise, what i have sent is an effective way to access items
on the stage.

-Scott

On 2/16/07, slangeberg <[EMAIL PROTECTED]> wrote:


Yeah, sorry. I'm not 100%, but you should be able to reference your loaded
movie by that class type (your document class), from within Flex. I believe
another gentleman referred to that, in this thread. Hold on, I did it, with
a loader... I'll try to attach code.

The proxy is just a design idea, meaning you define an interface to your
movie in your class, instead of referencing elements within the movie from
Flex. Then, the only thing that will break your flash / flex connection is
to break that interface. For instance, your map(?) class could have
functions like:

showPlat( id:Object );

where the class implementation can decide what to do with the call,
instead of having your flex app nose through the contents. That's a good
design practice to get into:

'Always code to interfaces, not implementations.'

Ok, so here's one of those do as I say, deals.. Also, my implementation
may be a bit different here, than what we were talking about. This was a
quick fix to enable custom loading logic, for the default Flex 2 application
loading bar. In this case, I'm actually assigning the class under the
'linkage' option of my library clip (progress bar) to point to:
com.tc.view.preload.ProgressBarSymbol, and publishing in Flash 9. Then,
when you instantiate the class in Flex 2, you'll get a direct link. In your
case, i would suggest a document class, for the entire movie.

//I just used this class to enable me to access a loading bar quick. If
this was going to
//scale / change, I would have defined public methods to update this view.

//I swear!!
package com.tc.view.preload
{
import flash.display.*;
import flash.text.TextField;

[Embed(source="/library.swf", symbol="
com.tc.view.preload.ProgressBarSymbol")]
public class ProgressBarSymbol extends Sprite
{
public var progress_bar:MovieClip;
public var loading_text:TextField;
}
}

//And instantiated in Flex 2 by using:

var bar:ProgressBarSymbol = new ProgressBarSymbol();
this.addChild( bar );

Hope this gives ideas, not confusion!

-Scott

On 2/16/07, Mike Anderson < [EMAIL PROTECTED]> wrote:
>
>Hello Scott (in particular) :)
>
> You mentioned a "Proxy" - what you do mean by this exactly?
>
> Is this supposed to be some custom class that I write?  If so, what is
> supposed to be contained within it?
>
> I did read up on the Document Object, and I am now doing my Flash 9 FLA
> files with a custom Document Class, representing the Root Timeline.  I am
> pretty sure I did it right, since I am getting no compile errors.
>
> But my question is, is the AS3 Class File I used for the Document
> Object, strictly used for the FLA file?  Or is this also used inside of Flex
> Builder, after I bring the external SWF file in?
>
> This is where I am getting a little confused.
>
> All the articles I find on this topic, covers the Flash side of things -
> and they never take that next step, and tell you how to reference it inside
> of Flex.
>
> If you have anything else on this topic, I'd really be grateful for your
> help.
>
> Thanks,
>
> Mike
>
>  ------
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *slangeberg
> *Sent:* Wednesday, February 14, 2007 10:53 AM
> *To:* flexcoders@yahoogroups.com
> *Subject:* Re: [flexcoders] Can't we access MovieClips contained in
> embedded SWF's?
>
> If you are using Flash 9, you can use a document class (I believe) at
> the root level and have Flex reference it by that. Your document class would
> set up an API, so you don't have to peer into the movie itself. Basically a
> proxy. Sorry I don't have the implementation in front of me, but I believe
> it's possible.
>
> So, if previous code was correct, could do something like:
>
> var platProxy:YourProxy = platObject.getChil

Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-16 Thread slangeberg

Yeah, sorry. I'm not 100%, but you should be able to reference your loaded
movie by that class type (your document class), from within Flex. I believe
another gentleman referred to that, in this thread. Hold on, I did it, with
a loader... I'll try to attach code.

The proxy is just a design idea, meaning you define an interface to your
movie in your class, instead of referencing elements within the movie from
Flex. Then, the only thing that will break your flash / flex connection is
to break that interface. For instance, your map(?) class could have
functions like:

showPlat( id:Object );

where the class implementation can decide what to do with the call, instead
of having your flex app nose through the contents. That's a good design
practice to get into:

'Always code to interfaces, not implementations.'

Ok, so here's one of those do as I say, deals.. Also, my implementation may
be a bit different here, than what we were talking about. This was a quick
fix to enable custom loading logic, for the default Flex 2 application
loading bar. In this case, I'm actually assigning the class under the
'linkage' option of my library clip (progress bar) to point to:
com.tc.view.preload.ProgressBarSymbol, and publishing in Flash 9. Then, when
you instantiate the class in Flex 2, you'll get a direct link. In your case,
i would suggest a document class, for the entire movie.

//I just used this class to enable me to access a loading bar quick. If this
was going to
//scale / change, I would have defined public methods to update this view.
//I swear!!
package com.tc.view.preload
{
   import flash.display.*;
   import flash.text.TextField;

   [Embed(source="/library.swf", symbol="
com.tc.view.preload.ProgressBarSymbol")]
   public class ProgressBarSymbol extends Sprite
   {
   public var progress_bar:MovieClip;
   public var loading_text:TextField;
   }
}

//And instantiated in Flex 2 by using:

var bar:ProgressBarSymbol = new ProgressBarSymbol();
this.addChild( bar );

Hope this gives ideas, not confusion!

-Scott

On 2/16/07, Mike Anderson <[EMAIL PROTECTED]> wrote:


   Hello Scott (in particular) :)

You mentioned a "Proxy" - what you do mean by this exactly?

Is this supposed to be some custom class that I write?  If so, what is
supposed to be contained within it?

I did read up on the Document Object, and I am now doing my Flash 9 FLA
files with a custom Document Class, representing the Root Timeline.  I am
pretty sure I did it right, since I am getting no compile errors.

But my question is, is the AS3 Class File I used for the Document Object,
strictly used for the FLA file?  Or is this also used inside of Flex
Builder, after I bring the external SWF file in?

This is where I am getting a little confused.

All the articles I find on this topic, covers the Flash side of things -
and they never take that next step, and tell you how to reference it inside
of Flex.

If you have anything else on this topic, I'd really be grateful for your
help.

Thanks,

Mike

 --
*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *slangeberg
*Sent:* Wednesday, February 14, 2007 10:53 AM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?

If you are using Flash 9, you can use a document class (I believe) at the
root level and have Flex reference it by that. Your document class would set
up an API, so you don't have to peer into the movie itself. Basically a
proxy. Sorry I don't have the implementation in front of me, but I believe
it's possible.

So, if previous code was correct, could do something like:

var platProxy:YourProxy = platObject.getChildByName('instancename') as
YourProxy
platProxy.hideAll();
platProxy.showByID( {id:'plat_xxx'} );

Just an idea!

-Scott

On 2/14/07, Mike Anderson <[EMAIL PROTECTED]> wrote:
>
>Oh man, you are kidding me!
>
> See, this particular SWF is a Plat Overview of a subdivision - and there
> are 140 Lots, each individually defined as a unique MovieClip.
>
> So, if I need access to each MovieClip programmatically, I will have to
> define 140 variables?
>
> Now that would be a bummer :-(
>
> Could you clarify on that?
>
> Thank you for the information nevertheless - I was actually going to try
> the getChild method next, so that saves me some time.
>
> Mike
>
>  ----------
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Matt Wicks
> *Sent:* Wednesday, February 14, 2007 10:18 AM
> *To:* flexcoders@yahoogroups.com
> *Subject:* Re: [flexcoders] Can't we access MovieClips contained in
> embedded SWF's?
>
>  You need to get the object as a display object
> var xxx:MovieClip = platObject.getChil

RE: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-16 Thread Mike Anderson
Hello Scott (in particular) :)
 
You mentioned a "Proxy" - what you do mean by this exactly?
 
Is this supposed to be some custom class that I write?  If so, what is
supposed to be contained within it?
 
I did read up on the Document Object, and I am now doing my Flash 9 FLA
files with a custom Document Class, representing the Root Timeline.  I
am pretty sure I did it right, since I am getting no compile errors.
 
But my question is, is the AS3 Class File I used for the Document
Object, strictly used for the FLA file?  Or is this also used inside of
Flex Builder, after I bring the external SWF file in?
 
This is where I am getting a little confused.
 
All the articles I find on this topic, covers the Flash side of things -
and they never take that next step, and tell you how to reference it
inside of Flex.
 
If you have anything else on this topic, I'd really be grateful for your
help.
 
Thanks,
 
Mike



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of slangeberg
Sent: Wednesday, February 14, 2007 10:53 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?


If you are using Flash 9, you can use a document class (I believe) at
the root level and have Flex reference it by that. Your document class
would set up an API, so you don't have to peer into the movie itself.
Basically a proxy. Sorry I don't have the implementation in front of me,
but I believe it's possible. 

So, if previous code was correct, could do something like:

var platProxy:YourProxy = platObject.getChildByName('instancename') as
YourProxy
platProxy.hideAll();
platProxy.showByID( {id:'plat_xxx'} ); 

Just an idea!

-Scott


On 2/14/07, Mike Anderson <[EMAIL PROTECTED]> wrote: 



Oh man, you are kidding me!
 
See, this particular SWF is a Plat Overview of a subdivision -
and there are 140 Lots, each individually defined as a unique MovieClip.
 
So, if I need access to each MovieClip programmatically, I will
have to define 140 variables?
 
Now that would be a bummer :-(
 
Could you clarify on that?
 
Thank you for the information nevertheless - I was actually
going to try the getChild method next, so that saves me some time.
 
Mike



From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Wicks
Sent: Wednesday, February 14, 2007 10:18 AM
    To: flexcoders@yahoogroups.com
    Subject: Re: [flexcoders] Can't we access MovieClips contained
in embedded SWF's?



You need to get the object as a display object  

var xxx:MovieClip = platObject.getChildByName('instancename') as
MovieClip

Matt
On 14 Feb 2007, at 16:13, Mike Anderson wrote:




Hello all,

I have a Flash Player 9, AS3 version of a SWF that I am
bringing into
Flex, using the SWFLoader Component.

Once I bring the SWF in, I am creating a MovieClip
variable and
assigning to it, the SWFLoader.content. Here is a quick
code example:

var platObject:MovieClip = mySWFLoader.content;

So once that assignment is made, you can execute certain
built-in
methods available to any Flash Movie - for example:

platObject.play ();
platObject.loaderIn fo.[etc]
And so on...

That is all well and good - but what about MovieClips
that reside in the
Root Timeline? In this particular SWF File, I have a
MovieClip called
"platMovieClip" - and I am trying to access it's
properties and methods
from within Flex. For example, I'd like to toggle the
visibility, so I
tried this code:

platObject.platMovi eClip._visible = false;

When I try this command, I get an error that says "the
property
platMovieClip is unknown" or something to that effect...

If we can't access the assets that reside in SWF Files,
then what is the
whole point of all this? Or maybe there is something
that I am
overlooking - but as far as I can tell, the platObject
should represent
the SWF...

Could any of you shed some light on this topic for me?
This
functionality is VERY important to the success of my
website launch.

Thanks in advance,

Mike













-- 

: : ) Scott  


Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-15 Thread slangeberg

I haven't done much experimentation. I think when I used it, I created
variables on the class that just pointed to items named the same on stage,
so i think you could access those, if declared public. Please let us know
what you find!

+=Scott

On 2/15/07, Mike Anderson <[EMAIL PROTECTED]> wrote:


   A, wonderful!

Okay, with all that said, if I create a custom class, extending lets say a
MovieClip, in any other situation I would have to declare all of my
MovieClips contained within the main Movie, as Public Variables if I hoped
to control them programmatically correct?  You know, just like creating
custom classes within Flex, and in order to access the Controls residing in
the MXML file, you have to create Public Variables with the same names, and
cast them as their proper types (i.e.. Button, Slider, TitleWindow, etc.)
If I am wrong on this, could you correct me? :-)

And if so, it would be because of all these declared Variables, that would
cause them to be exposed & allow me to access them from within Flex correct?

Since we are using AS3 across the board, will Flex then have "native
access" to all the Objects contained within the SWF File?

What I'd love to do, is use Flex Effects and Transitions to control how
the MovieClips that reside on the SWF, behave and interact in the main
application.

In the meantime, I will read up as much as I can on this topic - thanks
again for pointing me in the right direction.

Mike

 --
*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *slangeberg
*Sent:* Thursday, February 15, 2007 11:58 AM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?

 Cool new feature of Flash Professional 9 ActionScript 3 Preview: Document
> Class.
>
> Install Flash 9 Preview, create a new document, and in the Properties
> Panel, you'll see a new field, "Document Class". You can enter the name of
> an AS3 class here, as long as it's in your class path, and it will serve as
> the main class of your swf. The class you uses must extend MovieClip or
> Sprite (or something else that extends one of those).
>
src: http://www.bit-101.com/blog/?p=820
also:
http://www.google.com/search?q=flash+9+document+class&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a

Very easy to set up. From Flash 9:

New document -> File ->Publish Settings -> Flash (tab) -> AS version -
Settings (button) -> Document Class: Enter full class definition (w package)
pointing to your class that extends Sprite or MovieClip (i believe).

This class becomes your main interface to movie.

-Scott

On 2/15/07, Mike Anderson <[EMAIL PROTECTED]> wrote:
>
>Hey guys,
>
> Could you elaborate more on the Document Class, or maybe post some code
> snippets demonstrating how this all works?  I am really not familiar with
> that whole topic, but it sounds like this is what I am looking for.
>
> Thanks in advance for your help,
>
> Mike
>
>  --
> *From:* flexcoders@yahoogroups.com [mailto:flexcoders@ yahoogroups.com]
> *On Behalf Of *slangeberg
> *Sent:* Wednesday, February 14, 2007 10:53 AM
> *To:* flexcoders@yahoogroups.com
> *Subject:* Re: [flexcoders] Can't we access MovieClips contained in
> embedded SWF's?
>
>  If you are using Flash 9, you can use a document class (I believe) at
> the root level and have Flex reference it by that. Your document class would
> set up an API, so you don't have to peer into the movie itself. Basically a
> proxy. Sorry I don't have the implementation in front of me, but I believe
> it's possible.
>
> So, if previous code was correct, could do something like:
>
> var platProxy:YourProxy = platObject.getChildByName('instancename') as
> YourProxy
> platProxy.hideAll();
> platProxy.showByID( {id:'plat_xxx'} );
>
> Just an idea!
>
> -Scott
>
> On 2/14/07, Mike Anderson <[EMAIL PROTECTED]> wrote:
> >
> >   Oh man, you are kidding me!
> >
> > See, this particular SWF is a Plat Overview of a subdivision - and
> > there are 140 Lots, each individually defined as a unique MovieClip.
> >
> > So, if I need access to each MovieClip programmatically, I will have
> > to define 140 variables?
> >
> > Now that would be a bummer :-(
> >
> > Could you clarify on that?
> >
> > Thank you for the information nevertheless - I was actually going to
> > try the getChild method next, so that saves me some time.
> >
> > Mike
> >
> >  --
> > *From:* flexcoders@yahoogroups.com [mailto: [EMAIL PROTECTED]
> > *On Behalf Of *Matt Wicks
>

RE: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-15 Thread Mike Anderson
A, wonderful!
 
Okay, with all that said, if I create a custom class, extending lets say
a MovieClip, in any other situation I would have to declare all of my
MovieClips contained within the main Movie, as Public Variables if I
hoped to control them programmatically correct?  You know, just like
creating custom classes within Flex, and in order to access the Controls
residing in the MXML file, you have to create Public Variables with the
same names, and cast them as their proper types (i.e.. Button, Slider,
TitleWindow, etc.)  If I am wrong on this, could you correct me? :-)
 
And if so, it would be because of all these declared Variables, that
would cause them to be exposed & allow me to access them from within
Flex correct?
 
Since we are using AS3 across the board, will Flex then have "native
access" to all the Objects contained within the SWF File?
 
What I'd love to do, is use Flex Effects and Transitions to control how
the MovieClips that reside on the SWF, behave and interact in the main
application.
 
In the meantime, I will read up as much as I can on this topic - thanks
again for pointing me in the right direction.
 
Mike



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of slangeberg
Sent: Thursday, February 15, 2007 11:58 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?



Cool new feature of Flash Professional 9 ActionScript 3 Preview:
Document Class.

Install Flash 9 Preview, create a new document, and in the
Properties Panel, you'll see a new field, "Document Class". You can
enter the name of an AS3 class here, as long as it's in your class path,
and it will serve as the main class of your swf. The class you uses must
extend MovieClip or Sprite (or something else that extends one of
those).

src: http://www.bit-101.com/blog/?p=820
also:
http://www.google.com/search?q=flash+9+document+class&ie=utf-8&oe=utf-8&;
rls=org.mozilla:en-US:official&client=firefox-a

Very easy to set up. From Flash 9:

New document -> File ->Publish Settings -> Flash (tab) -> AS version -
Settings (button) -> Document Class: Enter full class definition (w
package) pointing to your class that extends Sprite or MovieClip (i
believe). 

This class becomes your main interface to movie.

-Scott


On 2/15/07, Mike Anderson <[EMAIL PROTECTED]> wrote: 



Hey guys,
 
Could you elaborate more on the Document Class, or maybe post
some code snippets demonstrating how this all works?  I am really not
familiar with that whole topic, but it sounds like this is what I am
looking for.
 
Thanks in advance for your help,
 
Mike



From: flexcoders@yahoogroups.com [mailto:flexcoders@
yahoogroups.com <http://yahoogroups.com> ] On Behalf Of slangeberg
Sent: Wednesday, February 14, 2007 10:53 AM 
    
To: flexcoders@yahoogroups.com 
Subject: Re: [flexcoders] Can't we access MovieClips contained
in embedded SWF's?



If you are using Flash 9, you can use a document class (I
believe) at the root level and have Flex reference it by that. Your
document class would set up an API, so you don't have to peer into the
movie itself. Basically a proxy. Sorry I don't have the implementation
in front of me, but I believe it's possible. 

So, if previous code was correct, could do something like:

var platProxy:YourProxy =
platObject.getChildByName('instancename') as YourProxy
platProxy.hideAll();
platProxy.showByID( {id:'plat_xxx'} ); 

Just an idea!

-Scott


On 2/14/07, Mike Anderson <[EMAIL PROTECTED]> wrote: 



Oh man, you are kidding me!
 
See, this particular SWF is a Plat Overview of a
subdivision - and there are 140 Lots, each individually defined as a
unique MovieClip.
 
So, if I need access to each MovieClip programmatically,
I will have to define 140 variables?
 
Now that would be a bummer :-(
 
Could you clarify on that?
 
Thank you for the information nevertheless - I was
actually going to try the getChild method next, so that saves me some
time.
 
Mike



From: flexcoders@yahoogroups.com [mailto: flexcoders@
<mailto:flexcoders@> yahoogroups.com] On Behalf Of Matt Wicks
        Sent: Wednesday, February 14, 2007 10:18 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we

Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-15 Thread slangeberg


Cool new feature of Flash Professional 9 ActionScript 3 Preview: Document
Class.

Install Flash 9 Preview, create a new document, and in the Properties
Panel, you'll see a new field, "Document Class". You can enter the name of
an AS3 class here, as long as it's in your class path, and it will serve as
the main class of your swf. The class you uses must extend MovieClip or
Sprite (or something else that extends one of those).


src: http://www.bit-101.com/blog/?p=820
also:
http://www.google.com/search?q=flash+9+document+class&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a

Very easy to set up. From Flash 9:

New document -> File ->Publish Settings -> Flash (tab) -> AS version -
Settings (button) -> Document Class: Enter full class definition (w package)
pointing to your class that extends Sprite or MovieClip (i believe).

This class becomes your main interface to movie.

-Scott

On 2/15/07, Mike Anderson <[EMAIL PROTECTED]> wrote:


   Hey guys,

Could you elaborate more on the Document Class, or maybe post some code
snippets demonstrating how this all works?  I am really not familiar with
that whole topic, but it sounds like this is what I am looking for.

Thanks in advance for your help,

Mike

 --
*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *slangeberg
*Sent:* Wednesday, February 14, 2007 10:53 AM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?

If you are using Flash 9, you can use a document class (I believe) at the
root level and have Flex reference it by that. Your document class would set
up an API, so you don't have to peer into the movie itself. Basically a
proxy. Sorry I don't have the implementation in front of me, but I believe
it's possible.

So, if previous code was correct, could do something like:

var platProxy:YourProxy = platObject.getChildByName('instancename') as
YourProxy
platProxy.hideAll();
platProxy.showByID( {id:'plat_xxx'} );

Just an idea!

-Scott

On 2/14/07, Mike Anderson <[EMAIL PROTECTED]> wrote:
>
>Oh man, you are kidding me!
>
> See, this particular SWF is a Plat Overview of a subdivision - and there
> are 140 Lots, each individually defined as a unique MovieClip.
>
> So, if I need access to each MovieClip programmatically, I will have to
> define 140 variables?
>
> Now that would be a bummer :-(
>
> Could you clarify on that?
>
> Thank you for the information nevertheless - I was actually going to try
> the getChild method next, so that saves me some time.
>
> Mike
>
>  --
> *From:* flexcoders@yahoogroups.com [mailto: [EMAIL PROTECTED]
> *On Behalf Of *Matt Wicks
> *Sent:* Wednesday, February 14, 2007 10:18 AM
> *To:* flexcoders@yahoogroups.com
> *Subject:* Re: [flexcoders] Can't we access MovieClips contained in
> embedded SWF's?
>
>  You need to get the object as a display object
> var xxx:MovieClip = platObject.getChildByName('instancename') as
> MovieClip
>
> Matt
>  On 14 Feb 2007, at 16:13, Mike Anderson wrote:
>
>   Hello all,
>
> I have a Flash Player 9, AS3 version of a SWF that I am bringing into
> Flex, using the SWFLoader Component.
>
> Once I bring the SWF in, I am creating a MovieClip variable and
> assigning to it, the SWFLoader.content. Here is a quick code example:
>
> var platObject:MovieClip = mySWFLoader.content;
>
> So once that assignment is made, you can execute certain built-in
> methods available to any Flash Movie - for example:
>
> platObject.play ( );
> platObject.loaderIn fo.[etc]
> And so on...
>
> That is all well and good - but what about MovieClips that reside in the
> Root Timeline? In this particular SWF File, I have a MovieClip called
> "platMovieClip" - and I am trying to access it's properties and methods
> from within Flex. For example, I'd like to toggle the visibility, so I
> tried this code:
>
> platObject.platMovi eClip._visible = false;
>
> When I try this command, I get an error that says "the property
> platMovieClip is unknown" or something to that effect...
>
> If we can't access the assets that reside in SWF Files, then what is the
> whole point of all this? Or maybe there is something that I am
> overlooking - but as far as I can tell, the platObject should represent
> the SWF...
>
> Could any of you shed some light on this topic for me? This
> functionality is VERY important to the success of my website launch.
>
> Thanks in advance,
>
> Mike
>
>
>


--

: : ) Scott

 





--

: : ) Scott


RE: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-15 Thread Mike Anderson
Hey guys,
 
Could you elaborate more on the Document Class, or maybe post some code
snippets demonstrating how this all works?  I am really not familiar
with that whole topic, but it sounds like this is what I am looking for.
 
Thanks in advance for your help,
 
Mike



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of slangeberg
Sent: Wednesday, February 14, 2007 10:53 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?


If you are using Flash 9, you can use a document class (I believe) at
the root level and have Flex reference it by that. Your document class
would set up an API, so you don't have to peer into the movie itself.
Basically a proxy. Sorry I don't have the implementation in front of me,
but I believe it's possible. 

So, if previous code was correct, could do something like:

var platProxy:YourProxy = platObject.getChildByName('instancename') as
YourProxy
platProxy.hideAll();
platProxy.showByID( {id:'plat_xxx'} ); 

Just an idea!

-Scott


On 2/14/07, Mike Anderson <[EMAIL PROTECTED]> wrote: 



Oh man, you are kidding me!
 
See, this particular SWF is a Plat Overview of a subdivision -
and there are 140 Lots, each individually defined as a unique MovieClip.
 
So, if I need access to each MovieClip programmatically, I will
have to define 140 variables?
 
Now that would be a bummer :-(
 
Could you clarify on that?
 
Thank you for the information nevertheless - I was actually
going to try the getChild method next, so that saves me some time.
 
Mike



From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Wicks
Sent: Wednesday, February 14, 2007 10:18 AM
    To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained
in embedded SWF's?



You need to get the object as a display object  

var xxx:MovieClip = platObject.getChildByName('instancename') as
MovieClip

Matt
On 14 Feb 2007, at 16:13, Mike Anderson wrote:




Hello all,

I have a Flash Player 9, AS3 version of a SWF that I am
bringing into
Flex, using the SWFLoader Component.

Once I bring the SWF in, I am creating a MovieClip
variable and
assigning to it, the SWFLoader.content. Here is a quick
code example:

var platObject:MovieClip = mySWFLoader.content;

So once that assignment is made, you can execute certain
built-in
methods available to any Flash Movie - for example:

platObject.play ();
platObject.loaderIn fo.[etc]
And so on...

That is all well and good - but what about MovieClips
that reside in the
Root Timeline? In this particular SWF File, I have a
MovieClip called
"platMovieClip" - and I am trying to access it's
properties and methods
from within Flex. For example, I'd like to toggle the
visibility, so I
tried this code:

platObject.platMovi eClip._visible = false;

When I try this command, I get an error that says "the
property
platMovieClip is unknown" or something to that effect...

If we can't access the assets that reside in SWF Files,
then what is the
whole point of all this? Or maybe there is something
that I am
overlooking - but as far as I can tell, the platObject
should represent
the SWF...

Could any of you shed some light on this topic for me?
This
functionality is VERY important to the success of my
website launch.

Thanks in advance,

Mike













-- 

: : ) Scott  


RE: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-15 Thread Mike Anderson
Hey guys,
 
Thanks for the initial help on this - I finally got this to work, at 3am
this morning!
 
Just a quick note to anybody else reading this:  For this FP9, AS3 SWF
thing to work properly, you must use the SWFLoader.load Command.  I was
using a method I saw in a Cairngorm App, where you would bring in all
the Assets using the Embed Metatag, and then casting them as a "Class".
This royally screws things up, and I can only assume that it's because
of the Class casting.
 
So after changing my method to Load, instead of setting the "Source"
property to an already embedded Asset, I could finally gain access to my
named MovieClips defined within the SWF File.
 
Now my next question:  Can I traverse the Document Tree, using the Dot
Notation - if there are more MovieClips, embedded within the MovieClips
I created variables for (using the getChild?
 
Thanks for the info regarding this,
 
Mike



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Matt Wicks
Sent: Wednesday, February 14, 2007 11:17 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?


Temporarily assigning it would probably be best I guess -  especially as
its going to loop through 140 each time -  
Scott's idea is a good one too and should work - might give it a try
later on myself to test it -  but my gut instinct would b e to create a
loop - then you can just use getChildAt(i) to assign the properties ...


matt



On 14 Feb 2007, at 17:05, Mike Anderson wrote:




Well, my goal is this:
 
There will be a ton of interactivity between the Flex variables,
and the Subdivision Plat SWF.  In fact, how the SWF looks visually, and
behaves based on mouse interaction, will all depend on the values
brought back from the database.
 
For example, if a Lot has been sold to a customer, I need to
change the color of the Lot MovieClip to Red.  There are 4 other
possible Statuses, that the Lot could have - and each Status is
represented by a unique color.
 
After the Plat SWF is brought in, the Flex App will loop through
all 140 Lots, and set each corresponding MovieClip color, in addition to
any other information I want shown.  Luckily, in this particular case, I
will have knowledge beforehand based on the database data, as to which
Lots will already pre-exist on the SWF.
 
This is where I need to decide, which parts I should code within
the Flash 9 SWF, and which parts I should code within Flex.  If I had my
choice of course, I'd code everything 100% within Flex.  Bottom line, I
just want to code the bare minimum on the SWF side, so I can
programmatically control everything from within Flex.
 
Anyway, moving on, when the mouse hovers over a Lot, I need to
have some additional information popup - like a ToolTip.  I need the
dimensions, total square footage, and the customer information (if the
Lot has been sold).  In this case, I can just have a custom component
popup, and populate it with the corresponding information from my
ArrayCollection.
 
I just need to find a way, that when the mouse hovers over a
particular Lot on the SWF, to signal Flex which Lot is being hovered
over, so I can grab the appropriate data from the ArrayCollection, and
fill in all the blanks.
 
So with all that said, is there any other methodology you would
use, to accomplish the tasks I mentioned?
 
I suppose I could forego creating 140 variables, and just create
a new one on the fly, each time the mouse hovers over a particular lot.
Then I can grab the corresponding Child, and temporarily assign it to
the Variable - in order to gain access to it's properties and methods.
 
Thanks again for all your help -
 
Mike
 



From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Wicks
Sent: Wednesday, February 14, 2007 10:45 AM
    To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained
in embedded SWF's?


Mike, 


what do the clips need to do?

Matt

On 14 Feb 2007, at 16:36, Mike Anderson wrote:


Plat Overview of a subdivision







 


Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-14 Thread Matt Wicks
Temporarily assigning it would probably be best I guess -  especially  
as its going to loop through 140 each time -
Scott's idea is a good one too and should work - might give it a try  
later on myself to test it -  but my gut instinct would b e to create  
a loop - then you can just use getChildAt(i) to assign the  
properties ...



matt



On 14 Feb 2007, at 17:05, Mike Anderson wrote:



Well, my goal is this:

There will be a ton of interactivity between the Flex variables,  
and the Subdivision Plat SWF.  In fact, how the SWF looks visually,  
and behaves based on mouse interaction, will all depend on the  
values brought back from the database.


For example, if a Lot has been sold to a customer, I need to change  
the color of the Lot MovieClip to Red.  There are 4 other possible  
Statuses, that the Lot could have - and each Status is represented  
by a unique color.


After the Plat SWF is brought in, the Flex App will loop through  
all 140 Lots, and set each corresponding MovieClip color, in  
addition to any other information I want shown.  Luckily, in this  
particular case, I will have knowledge beforehand based on the  
database data, as to which Lots will already pre-exist on the SWF.


This is where I need to decide, which parts I should code within  
the Flash 9 SWF, and which parts I should code within Flex.  If I  
had my choice of course, I'd code everything 100% within Flex.   
Bottom line, I just want to code the bare minimum on the SWF side,  
so I can programmatically control everything from within Flex.


Anyway, moving on, when the mouse hovers over a Lot, I need to have  
some additional information popup - like a ToolTip.  I need the  
dimensions, total square footage, and the customer information (if  
the Lot has been sold).  In this case, I can just have a custom  
component popup, and populate it with the corresponding information  
from my ArrayCollection.


I just need to find a way, that when the mouse hovers over a  
particular Lot on the SWF, to signal Flex which Lot is being  
hovered over, so I can grab the appropriate data from the  
ArrayCollection, and fill in all the blanks.


So with all that said, is there any other methodology you would  
use, to accomplish the tasks I mentioned?


I suppose I could forego creating 140 variables, and just create a  
new one on the fly, each time the mouse hovers over a particular  
lot.  Then I can grab the corresponding Child, and temporarily  
assign it to the Variable - in order to gain access to it's  
properties and methods.


Thanks again for all your help -

Mike


From: flexcoders@yahoogroups.com  
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Wicks

Sent: Wednesday, February 14, 2007 10:45 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained in  
embedded SWF's?


Mike,


what do the clips need to do?

Matt
On 14 Feb 2007, at 16:36, Mike Anderson wrote:


Plat Overview of a subdivision








RE: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-14 Thread Mike Anderson
Well, my goal is this:
 
There will be a ton of interactivity between the Flex variables, and the
Subdivision Plat SWF.  In fact, how the SWF looks visually, and behaves
based on mouse interaction, will all depend on the values brought back
from the database.
 
For example, if a Lot has been sold to a customer, I need to change the
color of the Lot MovieClip to Red.  There are 4 other possible Statuses,
that the Lot could have - and each Status is represented by a unique
color.
 
After the Plat SWF is brought in, the Flex App will loop through all 140
Lots, and set each corresponding MovieClip color, in addition to any
other information I want shown.  Luckily, in this particular case, I
will have knowledge beforehand based on the database data, as to which
Lots will already pre-exist on the SWF.
 
This is where I need to decide, which parts I should code within the
Flash 9 SWF, and which parts I should code within Flex.  If I had my
choice of course, I'd code everything 100% within Flex.  Bottom line, I
just want to code the bare minimum on the SWF side, so I can
programmatically control everything from within Flex.
 
Anyway, moving on, when the mouse hovers over a Lot, I need to have some
additional information popup - like a ToolTip.  I need the dimensions,
total square footage, and the customer information (if the Lot has been
sold).  In this case, I can just have a custom component popup, and
populate it with the corresponding information from my ArrayCollection.
 
I just need to find a way, that when the mouse hovers over a particular
Lot on the SWF, to signal Flex which Lot is being hovered over, so I can
grab the appropriate data from the ArrayCollection, and fill in all the
blanks.
 
So with all that said, is there any other methodology you would use, to
accomplish the tasks I mentioned?
 
I suppose I could forego creating 140 variables, and just create a new
one on the fly, each time the mouse hovers over a particular lot.  Then
I can grab the corresponding Child, and temporarily assign it to the
Variable - in order to gain access to it's properties and methods.
 
Thanks again for all your help -
 
Mike
 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Matt Wicks
Sent: Wednesday, February 14, 2007 10:45 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?


Mike, 


what do the clips need to do?

Matt

On 14 Feb 2007, at 16:36, Mike Anderson wrote:


Plat Overview of a subdivision 


 


Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-14 Thread slangeberg

If you are using Flash 9, you can use a document class (I believe) at the
root level and have Flex reference it by that. Your document class would set
up an API, so you don't have to peer into the movie itself. Basically a
proxy. Sorry I don't have the implementation in front of me, but I believe
it's possible.

So, if previous code was correct, could do something like:

var platProxy:YourProxy = platObject.getChildByName('instancename') as
YourProxy
platProxy.hideAll();
platProxy.showByID( {id:'plat_xxx'} );

Just an idea!

-Scott

On 2/14/07, Mike Anderson <[EMAIL PROTECTED]> wrote:


   Oh man, you are kidding me!

See, this particular SWF is a Plat Overview of a subdivision - and there
are 140 Lots, each individually defined as a unique MovieClip.

So, if I need access to each MovieClip programmatically, I will have to
define 140 variables?

Now that would be a bummer :-(

Could you clarify on that?

Thank you for the information nevertheless - I was actually going to try
the getChild method next, so that saves me some time.

Mike

 --
*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Matt Wicks
*Sent:* Wednesday, February 14, 2007 10:18 AM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?

You need to get the object as a display object
var xxx:MovieClip = platObject.getChildByName('instancename') as MovieClip

Matt
 On 14 Feb 2007, at 16:13, Mike Anderson wrote:

  Hello all,

I have a Flash Player 9, AS3 version of a SWF that I am bringing into
Flex, using the SWFLoader Component.

Once I bring the SWF in, I am creating a MovieClip variable and
assigning to it, the SWFLoader.content. Here is a quick code example:

var platObject:MovieClip = mySWFLoader.content;

So once that assignment is made, you can execute certain built-in
methods available to any Flash Movie - for example:

platObject.play();
platObject.loaderInfo.[etc]
And so on...

That is all well and good - but what about MovieClips that reside in the
Root Timeline? In this particular SWF File, I have a MovieClip called
"platMovieClip" - and I am trying to access it's properties and methods
from within Flex. For example, I'd like to toggle the visibility, so I
tried this code:

platObject.platMovieClip._visible = false;

When I try this command, I get an error that says "the property
platMovieClip is unknown" or something to that effect...

If we can't access the assets that reside in SWF Files, then what is the
whole point of all this? Or maybe there is something that I am
overlooking - but as far as I can tell, the platObject should represent
the SWF...

Could any of you shed some light on this topic for me? This
functionality is VERY important to the success of my website launch.

Thanks in advance,

Mike


 





--

: : ) Scott


Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-14 Thread Matt Wicks

Mike,


what do the clips need to do?

Matt
On 14 Feb 2007, at 16:36, Mike Anderson wrote:


Plat Overview of a subdivision




RE: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-14 Thread Mike Anderson
Oh man, you are kidding me!
 
See, this particular SWF is a Plat Overview of a subdivision - and there
are 140 Lots, each individually defined as a unique MovieClip.
 
So, if I need access to each MovieClip programmatically, I will have to
define 140 variables?
 
Now that would be a bummer :-(
 
Could you clarify on that?
 
Thank you for the information nevertheless - I was actually going to try
the getChild method next, so that saves me some time.
 
Mike



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Matt Wicks
Sent: Wednesday, February 14, 2007 10:18 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Can't we access MovieClips contained in
embedded SWF's?


You need to get the object as a display object  

var xxx:MovieClip = platObject.getChildByName('instancename') as
MovieClip

Matt
On 14 Feb 2007, at 16:13, Mike Anderson wrote:




Hello all,

I have a Flash Player 9, AS3 version of a SWF that I am bringing
into
Flex, using the SWFLoader Component.

Once I bring the SWF in, I am creating a MovieClip variable and
assigning to it, the SWFLoader.content. Here is a quick code
example:

var platObject:MovieClip = mySWFLoader.content;

So once that assignment is made, you can execute certain
built-in
methods available to any Flash Movie - for example:

platObject.play();
platObject.loaderInfo.[etc]
And so on...

That is all well and good - but what about MovieClips that
reside in the
Root Timeline? In this particular SWF File, I have a MovieClip
called
"platMovieClip" - and I am trying to access it's properties and
methods
from within Flex. For example, I'd like to toggle the
visibility, so I
tried this code:

platObject.platMovieClip._visible = false;

When I try this command, I get an error that says "the property
platMovieClip is unknown" or something to that effect...

If we can't access the assets that reside in SWF Files, then
what is the
whole point of all this? Or maybe there is something that I am
overlooking - but as far as I can tell, the platObject should
represent
the SWF...

Could any of you shed some light on this topic for me? This
functionality is VERY important to the success of my website
launch.

Thanks in advance,

Mike





 


Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's?

2007-02-14 Thread Matt Wicks

You need to get the object as a display object

var xxx:MovieClip = platObject.getChildByName('instancename') as  
MovieClip


Matt
On 14 Feb 2007, at 16:13, Mike Anderson wrote:


Hello all,

I have a Flash Player 9, AS3 version of a SWF that I am bringing into
Flex, using the SWFLoader Component.

Once I bring the SWF in, I am creating a MovieClip variable and
assigning to it, the SWFLoader.content. Here is a quick code example:

var platObject:MovieClip = mySWFLoader.content;

So once that assignment is made, you can execute certain built-in
methods available to any Flash Movie - for example:

platObject.play();
platObject.loaderInfo.[etc]
And so on...

That is all well and good - but what about MovieClips that reside  
in the

Root Timeline? In this particular SWF File, I have a MovieClip called
"platMovieClip" - and I am trying to access it's properties and  
methods

from within Flex. For example, I'd like to toggle the visibility, so I
tried this code:

platObject.platMovieClip._visible = false;

When I try this command, I get an error that says "the property
platMovieClip is unknown" or something to that effect...

If we can't access the assets that reside in SWF Files, then what  
is the

whole point of all this? Or maybe there is something that I am
overlooking - but as far as I can tell, the platObject should  
represent

the SWF...

Could any of you shed some light on this topic for me? This
functionality is VERY important to the success of my website launch.

Thanks in advance,

Mike