Jump to content
Search Community

errors when loading

vyger test
Moderator Tag

Recommended Posts

Hi, I copied some code from the reference, in particular I copied and pasted this code in the first frame of my FLA (Ide: Flash CS5, OS: MacOS):

 

import com.greensock.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.*;

//create an ImageLoader: THROWS ERROR
var loader:ImageLoader = new ImageLoader("photo1.jpg",{name:"photo1",container:this,x:180,y:100,width:200,height:150,scaleMode:"proportionalInside",centerRegistration:true,onComplete:onImageLoad});

//begin loading: THROWS ERROR
loader.load();

//when the image loads, fade it in from alpha:0 using TweenLite;
function onImageLoad(event:LoaderEvent):void
{
TweenLite.from(event.target.content, 1, {alpha:0});
}

//Or you could put the ImageLoader into a LoaderMax. Create one first...
var queue:LoaderMax = new LoaderMax({name:"mainQueue",onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler});

//append the ImageLoader and several other loaders: THROWS ERROR
queue.append( loader );
//queue.append( new XMLLoader("xml/doc.xml", {name:"xmlDoc", estimatedBytes:425}) );
//queue.append( new SWFLoader("swf/main.swf", {name:"mainClip", estimatedBytes:3000, container:this, autoPlay:false}) );

//start loading
queue.load();

function progressHandler(event:LoaderEvent):void
{
trace("progress: " + queue.progress);
}

function completeHandler(event:LoaderEvent):void
{
trace(event.target + " is complete!");
}

function errorHandler(event:LoaderEvent):void
{
trace("error occured with " + event.target + ": " + event.text);
}

 

This one throws three errors: 1137, 1061 and 1067.

Everything seems very easy: what am I doing wrong?

 

Thanks in advance.

Link to comment
Share on other sites

do you have photo1.jpg in the same directory as your fla?

how about the other files like xml/doc.xml or swf.main.swf?

 

I would suggest only testing the first part of the code and getting it to work.

 

1:place a jpg named photo1.jpg in the same directory as your fla swf and com folder.

 

2: use just this code:

 

import com.greensock.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.*;

//create an ImageLoader: THROWS ERROR
var loader:ImageLoader = new ImageLoader("photo1.jpg",{name:"photo1",container:this,x:180,y:100,width:200,height:150,scaleMode:"proportionalInside",centerRegistration:true,onComplete:onImageLoad});

//begin loading: THROWS ERROR
loader.load();

//when the image loads, fade it in from alpha:0 using TweenLite;
function onImageLoad(event:LoaderEvent):void
{
  TweenLite.from(event.target.content, 1, {alpha:0});
}

 

let us know if that works.

 

if you get errors. please post the complete error. they contain line numbers and descriptions that will help us trouble shoot your issue.

Link to comment
Share on other sites

Hi Carl, thanks for your kind reply.

 

I created a new FLA and I simply copied and pasted your code in the first frame.

The FLA (and the swf) is located in a folder where I have the minumum elements required (I suppose): an image ('photo1.jpg') and the com folder.

 

I compile and I get:

 

error 1137: Incorrect number of arguments. Expected no more than 1.

 

Line 6:

var loader:ImageLoader = new ImageLoader("photo1.jpg",{name:"photo1",container:this,x:180,y:100,width:200,height:150,scaleMode:"proportionalInside",centerRegistration:true,onComplete:onImageLoad});

 

error 1061: Call to a possibly undefined method load through a reference with static type ImageLoader.

 

Line 9:

loader.load();

 

I must say I tried the same test before posting, with the same result. Oh! I commented the lines about doc.xml etc. because I did not need them (I only wanted to load an image).

 

Another thing: this is not the only thing not working. I got the first error when trying the large piece of code I found in the middle of this page: http://www.greensock.com/loadermax/

Then I reached the reference page and found the code I posted (and it did not work too)...

Link to comment
Share on other sites

Hey Vyger,

 

Sorry to hear you are having such troubles.

 

From what I can see, you aren't doing anything wrong and it all should work.

 

I followed the same steps and zipped my files for you to test.

 

I know what I'm providing does work and uses the exact same code so let's see if it works for you.

 

 

Carl

 

ps. I totally overlooked that you had the xml and swf stuff commented out in your first post. my bad.

 

EDIT: FILES NOW ATTACHED FLASH CS5 with COM

Link to comment
Share on other sites

Hi, your files are ok: anything works fine. The only difference is (very strange this one) your com folder is 1.7 Mb with 112 elements, while mine is 1.8 Mb with 112 elements. I downloaded the files three days ago from GreenSock website. Could it be a version issue?

Link to comment
Share on other sites

i just downloaded the latest version and tested with the file I gave you. no problems.

 

i guess you can try saving my file next to your "not working" com folder and see if it works.

 

either way you have a set of files that work. you should be fine.

Link to comment
Share on other sites

Hi, thanks for your reply: of course now I have a working com folder (and of course I tried what you suggest before posting).

 

I investigated further the differences between the two folders.

The changelog header is the same:

 

CHANGE LOG : GREENSOCK TWEENING PLATFORM

----------------------------------------

2011-07-07

---------------------------------------------

TweenLite 11.63

TweenMax 11.69

 

but three folders have different size:

 

events (20 kb in my version, 12 in yours)

loading (815 kb / 803 kb)

plugins (205 kb / 188 kb)

 

Anyway, no problem, your platform is stellar. :-)

 

Vyger

Link to comment
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.
×
×
  • Create New...