Roger,

Thank you.  I managed to get it to work.  I had tried referencing the
class as the source yesterday, but must have forgotten to wrap the
class name in {} as it didn't work then (feeling sheepish).  However,
it works now.  So here's the final solution:

//MyMovieAsset.as
package
{
        import flash.display.MovieClip;
        [Embed(source='assets/splashhowto.swf')]
        public class MyMovieAsset extends MovieClip
        {       
        }
}

//MyApp.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"; xmlns="*">
        <mx:Image source="{MyMovieAsset}" />
</mx:Application>


Thanks all for their help.

Brendan


--- In [email protected], "Roger Gonzalez" <[EMAIL PROTECTED]> wrote:
>
> Hrm, no, not a bug.  I thought MXML containers could add
> IFlexDisplayObjects as children, but I'm wrong.
> 
> Basically, the strategy works fine for AS apps, but when working with
> the frameworks...
> 
> Try making an Image and setting its source to the class object.  That
> should work, although it may not be what you want.
> 
> If you want it dynamic, you'll have to make a new base class that
> implements IUIComponent and does your Embed.  No big deal, jsut one more
> step.  Somebody else will have to help with the IUIComponent details,
> though!
> 
> -rg
> 
> > -----Original Message-----
> > From: [email protected] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of Brendan Meutzner
> > Sent: Tuesday, January 10, 2006 10:02 AM
> > To: [email protected]
> > Subject: [flexcoders] Re: Multi frame swfs not playing
> > 
> > Is this behaviour a bug then?  Should I be implementing it a different
> > way?
> > 
> > 
> > 
> > --- In [email protected], "Brendan Meutzner" <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > Hi Roger,
> > > 
> > > Well, that get's me one step closer.  If I extend MyMovieAsset from
> > > either MovieClip or SkinMovieClip it gives me the following RTE
> > > 
> > > "TypeError: Error #1034: Type Coersion failed: cannot convert
> > > [EMAIL PROTECTED] to mx.core.IUIComponent"
> > > 
> > > However, if I continue to load, the swf loads properly and plays
> > properly.
> > > 
> > > This occurs when I declare it as an MXML child tag and also when i
> > > load it via ActionScript.
> > > 
> > > Also, I get a compile time error saying that SkinMovieClip's class
> > > definition is not found (and I can't find it in the docs 
> > anywhere) but
> > > if I ignore, it still loads the swf with the RTE I outlined above.
> > > 
> > > 
> > > Brendan
> > > 
> > > 
> > > --- In [email protected], "Roger Gonzalez" <[EMAIL PROTECTED]>
> > wrote:
> > > >
> > > > If you want to use it directly as a child in MXML, you 
> > might need to
> > > > extend mx.core.SkinMovieClip instead of flash.display.MovieClip.
> > > > Otherwise I think the frameworks will throw an RTE about your
> > asset not
> > > > extending IFlexDisplayObject.
> > > > 
> > > > Otherwise, try it in ActionScript, via "addChild( new
> > MyMovieAsset() )".
> > > > 
> > > > % mxmlc -keep-generated-actionscript yourapp.mxml
> > > > 
> > > > Zorn has a dialog somewhere for extra command-line arguments, if
> > you're
> > > > not using mxmlc.
> > > > 
> > > > Cheers,
> > > > 
> > > > -rg
> > > > 
> > > > > -----Original Message-----
> > > > > From: [email protected] 
> > > > > [mailto:[EMAIL PROTECTED] On Behalf Of 
> > Brendan Meutzner
> > > > > Sent: Monday, January 09, 2006 9:07 AM
> > > > > To: [email protected]
> > > > > Subject: [flexcoders] Re: Multi frame swfs not playing
> > > > > 
> > > > > Hi Roger,
> > > > > 
> > > > > Can I confirm the following usage you've suggested:
> > > > > 
> > > > > //MyMovieAsset.as
> > > > > package
> > > > > {
> > > > >       import flash.display.MovieClip;
> > > > >       
> > > > >       [Embed('assets/cube.swf')]
> > > > >       public class MyMovieAsset extends MovieClip 
> > > > >       {       
> > > > >       }
> > > > > }
> > > > > 
> > > > > //MyMXML.mxml
> > > > > <?xml version="1.0" encoding="utf-8"?>
> > > > > <mx:Application 
> > > > > xmlns:mx="http://www.macromedia.com/2005/mxml"; xmlns="*">
> > > > > 
> > > > > <MyMovieAsset id="cube_image" />
> > > > > 
> > > > > </mx:Application>
> > > > > 
> > > > > 
> > > > > I have nothing displaying when I try the above two files.  Am I
> > doing
> > > > > this properly?  I found this reference document (which 
> > I might add
> > > > > provides a bit of info on whether to define as String 
> > vs. Class) but
> > > > > it doesn't provide a good example for what you suggest.
> > > > > 
> > > > > http://livedocs.macromedia.com/labs/1/flex/00001571.html
> > > > > 
> > > > > Also, how do you turn on the 
> > keep-generated-actionscript for Flex 2?
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Brendan
> > > > > 
> > > > > 
> > > > > 
> > > > > --- In [email protected], "Roger Gonzalez" 
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Ok, the issue may be the base class wrapped around the 
> > > > > embedded asset.
> > > > > > 
> > > > > > Basically, your asset will need to be associated with a 
> > > > > class deriving
> > > > > > from MovieClip.  In theory, it should figure this out on 
> > > > > its own.  (Turn
> > > > > > keep-generated-actionscript on and check out the class 
> > > > > associated with
> > > > > > your asset.  Is it Sprite or MovieClip?)
> > > > > > 
> > > > > > Anywho, if it is only Sprite, you can force it to extend 
> > > > > MovieClip by
> > > > > > doing a class-level embed:
> > > > > > 
> > > > > > // MyMovieAsset.as
> > > > > > 
> > > > > > package {
> > > > > > import flash.display.MovieClip
> > > > > > [Embed(source='mymovie.swf', symbol='assetname')]
> > > > > > public class MyMovieAsset extends MovieClip
> > > > > > {
> > > > > > } 
> > > > > > }
> > > > > > 
> > > > > > If that doesn't work, please file a bug report!
> > > > > > 
> > > > > > (Note: if there are any AS actions on your movie, 
> > we're currently
> > > > > > stripping them out and throwing them away, because its 
> > > > > illegal to mix
> > > > > > AS2 and AS3 code in one SWF.  I have a bug on my plate to 
> > > > > try to handle
> > > > > > this... better.  I'm not sure quite what I'm going to 
> > do, because
> > > > > > transcoding the bytecode seems like a nightmare project!  I 
> > > > > might just
> > > > > > handle some SWF4-compatible subset, i.e. gotoframe, stop, etc.
> > > > > > Workaround for now is to load AS2 SWFs dynamically at 
> > runtime.)
> > > > > > 
> > > > > > -rg
> > > > > > 
> > > > > > 
> > > > > > > -----Original Message-----
> > > > > > > From: [email protected] 
> > > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of Brendan
> > Meutzner
> > > > > > > Sent: Monday, January 09, 2006 7:34 AM
> > > > > > > To: [email protected]
> > > > > > > Subject: [flexcoders] Re: Multi frame swfs not playing
> > > > > > > 
> > > > > > > Embedded.
> > > > > > > 
> > > > > > > 
> > > > > > > --- In [email protected], "Roger Gonzalez" 
> > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > Are you dynamically loading the SWF, or embedding it?
> > > > > > > > 
> > > > > > > > -rg
> > > > > > > > 
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: [email protected]
> > > > > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of 
> > > > > Brendan Meutzner
> > > > > > > > > Sent: Monday, January 09, 2006 5:22 AM
> > > > > > > > > To: [email protected]
> > > > > > > > > Subject: [flexcoders] Multi frame swfs not playing
> > > > > > > > > 
> > > > > > > > > Hi All,
> > > > > > > > > 
> > > > > > > > > When I load a swf movie into a Flex 2 app, it's not 
> > > > > > > playing the movie.
> > > > > > > > >  It loads in the first frame, but just freezes there.  
> > > > > > > The same swf 
> > > > > > > > > movie loaded into a 1.5 app plays properly.
> > > > > > > > > 
> > > > > > > > > We're talking about a very basic multi-frame 
> > swf with no 
> > > > > > > components 
> > > > > > > > > or actionscript embedded.
> > > > > > > > > 
> > > > > > > > > Is there a way to initiate playback of the swf file 
> > > > > once loaded?
> > > > > > > > > 
> > > > > > > > > Thanks,
> > > > > > > > > 
> > > > > > > > > Brendan
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > --
> > > > > > > > > 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
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > >  
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > >
> > > > > > > >
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > --
> > > > > > > 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
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > >  
> > > > > > > 
> > > > > > > 
> > > > > > >
> > > > > >
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > --
> > > > > 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
> > > > > 
> > > > > 
> > > > > 
> > > > >  
> > > > > 
> > > > > 
> > > > >
> > > >
> > >
> > 
> > 
> > 
> > 
> > 
> > 
> > --
> > 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
> > 
> > 
> > 
> >  
> > 
> > 
> >
>






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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to