[swfmill] Accessing frames in AS3
Joel Poloney
jpoloney at gmail.com
Mon Nov 12 12:43:17 PST 2007
Another thing:
The swf file generated from the xml file I talked about below is treated as
an AVM1 movie in flex. For example, if I ran swfmill on that xml file and
saved it as out.swf, included it as the following:
<mx:Image id="mySwf" source="http://path.to.my.swf/out.swf">
and accessed it using mySwf.content in a mx:Script block, it shows up as
AVM1. A swf generated through Adobe Flash CS, exported as Flash 9 (AS3),
will show up as AVM2. As far as I know, you can't access the individual
frames of AVM1 content in AS3. You can just stop and play (and maybe some
other basic controls).
Thoughts?
-- Joel
On Nov 12, 2007 11:38 AM, Joel Poloney <jpoloney at gmail.com> wrote:
> Ok, I'm beginning to understand this a little better now. As for swfmill,
> here's a sample of the xml that I was using to generate the swf:
>
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <movie width="768" height="576" framerate="12" version="9">
> <background color="#FFFFFF"/>
> <frame name="img1">
> <library>
> <clip id="img1" import="img1.png"/>
> </library>
> <place id="img1" name="clipImg1" depth="1"/>
> </frame>
> <frame name="img2">
> <library>
> <clip id="img2" import="img2.png"/>
> </library>
> <place id="img2" name="img2" depth="1"/>
> </frame>
> </movie>
>
> Is this the wrong approach? I was going through the docs on the swfmill
> wiki and put this together from that.
>
> The way I was loading the swfs in before is by using var movie:MovieClip =
> event.target.content in the callback function. This will work with a flash
> 9 swf that was exported as a movie in Adobe Flash CS. I'm thinking that my
> xml file for swfmill isn't correct. Any help there?
>
> Sorry about all of the newbie questions. I've just learned about swfmill
> and AS3 is a whole new ballgame from previous versions. I appreciate all of
> the help.
>
> -- Joel
>
>
> On Nov 12, 2007 11:25 AM, Trevor Burton <trevor.burton at virtuefusion.com>
> wrote:
>
> > Sorry, this wasn't clear...
> >
> > I suggested you put your frames in a MovieClip in order that you can
> > access them once the swf has loaded.... this is just a personal preference
> > as i think it makes things easier - there are other ways to do it.
> >
> > when your swf has loaded you can instantiate the FramesClip using the
> > 'getDefinition' or getDefinitionByName calls to instantiate the FramesClip
> > class because the swf that's loading it doesn't have any reference to the
> > FramesClip class. so you can't just do
> >
> > new FramesClip();
> >
> > it just instantiates the class from it's qualified classname - you can
> > treat it as a MovieClip and do your gotoAndPlay/Stop calls on it. I'm not
> > sure how you'd give it the classname in swfmill - cause i've not used
> > swfmill for compiling AS3 swfs.
> >
> > If that's a problem the alternative is to have your content on the main
> > timeline of the swf that's being loaded and then attach the Loader object to
> > the displaylist (either before the load starts or after it's completed).
> > Loader extends DisplayObject so you can addChild() it. this should mean that
> > your content is visible as soon as the load's complete (or as soon as it's
> > attached after the load is complete). But i'm not sure how you'd handle
> > controlling the timeline from there as i don't use this technique myself...
> > you should be able to work it out fairly easily though.
> >
> > the Event that's passed to your loadComplete handler contains
> > information about the Loader that fired it - so you can do
> >
> > var loader:Loader = event.target as Loader;
> >
> > to get the loader object
> >
> > -------------------------
> > Trevor Burton
> > Flash Developer
> > VirtueFusion
> > 14-16 Betterton Street
> > London, WC2H 9AH
> > t: 0207 420 6420
> > m: 07954 239 024
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/swfmill_osflash.org/attachments/20071112/f70e68bf/attachment.html
More information about the swfmill
mailing list