I'm in the middle of converting my f8 code to f9 and I've been able to convert most of it without too many problems. However, I'm now trying to replace my attachMovieClip() with a class and having some problems.
Here is my class I'm testing:
Code:
package {
import flash.display.MovieClip;
public class ball extends MovieClip {
}
}
And Here's my code in the main timeline:
Code:
var test:ball = new ball();
addChild(test);
It's that simple, btw there is not one drop of code anywhere else in the file, so its not possible something else could be interfering.
Now this code does in fact work with just a simple movieclip with a graphic inside. However, if I give the graphic inside this movieclip an instance name, my movieclip can not be duplicated and I recieve this error:
Code:
ReferenceError: Error #1056: Cannot create property test on ball.
at flash.display::Sprite/flash.display:Sprite::constructChildren()
at flash.display::Sprite$iinit()
at flash.display::MovieClip$iinit()
at ball$iinit()
at Timeline0_274b7e9de3dce042beb2659b4677c86/::frame1()
"test" is the instance name I gave the graphic inside the movieclip. If I remove the instance name, everything works.
I have attached a zip file with the source(same code I posted above).
Thanks for your help.
Last edited by jason merchant; 07-01-2006 at 02:21 AM.
Actually a simple attachmovie() type thing doesn't need the class(flash will automatically create one for you in the background).
All you need to do is use these 2 lines:
var test:ball = new ball();
addChild(test);
The reason I am using the class(although I didn't post the code for this) is because I have want to give the movieclips properties like health, etc.
What is interesting is that when the class is auto-generated I don't get the error, so I thought maybe something was wrong with my class, but look at it, its as simple and clean as it can be. I can't see what is wrong with it. My best guess is this is a bug that was not caught in Flex(or what ever used as3 before f9) because it could not be caught. I've never used flex but I don't think there is a graphical interface like in flash so this bug would have not been found.
Mabe I'm blind but I can't find the place to submit as3 bugs, can someone point me to it?