Quick question about playing .swf's in Flash 8 Pro

11 posts

Flag Post

Not technically game-related, but this is another question from work, and you guys are my favorite group of Flash programmers to talk to, so I thought I’d ask. :)

Basically, I have a number of .swf files that are each essentially “mini-games”. I need to put together a single .swf file that will present each one with instructions and let the user interact with each of the “mini-games”. Doing an “import” doesn’t really work – it just gets a non-interactive version of the files. While I do have the original .fla files, they often include multiple .as files and .css files and basically I think it’s going to be a mess to try to incorporate all of the source files. Any suggestions would be welcome.

One more, unrelated question:

I’m planning on exporting as an .swf, but I don’t know that most computers have a standalone player. Last time I tried obtaining one from Adobe it only worked inside of web browsers. Does anyone know where to get an official standalone Flash player? If not, does anyone have recommendations for an unofficial player to use?

Thanks for the help. You guys rock. :)

 
Flag Post

Tell your makers to send the original *.FLA files. Four Seconds series used this way to get a lot of microgames.

And for the player thing……Google it and you may find it.

 
Flag Post

I’m not sure what you meant by import, but have you looked at loadMovie()?

http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary423.html

 
Flag Post

You know, I missed “loadMovie”. I’ll try that tomorrow at work. Kannushi – I do have all the .FLA files, I just wasn’t sure if it was feasible to pull them all together reasonably. I will try that if loadMovie doesn’t work. Thanks for the help guys – I’m still learning this stuff. :) (I’m primarily a C++/C# programmer, but we’ve started up a side project using Flash for medical testing so I’m starting to get my hands a little dirty with the ActionScript. I’m no artist though…)

Also, as an answer to my own question, in case someone is wondering. I was unable to find an official Adobe standalone Flash player (i.e. something that can play .swf files). There are lots of unofficial standalones, but I wanted to avoid having our grant reviewers install unofficial software if possible. However, I discovered that in the standalone player that comes with Flash Pro you can save an .swf as an .exe file that can be, well, executed on its own without a standalone player. You do this by going to “File” and hitting “Create Projector”. Hope this helps if anyone was wondering.

 
Flag Post

Ok Kannuishi_Link – I have all of the .FLA files (and their dependencies) in a Flash Project. My question is: how do I link between them? I want to have a main menu that allows you to browse around and load the various Flash files to see them demonstrated. The main menu is my default document, but I don’t know how to load the others from it. The Flash documentation is terrible in this regard and despite being a decent Googler I haven’t had any luck online yet. Am I just being really dense?

 
Flag Post

I think you’re trying to do this in an odd way. The flash Project is used to basically organize all your files in a project, it’s not meant to actually combine the files in any way (at least not like what you’re meaning to do). It sounds like you need to compile these mini-games into .swf files, and then you can load them into a MovieClip at runtime using loadMovie().

 
Flag Post

Ah, that makes more sense. I actually really want to use the .swf’s, because in some cases I have difficulty adjustments to some of the tasks from the same .FLA file. Unfortunately, loadMovie is being extremely difficult and is only working sometimes, and even then not working well.

For example, I’ve tried:

_root.createEmptyMovieClip(“temp”,999); loadMovie(“SWF Files/Symbol_Recognition_Normal.swf”, temp);

But for some reason the movieclip displays but doesn’t play. Adding temp.play() doesn’t do anything either.

I’ve tried creating a dummy clip and placing it by hand in the stage. Then, tried both:

square_mc.loadMovie(“SWF Files/Symbol_Recognition_Normal.swf”);

and

loadMovie(“SWF Files/Symbol_Recognition_Normal.swf”, square_mc);

Both of these simply result in a blank screen (though the square is also gone, so apparently it did load something).

The only thing that works correctly is:

loadMovie(“SWF Files/Symbol_Recognition_Normal.swf”,_root);

But then it replaces the whole flash document, meaning I can’t use the menu again without reprogramming all of the .swf’s to jump back to the menu. Am I doing this all bass ackwards?

 
Flag Post

Am I doing this all bass ackwards?

Lol, yeah, but that’s okay… Flash has some fun quirks and it takes a little getting used to.

The loadMovie() function is fine for a quick and dirty load, but if you want more control over the loading process, look up the MovieClipLoader class in the help files. You need to define a separate listener object for handling the events, but this method makes it so much easier to load stuff.

this.createEmptyMovieClip("mcHolder",this.getNextHighestDepth());

var mclLoader:MovieClipLoader = new MovieClipLoader();
var oListener:Object = new Object();
oListener.onLoadInit = function():Void {
    //do something when loaded
	trace("loaded");
}
mclLoader.addListener(oListener);
mclLoader.loadClip("whatever.swf", this["mcHolder"]);

As for the .swf movies not playing, I’m not sure what could be happening. This would be a good time to mention the reason why making references to

_root
is a really bad idea, since the _root will change when you load clips into other clips. So, if the mini-games used the root reference a lot, you could have problems. (lockroot is a solution but I have no experience using it, as I prefer to scope my code the right way ;))

 
Flag Post

Hmmm…thanks for the info! Unfortunately, despite working quite well (onLoadInit definitely useful!), the non-playing movie problem is still an issue – I wonder if it’s the .swf files? Could it be the use of UI components (which screw around with depth values)? I’m not sure what’s going on, but apparently this is doomed to not work for this project. I’ll try it again later when I’m just futzing around on my own, but I guess I’m just going to have to put together a bunch of files for the reviewers to open individually. Thanks for the help though!

 
Flag Post

If its not working, make sure to try _lockroot as mentioned and perhaps try loading it into a level instead of a clip if needed.

 
Flag Post

Ding ding, we have a winner! :-) Thanks – I hadn’t used levels before at all. I need to figure out how to handle some formatting/positioning issues, but I think this’ll work. Thanks to each of you for the help!