I have a .swf file that I'm trying to use in my program. I don't want it to loop, just to stop on the first frame and only change frames when I tell it to. This works when I put the .swf file on the stage and tell that specific instance to stop(). But I need it to be a Movie Clip that's linked to an AS3 file. When I do that, stop() doesn't work anymore and it just keeps looping.
mybrick = new Brick(0, 0);
addChild( mybrick );
mybrick.stop();
It doesn't give me any errors or anything, but it just keeps looping instead of stopping. For some reason when I go to "Convert to Symbol" and "Export for ActionScript" (which is how I made all my other objects follow their code) the stop() function no longer works. What am I doing wrong?
Edit: Ok, here's the main file (I cut out the parts related to other objects because they're not affecting Brick and otherwise this would be pretty long)
package
{
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.display.Stage;
import flash.events.Event;
import flash.ui.Keyboard;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class RetrievoidGame extends MovieClip
{
public var mybrick:Brick;
public function RetrievoidGame()
{
mybrick = new Brick(0, 0);
addChild( mybrick );
mybrick.stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
var newTimer = new Timer( 1 );
newTimer.addEventListener( TimerEvent.TIMER, everyFrame );
newTimer.start();
}
And here's the Brick.as file: package { import flash.display.MovieClip;
public class Brick extends MovieClip
{
public function Brick(myX, myY) {
x = myX;
y = myY;
}
}
}
gotoAndPlay
? If that is the case, callingstop()
isn't going to work. – Bennett Yeates