Welcome to WebmasterWorld Guest from 54.162.227.136

Forum Moderators: open

Message Too Old, No Replies

Animation not loading from first frame

     
5:29 am on Nov 19, 2009 (gmt 0)

5+ Year Member



Hello,
I know that there have been a lot of preloader questions thrown out there, I know, I searched before I posted. The problem I have is that after my preloader runs, the loaded animation doesn't start from the first frame, instead it starts from about the 10th frame.

Here is my code if anyone can help, I would really appreciate it.

var myRequest:URLRequest = new URLRequest("animation.swf");
var myLoader:Loader = new Loader();

myLoader.load(myRequest);

myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);

var myPreloader:Preloader = new Preloader();

function showPreloader(event:Event):void {
addChild(myPreloader);
myPreloader.x = 499.5;
myPreloader.y = 327;
}

function showProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
myPreloader.loading_txt.text = "Loading - " + Math.round(percentLoaded * 100) + "%";
myPreloader.bar_mc.height = 200 * percentLoaded;
}

function showContent(event:Event):void {
removeChild(myPreloader);
addChild(myLoader);
}

8:05 pm on Nov 19, 2009 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome aboard joeinnantucket, I see the preloader, but nothing referring to the animation (other than myLoader . . .)?

Simplest would be to put a stop() in frame one of the animation, then on complete of the data loaded do myAnimation.play() from the parent movie. You might have to bump everything in the ani over one frame, putting nothing but stop() in the first frame, then do myAnimation.goToAndPlay(2).

9:09 pm on Nov 19, 2009 (gmt 0)

5+ Year Member



Hi rocknbil, thanks for the welcome.

My preloader is preloader.swf and the main animation is stored in the first line:

var myRequest:URLRequest = new URLRequest("animation.swf");

When I load it in Flash, by hitting CTRL+Enter twice, it loads fine, however in the browser, my problem happens.

I'll give your suggestions a whirl and let you know how I make out.

5:50 am on Nov 21, 2009 (gmt 0)

5+ Year Member



Hey rocknbil, just wanted to let you know I got it working, thanks for your help!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month