Jump to content
Search Community

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

learner_7n test
Moderator Tag

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

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

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

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