As3 Preloader (export First Frame?)

  • 690 Views
  • 6 Replies
New Topic Respond to this Topic
Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
As3 Preloader (export First Frame?) Jun. 19th, 2012 @ 08:09 PM Reply

The AS3 preloader I have used to work, but doesn't seem to work anymore ever since I included certain movieclips in my library that have "Export in Frame 1" checked. Just the preloader is on the main timeline, and then rest of the game is done in various classes.

Is there any way I can fix this? How you do make a preloader when certain movieclips are exported in frame 1?

Here's the story of everything else I've tried:

I tried unchecking it and then dragging all of those mcs onto the second frame of the main timeline, but then this happens (the new game button doesn't work). If I then take off the fade mc used to fade to the main game, the game just fades to a white screen and I get the error "Cannot access a property or method of a null object reference."

I also tried opening the "Advanced AS3 Setting" and then setting "Export classes in frame" to 2. Then I made the first frame of the game blank and have it stop on the second frame with the preloader, but then the preloader doesn't work and all the methods in the main document class no longer work, and I get the error "Error #1009: Cannot access a property or method of a null object reference."

Thanks

MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Supporter
Level 10
Programmer
Response to As3 Preloader (export First Frame?) Jun. 19th, 2012 @ 10:17 PM Reply

I'd suggest looking into factoryClass and avoiding all this frame exporting class. You can handle preloading only using code.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to As3 Preloader (export First Frame?) Jun. 19th, 2012 @ 11:30 PM Reply

At 6/19/12 10:17 PM, MintPaw wrote: I'd suggest looking into factoryClass and avoiding all this frame exporting class. You can handle preloading only using code.

Thanks, I'll look into that.

4urentertainment
4urentertainment
  • Member since: Aug. 1, 2008
  • Offline.
Forum Stats
Moderator
Level 13
Game Developer
Response to As3 Preloader (export First Frame?) Jun. 20th, 2012 @ 07:26 AM Reply

A very easy fix for preloader troubles:

http://www.kongregate.com/forums/4-programming/topics/139515

Check second post there.

Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to As3 Preloader (export First Frame?) Jun. 20th, 2012 @ 01:36 PM Reply

At 6/20/12 07:26 AM, 4urentertainment wrote: A very easy fix for preloader troubles:

http://www.kongregate.com/forums/4-programming/topics/139515

Check second post there.

That seems a lot easier to do, I tried it earlier without much success but I'll try messing around with it and hopefully that'll be the solution. Thanks.

Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to As3 Preloader (export First Frame?) Jun. 20th, 2012 @ 06:26 PM Reply

At 6/20/12 07:26 AM, 4urentertainment wrote: A very easy fix for preloader troubles:

http://www.kongregate.com/forums/4-programming/topics/139515

Check second post there.

Hey, this worked! Yay!

I had to make frame 1 the preloader, frame 2 a movieclip with the game inside of it. Then I scrapped my main class and put all the code inside the movielclip.

It's weird how it seems like if you want a working preloader, you can't have a main class, and you can't do the game in pure code unless you do some insane workaround.

MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Supporter
Level 10
Programmer
Response to As3 Preloader (export First Frame?) Jun. 20th, 2012 @ 07:08 PM Reply

At 6/20/12 06:26 PM, Snubby wrote: and you can't do the game in pure code unless you do some insane workaround.

Don't exaggerate, it was like 10 lines, just because you couldn't figure it out doesn't mean it's insane, nor is it a work around. Exporting all your stuff on frame 2 is a workaround.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature