Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Gary Horsman

Error 1046: Type was not found …

Recommended Posts

For some reason, this file was working the first time I compiled. It's running fine on the site. But I need to make a change and make the music play automatically, but now it won't compile.

 

Scene 1, Layer 'actions', Frame 1, Line 30 1046: Type was not found or was not a compile-time constant: TimelineMax.

Scene 1, Layer 'actions', Frame 1, Line 30 1180: Call to a possibly undefined method TimelineMax.

Scene 1, Layer 'actions', Frame 1, Line 31 1180: Call to a possibly undefined method TweenLite.

 

But the com folder (version AS3) is in the same folder as the FLA file (Flash CS5). As far as I can see, there's no reason these compile errors should turn up.

 

Here's the code.

 

import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.media.Sound;
import flash.media.SoundChannel;


//set up instances of the player controls
var PauseButton1:MovieClip = new PauseButton;
var PlayButton1:MovieClip = new PlayButton;

//make clips act like buttons
PauseButton1.buttonMode = true;
PauseButton1.useHandCursor = true;
PauseButton1.mouseChildren = false;
PlayButton1.buttonMode = true;
PlayButton1.useHandCursor = true;
PlayButton1.mouseChildren = false;

//place the play button inside the empty container 
ToggleButton1.addChild(PlayButton1);

//add click listeners to player controls
PauseButton1.addEventListener(MouseEvent.CLICK, pauseSound, false, 0, true);
PlayButton1.addEventListener(MouseEvent.CLICK, playSound, false, 0, true);

//set up timeline for rotating buffer symbol, but keep it from playing right away
var myTL:TimelineMax = new TimelineMax({repeat:-1, paused:true});
myTL.append(new TweenLite(BufferSymbol1, 2, {rotation:-360, ease:Linear.easeNone}));

//set up music clip location and variable and load into Flash
var localURL:URLRequest = new URLRequest("music_web_evo.mp3");
var songURL:URLRequest = new URLRequest("http://qreativ.com/evolutionmontreal.com/files/music_web_evo.mp3");
var evoMusic:Sound = new Sound();
evoMusic.load(songURL);//clip on the web--->
//clip on the hard drive--->evoMusic.load(localURL);
var songChannel:SoundChannel = new SoundChannel();
var songPosition:int = 0;

//functions

function pauseSound(e:MouseEvent):void {
songPosition = songChannel.position;
songChannel.stop();
ToggleButton1.removeChild(PauseButton1);
ToggleButton1.addChild(PlayButton1);
myTL.pause();
trace("music paused");
}

function playSound(e:MouseEvent):void {
songChannel = evoMusic.play(songPosition);
ToggleButton1.removeChild(PlayButton1);
ToggleButton1.addChild(PauseButton1);
myTL.play();
trace("music playing");
}

Link to comment
Share on other sites

That's a really odd one!

 

The only things that I can think of would be:

 

1) Does the greensock folder in com still have all it's files

2) Check Publish Settings->Flash->Settings are the correct paths in there (should only need "." though with that folder setup)

 

If that's not it then hopefully someone more knowledeable will have some better advice.

 

X10

Link to comment
Share on other sites

The publishing path seemed fine, but I thought that maybe I ought to download a fresh com folder from the greensock site just in case. Now it works. I'm not sure what happened to the com folder I had on file.

 

Well, mysteriously, problem solved. Thanks for your input.

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