Jump to content
GreenSock

learner_7n

1046: Type was not found or was not a compile-time constant:

Recommended Posts

Hi,

 

I have the following code to load a .SWF file from the same folder where my .FLA is. But getting the error.

 

The Code is:

import com.greensock.*; 
import com.greensock.easing.*; 

import com.greensock.loading.ImageLoader;
import com.greensock.loading.LoaderMax;
import com.greensock.loading.SWFLoader;
import com.greensock.loading.VideoLoader;
import com.greensock.loading.display.ContentDisplay;


LoaderMax.activate([imageLoader, SWFLoader, VideoLoader]); 
queue.append(new SWFLoader("SlideBar.swf", {width:300, height:100, container:this, onComplete:completeHandler}) );

function completeHandler(event:LoaderEvent):void {
   TweenMax.to(event.target.content, 1, {x:-10, y:530, repeat:-1, yoyo:true});
}

And the following is the error:

1046: Type was not found or was not a compile-time constant: LoaderEvent.

Warning: 3590: void used where a Boolean value was expected. The expression will be type coerced to Boolean.

Warning: 3594: getTime is not a recognized method of the dynamic class Date.

 

Please help.

Link to comment
Share on other sites

for the first error add this import

 

import com.greensock.events.LoaderEvent; 

 

your other 2 warnings are probably related to other code that you have.

Link to comment
Share on other sites

Hi,

 

Thanks for the reply. I have added the advised code. Now I am getting the following error:

 

1120: Access of undefined property queue.

 

Further help, please.

Link to comment
Share on other sites

you need to create a LoaderMax before you can append things to it.

 

LoaderMax is most useful when loading multiple images.

 

you need to do:

 

var queue:LoaderMax = new LoaderMax()

 

somewhere before you use queue.append.

 

you also need to tell your queue to load()

 

if it is only 1 swf you are loading just do:

 

var mySwf:SWFLoader = new SWFLoader("SlideBar.swf", {width:300, height:100, container:this, onComplete:completeHandler}) );
mySwf.load();

function completeHandler(event:LoaderEvent):void {
   TweenMax.to(event.target.content, 1, {x:-10, y:530, repeat:-1, yoyo:true});
}

Link to comment
Share on other sites

Thanks for your kind reply. Now, I am getting the following error:

1086: Syntax error: expecting semicolon before rightparen.

 

Which highlights the below code:

 

var mySwf:SWFLoader = new SWFLoader("SlideBar.swf", {width:300, height:100, container:this, onComplete:completeHandler}));

 

Request for further help, please.

Link to comment
Share on other sites

var mySwf:SWFLoader = new SWFLoader("SlideBar.swf", {width:300, height:100, container:this, onComplete:completeHandler}));

should be

var mySwf:SWFLoader = new SWFLoader("SlideBar.swf", {width:300, height:100, container:this, onComplete:completeHandler});

Link to comment
Share on other sites

I tried the suggested code. But getting the following error now:

 

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at Main/init()

at Main()

Link to comment
Share on other sites

it would help if you would post all your code as it is now. there is no way for anyone to diagnose that problem without seeing it.

Link to comment
Share on other sites

Hi,

 

The following is the whole code that I have (There are several classes that I have imported assuming it might be required later):

 

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

import com.greensock.loading.ImageLoader;
import com.greensock.loading.LoaderMax;
import com.greensock.loading.SWFLoader;
import com.greensock.loading.VideoLoader;
import com.greensock.loading.display.ContentDisplay;
import flash.display.MovieClip;

var mySwf:SWFLoader = new SWFLoader("SlideBar.swf", {width:300, height:100, container:this, onComplete:completeHandler});

mySwf.load();

function completeHandler(event:LoaderEvent):void {
   TweenMax.to(event.target.content, 1, {x:-10, y:530, repeat:-1, yoyo:true});
}

Link to comment
Share on other sites

i didn't see any errors in the code above and even tested it with my own swf and it works great.

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