If you are loading an AS2 SWF into an AS2 swf, you can cast the loaded SWF to a class of your choice by using the __proto__ method which is shown below:

Then you write a class that has an enter frame / tick, etc. to monitor playback and cast your loaded SWF to an instance of this (Animation is my class that monitors the _currentframe, etc.):

   private var _player:MovieClip;
   private var _currentAnim:Animation;
   private var _loader:MovieClipLoader;
private function _loadAnim(file:String):Void {
       _loader.addListener(this);
       _loader.loadClip(file, _player);
   }
//Implement MovieClipLoader listener functions
   private function onLoadInit(pClip:MovieClip) {
       _loader.removeListener(this);
       _player.stop();
       _player.__proto__ = Animation.prototype;
       _player.__constructor__ = Animation;
       _player.__constructor__.apply(_player);
       _player._lockroot = true;
       _currentAnim = Animation(_player);
_currentAnim.addEventListener("animend", Delegate.create(this, _playNextIntro));
       _currentAnim.rewind();
       _currentAnim.stop();
   }


If you are loading into an AS3 swf, you can't do this and I am not sure, but I guess you do have to do the onEnterFrame work around.

Paul Andrews wrote:
AS2.0 question:

I have some AS2.0 swfs supplied to me (generated by captivate) that are loaded as part of my application. Unfortunately they don't have a stop() on the last frame, so they loop. Fortunately they are completely linear, so they play through from start to finish (and over again).

I'd like to have them stop when they reach the last frame. About the only way to do it that I can think of is to use onEnterFrame to monitor the playhead of the loaded swf and and stop it when it hits that last frame. Am I missing any other way of doing this?

I'm trying to avoid having the swfs regenerated.


AS3.0 question.

Currently my main application is written using AS 3.0 and having AS2.0 swf supplied was a bit of an unexpected surprise. I realise that AS3.0 cannot directly control an AS2.0 swf that's been loaded, but are there any completely reliable solutions to communicating between these to allow the AS3.0 application to send one-way messages to the AS2.0 swf?

Thanks,

Paul

[The swfs are actually swf versions of powerpoint slides. Sadly every mechanism I can find for generating swf from powerpoint or via screen capture only creates AS2.0 based swfs]




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--

Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to