View Full Version : SWFLoader gotoAndStop
06-26-2006, 10:56 AM
I am loading an swf into an swfLoader dynamically. When the content has been loaded I need to be able to make the loaded content move to the second frame - gotoAndStop(2).
I have tried just about everything i can think of to do this but to no avail.
Can anybody help me out there?
mySWFLoader.content.gotoAndStop( 2 );should work.
you'll need to make sure the external file has fully loaded before you invoked that method on it though.
06-26-2006, 01:14 PM
Yeah i tried that but I get this error
"Error: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObject"
Seems daft that there doesn't seem to be any instruction in the language reference about controlling the swf that gets loaded into the swfloader component.
ya just need to cast it to MovieClip. DisplayObjects can be/extend Sprite and therefore they don't have a timeline or gotoAndStop() methods.
var myMovieClip:MovieClip = MovieClip(mySWFLoader.content);
myMovieClip.gotoAndStop( 2 );
06-26-2006, 02:29 PM
Ok thanks for the help
I know get a run time error of
"Coercion failed: cannot convert flash.display::AVM1Movie@f6cf2f1 to flash.display.MovieClip."
is the external SWF Flash 9? I would expect it to work fine if it is, although if it aint I guess its trying to cast it to a Flash 9 MovieClip which fails cos and previous incarnation of MovieClilp doesn't have the same structure.
06-26-2006, 04:18 PM
That would make sense.
The SWF's that are being loaded must be in Flash 8/7 for our live application to use them. The flex application is a tool to be able to administrate the swf 's for the live app. Is there any way that it is possible to cast the movieclip to flash 9 movieclip?
Thanks yet again for your help.
This is a long shot, but try casting to the special type *, which basically untypes your object
var myMovieClip:* = *(mySWFLoader.content);
myMovieClip.gotoAndStop( 2 );
06-27-2006, 01:01 AM
i'm not sure, but i think that only way of communicating between AVM1 Movies and AVM2 Movies is via LocalConnection
06-27-2006, 09:29 AM
Ok thanks for all your help and advice. Will have a look at localconnection today and then i'll report back with my findings.
06-27-2006, 12:34 PM
I have found some examples of using localconnection for AS3 to AS2. The trouble is that they seem to have the swfs local to the AS3 files and the swf contains a movieclip that links to an AS2 class that sets up the connection. In my case the swf's are loaded from a server and the don't contain any movieclips just a few frames. There are hundreds of these swf's so going in to each one and completely changing them isn't an option as this would also need the final application (which they are used for) to be completely reworked.
Is it therefore possible to load in an pre authored swf from the server and be able to use commands such as play and gotoAndStop on with flex2/AS3.
06-27-2006, 08:48 PM
what about creating some kind of "container" in AS1-2, which will load movies and manipulate em, and AS3 will load the "container" and tell him what to do?
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.