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

Reply via email to