Be a Supporter!

Preloading +"export on first frame"

  • 343 Views
  • 7 Replies
New Topic Respond to this Topic
Marsume
Marsume
  • Member since: Oct. 22, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Preloading +"export on first frame" Jul. 30th, 2010 @ 11:59 PM Reply

I have a file that has quite a few sounds and large graphics with linkages that export on the first frame (so before the preloader starts, technically)
So there must be a way around this, anyone have any ideas?

I heard someone say that you can string files together using Flash Projects (*.flp files), but I tried and either he was lying or I just couldn't figure it out.

Also, is it possible to embed a swf in a swf? But then when it gets to uploading to websites and such, would I have to upload both files in order for it to work? (from my understanding, yes I would)

SOOOOO
Like can it even be done? Have you ever done it? Is there anything you can think of that I should try?

Pikanjo
Pikanjo
  • Member since: Oct. 11, 2001
  • Offline.
Forum Stats
Member
Level 45
Blank Slate
Response to Preloading +"export on first frame" Jul. 31st, 2010 @ 01:35 AM Reply

At 7/30/10 11:59 PM, Marsume wrote: I have a file that has quite a few sounds and large graphics with linkages that export on the first frame (so before the preloader starts, technically)
So there must be a way around this, anyone have any ideas?

I heard someone say that you can string files together using Flash Projects (*.flp files), but I tried and either he was lying or I just couldn't figure it out.

Also, is it possible to embed a swf in a swf? But then when it gets to uploading to websites and such, would I have to upload both files in order for it to work? (from my understanding, yes I would)

SOOOOO
Like can it even be done? Have you ever done it? Is there anything you can think of that I should try?

I'm having this exact same problem: my entire game is exported MCs, sounds, bitmaps, etc..

I was able to find some pages that say if you choose to export on a different frame (linkage>unckeck export on first frame, and instead choose a different frame in the flash publish settings), and you use your object (eg a bitmap) before you declare it dynamically (i just placed it off screen somewhere), you can use it that way. This worked when I tested it with pure timeline actionscript, but I ran into problems with my .as files tho - they seem to not recognize the exported objects this way.

So my solution (for now) is to export everything in the first frame, and instead make a new flash file that loads the game into it, using something like:

var loader:Loader = new Loader();
var req:URLRequest = new URLRequest("movie.swf");
var percent:Number = 0;
addChild(loader);
loader.load(req);
var info:LoaderInfo = loader.contentLoaderInfo;
percent = 100*info.bytesLoaded/info.bytesTotal;

I'll post if I find anything new.

Marsume
Marsume
  • Member since: Oct. 22, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Preloading +"export on first frame" Jul. 31st, 2010 @ 01:49 AM Reply

At 7/31/10 01:35 AM, Pikanjo wrote: I'm having this exact same problem: my entire game is exported MCs, sounds, bitmaps, etc..

Mine too

I was able to find some pages that say if you choose to export on a different frame (linkage>unckeck export on first frame, and instead choose a different frame in the flash publish settings), and you use your object (eg a bitmap) before you declare it dynamically (i just placed it off screen somewhere), you can use it that way. This worked when I tested it with pure timeline actionscript, but I ran into problems with my .as files tho - they seem to not recognize the exported objects this way.

Yeah, I read something like that as well. I tried it out with my .as files and it began to throw a ton of errors at me...

So my solution (for now) is to export everything in the first frame, and instead make a new flash file that loads the game into it, using something like:
//code

Alright, That will have to be my solution too for now haha. But the only thing is, when it comes time to upload it to websites, you're gunna have to upload both files, right?
Or when you export the file with the loaded .swf does it store all that data in the new file?
I wouldn't think so, because it's looking for external media, is it not?

I'll post if I find anything new.

And alright, that would be great!
I'll also send you a pm if I find anything :)

Innermike
Innermike
  • Member since: Sep. 11, 2009
  • Offline.
Forum Stats
Member
Level 14
Audiophile
Response to Preloading +"export on first frame" Jul. 31st, 2010 @ 04:49 AM Reply

Uncheck export on first frame on everything but preloader.

Get all the symbols and sounds you're going to use and put them in the frame after your preloader, off the stage of course. then just use the third frame to run all your game code, if you're using a doc class to add your main game objects then youll have to replace it to check if you're on the third frame, then add the doc class as an entire game object onto the stage, the last game i made had a total of 80 kb in symbols so i only did this with sounds but i think itll work, use the flash IDE bandwidth profiler to see how well its working.


Concerned Joe (not mine but still cool)

BBS Signature
Marsume
Marsume
  • Member since: Oct. 22, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Preloading +"export on first frame" Jul. 31st, 2010 @ 05:08 AM Reply

At 7/31/10 04:49 AM, HDXmike wrote: Uncheck export on first frame on everything but preloader.

Get all the symbols and sounds you're going to use and put them in the frame after your preloader, off the stage of course. then just use the third frame to run all your game code, if you're using a doc class to add your main game objects then youll have to replace it to check if you're on the third frame, then add the doc class as an entire game object onto the stage, the last game i made had a total of 80 kb in symbols so i only did this with sounds but i think itll work, use the flash IDE bandwidth profiler to see how well its working.

I just tried it with one sound clip, and it's already throwing errors at me :(
The item had a linkage of Menu_Music, so I unchecked the "export on first frame", and then added an empty frame after the preloader and dropped in the sound. Then exported.

1046: Type was not found or was not a compile-time constant: Music_Menu.
1180: Call to a possibly undefined method Music_Menu.
Coolio-Niato
Coolio-Niato
  • Member since: Jun. 30, 2005
  • Offline.
Forum Stats
Member
Level 28
Blank Slate
Response to Preloading +"export on first frame" Jul. 31st, 2010 @ 11:34 PM Reply

At 7/31/10 05:08 AM, Marsume wrote:
At 7/31/10 04:49 AM, HDXmike wrote: Uncheck export on first frame on everything but preloader.

Get all the symbols and sounds you're going to use and put them in the frame after your preloader, off the stage of course. then just use the third frame to run all your game code, if you're using a doc class to add your main game objects then youll have to replace it to check if you're on the third frame, then add the doc class as an entire game object onto the stage, the last game i made had a total of 80 kb in symbols so i only did this with sounds but i think itll work, use the flash IDE bandwidth profiler to see how well its working.
I just tried it with one sound clip, and it's already throwing errors at me :(
The item had a linkage of Menu_Music, so I unchecked the "export on first frame", and then added an empty frame after the preloader and dropped in the sound. Then exported.

1046: Type was not found or was not a compile-time constant: Music_Menu.
1180: Call to a possibly undefined method Music_Menu.

What HDXMike said DOES work- I know multiple flash devs who do this, myself included. Try it again, make sure you still leave the linkage type in and don't export on first frame. Try to put the sound file in an Assets MC on the second frame (an MC that would hold all your sounds and library items etc)

Marsume
Marsume
  • Member since: Oct. 22, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Preloading +"export on first frame" Aug. 1st, 2010 @ 01:52 AM Reply

At 7/31/10 11:34 PM, Coolio-Niato wrote: What HDXMike said DOES work- I know multiple flash devs who do this, myself included. Try it again, make sure you still leave the linkage type in and don't export on first frame. Try to put the sound file in an Assets MC on the second frame (an MC that would hold all your sounds and library items etc)

The linkage is name is still in there, along with the "Export for actionscript" check box is still checked, but the"Export on first frame" box was unchecked.

I put the sound clip in a movieclip on the second frame, right after the preloader.

It's still throwing those two errors. What am I doing wrong? lol
This one sound plays in the .fla file on "frame 3", (the first frame in the next scene) and then all my other sounds are played in the next scene after that, which is the "game" scene. hmm

I tried it with a graphic and it seemed to work, but with every sound it throws those two errors. :\

Marsume
Marsume
  • Member since: Oct. 22, 2006
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Preloading +"export on first frame" Aug. 2nd, 2010 @ 03:00 AM Reply

At 7/31/10 11:34 PM, Coolio-Niato wrote:
What HDXMike said DOES work- I know multiple flash devs who do this, myself included.

I must be doing something wrong then, and I'm not sure what. I mean, it's working for all my graphics, but it's not for my sounds.

Do I need to manually create a Music_Menu Class, that extends...sound? and does nothing at all? :|
I've google and it seems that I can't find anything that will help either...

Can anyone tell what I'm doing wrong? Or even have some helpful links they could link me to?

It would be very much so appreciated.