PDA

View Full Version : Huge .FLA=crashes in IDE, help me load .FLV's at runtime


Peran
11-05-2006, 01:24 PM
Hi!

My music video project is going pretty well, my first project is done:

http://www.youtube.com/watch?v=XFeQm4_h0ts

All the animations except for the cuts between scenes and the text stuff is .FLV files that I've imported as movieclips into my .FLA's library:

this.attachMovie("ShadeCluster1Proto", "ShadeCluster1", this.getNextHighestDepth());
// and later, in the _root.onEnterFrame = function()
ShadeCluster1.gotoAndPlay(1);

Now, the problem is, the final .FLA is 98MB, which makes the development enviroment highly unstable; I can't test the project with CTRL+Enter, and it only MOSTLY creates a working .SWF when I publish it with SHIFT+F12.

So what I'm thinking is, what about if I could load the .FLVs into movieclips at runtime? However, when looking up MovieClipLoader and movieclip.loadMovie in the help file, I'm told I can load SWF, JPEG, GIF, or PNG, that's it.

I'm using FlashAnts' neat little SWF2video to render it all to .AVI, so I can't use the FLVPlayback component, basically what I need are the lines of code that change

this.attachMovie("ShadeCluster1Proto", "ShadeCluster1", this.getNextHighestDepth());

into something like
//pseudo code
load(filename="shadecluster1.flv" identifier="ShadeCluster1", depth=this.getNextHighestDepth());


I'm assuming I'd need to create a loop to make sure all FLV files are fully loaded before my application continues to frame 2, where the action starts.

Oh, and in case it matters, the application is all in a single frame, everything's generated at runtime, empty stage, all AS.


Thanks in advance,

Peran.

mcmcom
11-05-2006, 04:53 PM
you could convert the .flv's into .swfs and use LoadMovie or MovieClipLoader to load them into it. If theres no specific reason why they have to be .flv's then just import them into a new .swf and save that in the same folder you can have everything external .swf's if you want and the quality is just as good as a flv, mind you the individual .swf files you make may be a bit bigger but certianlly better than a 98 mb .fla file!

Then your "main" .fla will be very little and only be like a controller that pulls in external .swfs. The quality will be good if you Squeeze it right.

hth,
mcm

Peran
11-05-2006, 05:05 PM
you could convert the .flv's into .swfs and use LoadMovie or MovieClipLoader to load them into it. If theres no specific reason why they have to be .flv's then just import them into a new .swf and save that in the same folder you can have everything external .swf's if you want and the quality is just as good as a flv, mind you the individual .swf files you make may be a bit bigger but certianlly better than a 98 mb .fla file!

Thanks for the reply!

Yeah, I tried the "embed FLV in SWF" method first (although from the library), but that just didn't work:

http://www.actionscript.org/forums/showthread.php3?t=120367#6

Post #9 further down on that page contains example files.


Peran.

mcmcom
11-05-2006, 05:20 PM
no thats not how you do it. you dont have to add it to the library first. all you should need to do is

1) Open a New .fla
2) FILE -> IMPORT TO STAGE
3) SELECT THE .FLV

then it should actually CONVERT the .flv into a .swf and make all the frames and everything on the stage. If this doesn't work, you may have to go

FLV to AVI (or QuickTime) THEN TO .SWF

Sorenson Squeeze thats part of Flash 8 will open automatically and allow you to do some video compression / editing before the import wizard finishes. Leaving you with 1 swf for 1 .flv and there should be no objects in the library (or very few)

hth,
mcm

Peran
11-05-2006, 06:41 PM
Hi again!

Been reading up on the MovieClipLoader, but I'm having a hard time getting my brain around the listener thingy.

Right now my code is basically two parts: the first part sets up a bunch of stuff, the second part is the onEnterFrame loop. If I understand the concept of the listener.onLoadComplete correctly, I should prolly wait for the .onLoadComplete to trigger before I actually let the onEnterFrame do its stuff.

Assuming that's correct, I'm still a bit stumped.

I did a first test, without bothering with the listener (the .SWF loaded below is 138kb, I'm assuming the loading should be fast enough for it to start playing on frame 1), I replaced the code

this.attachMovie("BlurCircleProto", "BlurCircle", this.getNextHighestDepth());

with

myMCL1 = new MovieClipLoader();
var BlurCircle:MovieClip=this.createEmptyMovieClip("mc", this.getNextHighestDepth());
myMCL1.loadClip("blur-in-circle 320x320 flvswf.swf",BlurCircle)

...and nothing happens. Is the problem that I need to delay the onEnterFrame function until I'm sure the .SWF is fully loaded, or am I doing something else wrong?

Sorry if this is too basic, I'm a bit tired after too many hours coding today. :o


Peran.

mcmcom
11-06-2006, 02:41 AM
simplify the example further and instead of creating an empty movie clip on the stage via AS just create a blank clip in your library. Then drop it on the stage at the x.y vals where you want your movie to load in.

name the instance of that movieclip on the stage "holder_mc"

in frame 1 actionscript panel try

holder_mc.loadMovie("blur-in-circle 320x320 flvswf.swf");


when you test it your movie should load. Once you have that working you can replace the holder_mc.loadMovie function with the more powerful MovieClipLoader class.

hth,
mcm

Peran
11-06-2006, 06:44 AM
Hi again!

Sorry, that doesn't do anything in my project file, and when trying it in a new, blank project (with Linkage set on the movieclip), I get:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler

...but I'm guessing the MCL must be the way to go anyway, since I'll be loading lots of data, and I'll have to wait for it to load until I start the show...

So I'm guessing there's nothing obviously wrong with the code in my last post?


Peran.

Peran
11-06-2006, 07:07 AM
Hi again (again)!

I rewrote it once more, and isolated it to a new .FLA, which now does nothing except load the movieclip. And it loads and plays the movie, which is good...

However, I can't control the playing of the clip anymore. I can move it around using the ._x and ._y properties, but it doesn't listen to .stop(), .gotoAndPlay() or .gotoAndStop anymore.

Why is that, and what can I do to make it listen?


Peran.

Peran
11-06-2006, 11:54 AM
Solved!

Turns out that the clip playing is no guarantee it's actually done loading, even if it's just loading 138kb from a local disk. Once I set it all to wait for the loading to be done, I have control again. *phew*

Thanks for the help, mcmcom, I really appreciate it!


Peran.