Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

definition for the document class could not be found in classpath, actionscript 3.0

Posted on 2009-04-20
6
Medium Priority
?
1,338 Views
Last Modified: 2013-11-11
"definition for the document class could not be found in the classpath" is the error I'm getting when I try to access the .as file by clicking on the pencil in the property inspector.

Also the code doesn't result in anything, not even an error.

I don't understand what I'm doing wrong.  Can someone guide me as to how to create a simple Hello World TextField through an external as file.

Below is my HelloWorld.as code.
I have a blank HellowWorld.fla file in the same directory.
package{
	
	import flash.display.*;
	import flash.text.*;
	public class HelloWorld extends MovieClip{
		public function FlashTry(){
			var myText:TextField = new TextField();
			myText.text = "Hello World!";
			addchild(myText);
		}
	}
}

Open in new window

0
Comment
Question by:polkadot
  • 3
5 Comments
 
LVL 11

Expert Comment

by:ugeb
ID: 24188768
Hi,

Are the .fla and .as files in the same directory?

If not, then you will have to alter the publish settings so that the directory that contains the .as file is in the path.

I've never had a problem accessing the document class when the fla file is in the same directory, though.  But, make sure you have saved your fla file first, before adding a document class.
0
 
LVL 8

Expert Comment

by:Dreammonkey
ID: 24188790
Hi there,

Did you assign the Document Class in to HelloWorld in the FLA ?

You can set the Documents class in the main properties panel (mouse click somewhere on the stage and then select the properties panel, you'll see an input field named Document Class; that's where you should provide the name of the (main) document class (without .as).

Mind, and I quote :
>>>
Below is my HelloWorld.as code.
I have a blank HellowWorld.fla file in the same directory.

Could it be the w is the nature of this trouble?
The FLA and the as should have the exact same name (only different extensions) + assign the document class in the FLA's properties.

DM
0
 
LVL 8

Expert Comment

by:Dreammonkey
ID: 24188881
BTW,

your CLASS should have at least ONE public function with the same name as the Class itself your code should look like this :
package
{       //import as few classes as possible, the minimum needed :
        import flash.display.MovieClip;
        import flash.text.TextField;
 
        public class HelloWorld extends MovieClip
{
                public function HelloWorld(){ //Same as class name !
                        var myText:TextField = new TextField();
                        myText.text = "Hello World!";
                        addchild(myText);
                }
        }
}

Open in new window

0
 

Author Comment

by:polkadot
ID: 24193369
The fla filie is in the same directory as the as file. It was created and saved first.
The as file is set in the properties of the fla file.
Everything is spelled right and case correct in all the actual files.

None of these suggestions are working.

But I have no trouble opening using and running files created from samples. Could there be something wrong with my installation of Flash?
0
 
LVL 8

Accepted Solution

by:
Dreammonkey earned 2000 total points
ID: 24195355
Try this:

go to publish Settings;
select the flash tab;
where it says Script: ActionScript 3.0 click Settings;
in the source path tab, add the location where both files are saved...
hit twice OK
publish
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question