I'm having a weird problem with using gotoAndStop/gotoAndPlay when
using an SWF output by swfmill.

I'm trying to implement a class that uses movie clips created in
swfmill as button states.  The SWF generated by swfmill will contain a
clip for each button, which contains 4 frames, one for each button
state.  The button class will detect which state it should display,
and do a 'gotoAndStop()' for the frame that represents that state.
Fairly simple stuff.

Here's the problem.  If I try to change to a state that's defined
before the state it's currently displaying it doesn't work, unless I'm
going to the very first frame.  It keeps displaying the last frame it
displayed.  However, if I use an SWF with the same data, but generated
by the Flash IDE it works perfectly.

Probably easiest to explain if I just give you my code.  here's the
swfmill input:

--------------------------------------------

<?xml version="1.0" encoding="iso-8859-1" ?>

<movie width="320" height="240" framerate="12" version="7">
 <background color="#ffffff"/>

 <clip id="upState" import="up.jpg"/>
 <clip id="downState" import="down.jpg"/>
 <clip id="overState" import="over.jpg"/>
 <clip id="disabledState" import="disabled.jpg"/>

 <frame>
   <library>
     <clip id="testButton">
       <frame name="Up">
         <place id="upState" depth="1"/>
         <stop/>
       </frame>
       <frame name="Over">
         <place id="overState" depth="1"/>
         <stop/>
       </frame>
       <frame name="Down">
         <place id="downState" depth="1"/>
         <stop/>
       </frame>
       <frame name="Disabled">
         <place id="disabledState" depth="1"/>
         <stop/>
       </frame>
     </clip>
   </library>
   <place id="testButton" name="testButton" depth="1"/>
   <textfield id="log" width="200" height="50" size="10" font="vera"
     text="" x="0" y="30"/>
   <place id="log" name="log" depth="10"/>
 </frame>
</movie>

--------------------------------------------

And here's my test code that reproduces the error:

--------------------------------------------
class Main {
 public static function main(mc:MovieClip):Void {

   var iObj:Object = new Object();
   iObj.testButton = mc["testButton"];
   iObj.log = mc["log"];
   iObj.count = 0;
   iObj.setMode = function(mode:String):Void {
     this.log.text = mode;
     this.testButton.gotoAndStop(mode);
   }
   iObj.func = function():Void {
     switch(this.count++ % 7) {
       case 0:
         this.setMode("Up");
         break;
       case 1:
         this.setMode("Over");
         break;
       case 2:
         this.setMode("Down");
         break;
       case 3:
         this.setMode("Disabled");
         break;
       case 4:
         this.setMode("Down");
         break;
       case 5:
         this.setMode("Over");
         break;
       case 6:
         this.setMode("Up");
         break;
     }
   }
   iObj.interval = setInterval(iObj, "func", 1000);
 }
}
--------------------------------------------

I generate the SWF by doing:
swfmill simple test.xml test.sw

and I compile the code with:
mtasc -swf test.swf -main main.as

The state changes work fine until it hits case 4.  The "Down" (4) and
"Over" (5) cases just keep displaying the Disabled state.

Again, if I replace the swfmill output with the output of the Flash
IDE, making the same thing, it works fine.  The only thing I can guess
is that the frames I created in the IDE were created using "Insert
Blank Keyframe", but I don't know if that really has any relevance.

Anyone run into something like this?  Am I just missing something
simple in my swfmill XML that would fix this? (I couldn't find any
good reference on the swfmill XML format, so I might just be missing
something).

Thanks!

  -Andy
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to