Friday, 15 June 2012

actionscript 3 - Internal AS3 preloader & stage issues -



actionscript 3 - Internal AS3 preloader & stage issues -

i need create single swf no external files, i'm trying add together internal preloader flash project has [embed] assets. know [embed] causes problems preloaders because puts assets on frame 1. have tried solutions recommended in these posts, set document class preloader class:

preloader swf embed bytearray

how create preloader in as3

i can work, if comment out lines of code involve stage, otherwise "error #1009: cannot access property or method of null object reference." lines essential though, know how prepare errors stage?

you haven't posted code or fla, can share works me.

first, wouldn't utilize embed. instead, utilize swc. have found embed can unreliable far getting entire asset in there (at to the lowest degree when publishing flash builder + flash pro, workflow).

once have assets in swc, seek next steps:

set export frame frame 10 (or frame other 1--i frame 10 because can read label says "preloader") put actual content on frame 11. can construction lot of ways. since programme interfaces, give whatever on frame 11 instance name , utilize setter determine "first thing" has been placed on stage. can away because main document class knows definition of interface, not total implementation of class, class not need load main document class work. aren't using timeline , didn't programme interfaces, you'll set base of operations class of symbol that's on frame 11 main logic of whatever you're trying do. put preloader graphics in frame 1. i'm not sure why stage references important. i, personally, don't utilize logic in preloader. instead, utilize spinner spans frames 1-10 (plus word "loading...". spinner spins while classes load. embed frame acts temporary "stop" holds timeline until classes have been loaded. 1 time classes have been loaded, timeline deed called play() on it. can simple. if need more complicated, give 1 of preloader graphics instance name , set getter/setter pair it, utilize setter trigger logic accesses stage. pretty much guaranteed have valid stage @ point.

word of warning: if did create utilize of timelime, unusual results if seek jump frame isn't loaded yet, create sure check see if given frame loaded if it's near end of main timeline , main timeline heavy assets before calling gotoandplay() or gotoandstop().

some references might help further:

preloaders vs 3 (i'd recommend read entire series part of. amazing series wish i'd found 3 years ago) solving frame 2 problem presentation , code combining timeline oop illustration code here (long story)

actionscript-3 flash preloader flash-cs6

No comments:

Post a Comment