View Full Version : import weirdness. definition not found.
butcherBaker
August 29th, 2007, 03:05 PM
Okay, I'm stumped.
I'm trying to work with the ProgressBar.
I have one setup working fine. I did it at home, worked at home. brought it to work, it worked fine.
NOW, I've redesigned my structure, and am redoing the ProgressBar portion.
this time it doesn't work. Not even the livedocs example works.
I've got three "programs" open in flash. GallerV2, GallerV, LiveDocsProgressBarExample.
GallerV compiles fine. ProgressBar works fine.
GallerV2 won't compile. errors are above.
LiveDocsProgressBarExample won't compile, same errors.
error messages:
1046: Type was not found or was not a compile-time constant: ProgressBar.
1172: Definition fl.controls:ProgressBar could not be found.
1172: Definition fl.controls:ProgressBarMode could not be found.
butcherBaker
August 29th, 2007, 03:06 PM
dang, I can't get this post to work. it keeps cutting off.
the rest:
How can flash find the Class Definition for one program, but not the others? All in the same authoring session, on the same computer, moments apart. I've restarted Flash. no results. I've checked the classpath to insure fl.controls.ProgressBar.as exists where it should.
What's up?
cesig
August 29th, 2007, 04:38 PM
What's the offending code look like?
butcherBaker
August 29th, 2007, 05:46 PM
What's the offending code look like?
The thing is, it can't be my code. It's the same with the livedocs code.
It worked at home when I did the example. It doesn't work today.
One program compiles, One doesn't. Same code.
here's the live docs code:
package
{
import fl.controls.Button;
import fl.controls.ProgressBar;
import fl.controls.ProgressBarMode;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class ProgressBarExample extends Sprite
{
private var j:uint;
private var pb:ProgressBar;
private var fakeProgressCount:uint;
public function ProgressBarExample() {
setupProgressBar();
setupButton();
}
private function advancePreloader(e:MouseEvent):void {
fakeProgressCount = (fakeProgressCount == 100) ? 0 : fakeProgressCount + 10;
pb.setProgress(fakeProgressCount, 100);
}
private function setupButton():void {
var b:Button = new Button();
b.move(10, 30);
b.setSize(120, 20);
b.label = "Increment Progress";
b.addEventListener(MouseEvent.CLICK, advancePreloader);
addChild(b);
}
private function setupProgressBar():void {
fakeProgressCount = 0;
pb = new ProgressBar();
pb.move(10, 10);
pb.mode = ProgressBarMode.MANUAL;
addChild(pb);
}
}
}
example error:
1046: Type was not found or was not a compile-time constant: ProgressBar.
cesig
August 29th, 2007, 06:48 PM
I ran into an issue before where Flash was trying to compile my AS3 code as AS2 for some reason. It was just one file in a project of many that Flash choked on. It kept complaining about the package definition and how it didn't know what that was.
Point is, it was weird. And the fix was to copy the entire contents of the file into a new, clean .as file, delete the old, save this new one in its place.
Then it worked fine.
Basically, if it looks really REALLY weird, there is a chance that everything is right and Flash is just stupid. Maybe that's the case here.
butcherBaker
August 30th, 2007, 05:00 PM
I've put this one to Adobe. We'll see.
last night, I tried your suggestion. no go.
However, I made a brand new file and typed the code (instead of cutting and pasting from a working script) and it worked. but the same code cut and pasted didn't work.
HUH?!?!
cesig
August 31st, 2007, 10:36 AM
I've put this one to Adobe. We'll see.
last night, I tried your suggestion. no go.
However, I made a brand new file and typed the code (instead of cutting and pasting from a working script) and it worked. but the same code cut and pasted didn't work.
HUH?!?!
Was the code exact? Sounds like there was a bug or something that's in the cut/pasted code. No?
In any case, glad you got it worked out.
butcherBaker
August 31st, 2007, 05:19 PM
Was the code exact? Sounds like there was a bug or something that's in the cut/pasted code. No?
In any case, glad you got it worked out.
I'm an idiot.
I forgot the dang component has to be in the library.
DUH!!!!
nothing to see here.
thanks for help Cesig.
WarpZone
November 12th, 2007, 09:43 AM
How do you put a component into the Library? I can't figure out how create a ProgressBar in the library. All it lets me add to the Library are Buttons, MovieClips, and Graphics(Sprites).
The Flash docs said something like "Components are Movieclips with extra functionality," so I tried making a MovieClip in the library and giving it the class fl.controls.ProgressBar, but it wouldn't accept it so I guess that's not the right answer.
Edit: Nevermind, I figured it out. There's an entire Components Window that I apparently hid from myself shortly after I installed Flash. It contains dozens of complex prebuilt objects which are like MovieClips with code already in them. Step-by-step instructions follow:
1. Open the Component Window. (Click Windows > Components if you can't find it.)
2. Drag a component from there to your library.
3. From the Library, you can drag it onto your stage and give it an instance name, or create a new instance of it in code.
You can double-click on a component to modify its graphics. Doing so will change all instances of that component in the current fla file, but will not affect the original component. (Note that applying a Tint or other blending effects to one of the Movieclips you see within the ProgressBar doesn't count. You have to actually enter the MovieClips and manually edit the colors of each line and fill.)
There can only be one of each component in a fla; dragging a new ProgressBar into the Library from the Components Window will replace your custom ProgressBar with the default one.
Gundark
November 12th, 2007, 10:26 AM
^ You can drag the component from the components window directly into your library. If you can't see the components window go to the menu Windows->Components (or hit Ctr-F7). You should be able to find ProgressBar and drag it straight to your library window.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.