homepage Welcome to WebmasterWorld Guest from 54.204.231.253
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Animation not loading from first frame
joeinnantucket




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

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);
}

 

rocknbil




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

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).

joeinnantucket




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

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.

joeinnantucket




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved