PDA

View Full Version : Package newbie...


Linked713
07-11-2009, 05:59 PM
Hai I have an issue with the whole package thing. When I use the classpaths to my packages and use a empty package name it works..

classpath: .\com\cc

.fla

var scene:Mainclass = new Mainclass(this);
addChild(scene);


Mainclass

package{

// imports

public class Mainclass extends Sprite{

// vars

public function Mainclass(scope){
// code
}

// code
}
}




Now the problem:

I get rid of the classpath assuming it will be pointing the fla location.

I change my .fla to reflect this

import com.cc.Mainclass.*;

var scene:Mainclass = new Mainclass(this);
addChild(scene);


Then my Class like this

package com.cc.Mainclass{

// imports

public class Mainclass extends Sprite{

// vars

public function Mainclass(scope){
// code
}

// code
}
}



I get these errors
1172: Definition com.cc.Mainclass could not be found.
1172: Definition com.cc.Mainclass could not be found.
1046: Type was not found or was not a compile-time constant: Mainclass.
1180: Call to a possibly undefined method Mainclass.

Folder PATH listing

testas3
│ AC_RunActiveContent.js
│ testas3.fla
│ testas3.html
│ testas3.swf

└───com
├───cc
│ Mainclass.as

└───gs
│ OverwriteManager.as
│ TweenGroup.as
│ TweenLite.as
│ TweenMax.as

├───easing
│ Back.as
│ Bounce.as
│ Circ.as
│ Cubic.as
│ EaseLookup.as
│ easing_readme.txt
│ Elastic.as
│ Expo.as
│ Linear.as
│ Quad.as
│ Quart.as
│ Quint.as
│ Sine.as
│ Strong.as

├───events
│ TweenEvent.as

├───plugins
│ AutoAlphaPlugin.as
│ BevelFilterPlugin.as
│ BezierPlugin.as
│ BezierThroughPlugin.as
│ BlurFilterPlugin.as
│ ColorMatrixFilterPlugin.as
│ ColorTransformPlugin.as
│ DropShadowFilterPlugin.as
│ EndArrayPlugin.as
│ FastTransformPlugin.as
│ FilterPlugin.as
│ FrameLabelPlugin.as
│ FramePlugin.as
│ GlowFilterPlugin.as
│ HexColorsPlugin.as
│ QuaternionsPlugin.as
│ RemoveTintPlugin.as
│ RoundPropsPlugin.as
│ ScalePlugin.as
│ SetSizePlugin.as
│ ShortRotationPlugin.as
│ TintPlugin.as
│ TweenPlugin.as
│ VisiblePlugin.as
│ VolumePlugin.as

└───utils
└───tween
ArrayTweenInfo.as
BevelFilterVars.as
BlurFilterVars.as
ColorMatrixFilterVars.as
ColorTransformVars.as
DropShadowFilterVars.as
FilterVars.as
GlowFilterVars.as
SubVars.as
TransformAroundCenterVars.as
TransformAroundPointVars.as
TweenInfo.as
TweenLiteVars.as
TweenMaxVars.as

I've been head-smashing my keyboard for a long time even though I know it is a simple "can't find your class" problem.

I tried to put a classpath to reflect my /fla location, still no success. Thanks.

dcaccavella
07-11-2009, 06:02 PM
You were importing com.CC.Mainclass.*. Your classname is not com.CC.Mainclass.Mainclass. You should import com.cc.* or com.cc.Mainclass.

does this make sense?

Linked713
07-11-2009, 06:17 PM
I tried that too no luck.

I tried it again just to make sure and yes still the same errors.

tadster
07-11-2009, 08:12 PM
Why don't you just use your package as the Document Class?
that's a lot of .as files, just put them all in the same folder as your fla, and disregard the whole naming of packages, using Mainclass as the Document Class.