PDA

View Full Version : Document class from classpath



TemeZ
May 12th, 2007, 09:51 AM
I'm new in Flash CS3 and have tested it first time. I put my document class to (publish settings, fla based) classpath "classes/", and name that class "main".. then i put to document class input field "main", but it doesnt work..

if i put to "main.as" package classes and to document class input field "classes.main" it works.. but not without that.. other case when it works is that if i put main.as to same folder with .fla file..

every other classes works from classpath, without package classes.something

what is the reason? the classpath is not registered before document class run?

senocular
May 12th, 2007, 12:16 PM
Normal classes need to be within a folder defined within your classpath. Classes in packages need to be defined in a folder structure that mirrors their package definition. So classes.main needs to be a main.as file saved within a classes folder. That classes folder then needs to be within a folder defined within your class path. Package folders themselves should not be included within the classpath.

The basic rule is, whatever word directly follows the package keyword in the .as file is the file/folder that needs to be within a classpath directory. So, for instance package { requires that main.as be in a classpath dir. package classes{ requires that classes (folder) be in a classpath dir. (and that main.as be within classes). package i.am.a.rock.star { needs the i folder to be within a classpath dir.

TemeZ
May 12th, 2007, 12:24 PM
i meant that flash doesent found document class from classpath.. why? it works only if it is in same dir than .fla file

other classes works from classpath..

senocular
May 12th, 2007, 12:33 PM
I was just trying to explain how they worked in case you were doing something wrong.

TemeZ
May 12th, 2007, 12:46 PM
ok, there is my tests

in every cases classpath = .\classes (document level, not global), .fla file is in .\ folder

a) main.as in .\classes\ folder, Document class main => doesnt work
b) main.as in .\ folder, Document class main => works
c) main.as in .\classes\ folder, in main.as package classes {, Document class classes.main => works

if that a-case should work, I did something wrong..

senocular
May 12th, 2007, 01:57 PM
There should be no problem with that