Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
octagon

Cannot get swf file to load in browsers.

Recommended Posts

Hi all,

 

I am completely new to this stuff, and have a problem that I don't seem to find the answer for anywhere. I have made an animation in Flash CS5, where I have created a main animation and a loader with GreenSock SWFLoader, as the main animation is quite big (appx. 8 Mb).

 

I have used the sample code on the LoaderMax information page, and created a .fla file with the following AS code in the first frame:

 

 

 

import com.greensock.*;

import com.greensock.loading.*;

import com.greensock.events.LoaderEvent;

import com.greensock.loading.display.*;

 

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});

 

queue.append( new SWFLoader("IntroAnim.swf", {name:"IntroClip", estimatedBytes:8000000, container:this, x:0, y:0, width:500, height:250, autoPlay:true}) );

LoaderMax.prioritize("IntroClip"); //same as LoaderMax.getLoader("photo1").prioritize();

 

queue.load();

 

function progressHandler(event:LoaderEvent):void {

 

}

 

function completeHandler(event:LoaderEvent):void {

var image:ContentDisplay = LoaderMax.getContent("IntroClip");

TweenLite.to(image, 1, {alpha:1, y:0});

}

 

function errorHandler(event:LoaderEvent):void {

}

 

 

 

As everyone can see, I have used the sample code from the LoaderMax page, just omitted everything except from the SWF part, as I don't need any images or anything else than the SWF animation to show up. I have also omitted the tracing functionality, as when I tested it in Flash, everything loaded nicely and the animation played as intended. All tracing information indicated success - therefore the tracing statements have been removed now.

 

Even when I try to open the IntroLoader.swf file directly from my Windows Explorer, it plays as a charm.

 

Now, I am creating a website in DreamWeaver CS5, where I have embedded the IntroLoader.swf loader in one of the pages. However, when I look at the page in Live View, or try to load it in any browser (have tried IE9, FirefFox 10, Opera 10, Google Chrome 17, etc) - all I see is the background color. No animation at all.

 

A little comment: When I try to run the main animation alone - without the loader - it plays just fine in all browsers, as well as in Live View in DreamWeaver.

 

I've tried practically everything, but am completely stuck. Hope that anyone here can help.

 

Thanks in advance.

 

Best regards.

Link to post
Share on other sites

G'day mate,

 

You can minimize a lot of your code by taking out LoaderMax which is not really needed if you just loading in 1 asset. Directly creating a LoaderMax object I think is more for loading in multiple objects. Also by default the top left corner of any image or swf will be at x 0, y 0 on the stage. Try just this and we'll see if we can troubleshoot the problem in the browser:

 

Both swf's are in the same folder right?

 

var introLoader:SWFLoader = new SWFLoader("IntroAnim.swf", new SWFLoaderVars()
.name("IntroClip")
.estimatedBytes(8000000)
.container(this)
);

introLoader.load();

Link to post
Share on other sites

it sounds like you could just be targeting the location of the swf wrong. That is usually culprit if the swf works by itself but not in the context of an html page.

 

are your html page and swf in the same directory? if not adjust the url of your swf loader to be relative to the location of the html page. for instance if your html file is in the site root and your swf is in a sub-directory called swfs:

 

queue.append( new SWFLoader("swfs/IntroAnim.swf", {name:"IntroClip", estimatedBytes:8000000, container:this, x:0, y:0, width:500, height:250, autoPlay:true}) );

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×