flash actionscript:
aScript from a button, loading a swf file into a instance of loader (component) the loading works, but not the step through playing of the frames? successive clicks reload swf on (press) { this._parent.picLoader.loadMovie("show_01.swf"); } on (press) { if (this._parent.picLoader.show_01.swf._currentframe == this._parent.picLoader.show_01.swf._totalframes) { this._parent.picLoader.show_01.swf.gotoAndStop(1); } else { this._parent.picLoader.show_01.swf.nextFrame(); } }
You are loading a swf over and over again with the first on press action. You should only load swf once, not everytime you clcik the button. I suggest that you load the before you try to step through the frames and set it to invisible. Then, when you press the button you set it to visible and step through the frames. Something like this (didn't test it): // put this somewhere else, not on the button, just use the appropriate path this._parent.picLoader.loadMovie("show_01.swf"); this._parent.picLoader._visible = false; // put this on the button on (press) { if (this._parent.picLoader._visible == false) this._parent.picLoader._visible = true; } if (this._parent.picLoader.show_01.swf._currentframe == this._parent.picLoader.show_01.swf._totalframes) { this._parent.picLoader.show_01.swf.gotoAndStop(1); } else { this._parent.picLoader.show_01.swf.nextFrame(); } I'd also advice you to consider using MovieClipLoader class for loading swfs. cheers
thanks, this will give me something to think about and work onfor a while. what is an approprate path ? (if you don't mind), I never really got that? a swf off the stage? thanks really, the movieClipoLoaderClass (i briefly reviewed the help section) , looks the way to go. I don't do this for a living, just fun, if you can call it that? I have only very basic understanding of flash
I don't do this for a living, just fun, if you can call it that? That is what I ask myself lots of times, lol. Path is this: this._parent.picLoader Obviously, if you put the action elsewhere and not on the buttom it can't stay the same. If you put it on the root, and the picLoader movie clip is also on the root, than you would need to write like this: picLoader.loadMovie("show_01.swf"); and the path is now just picLoader
Don't see what you're looking for? Try a search.
|