Hi,

When Embedding symbols in AS3, you do construct instances of your assets using new VariableName -

   http://www.bit-101.com/blog/?p=853

However, I don't think that the Flash IDE supports this as it does not support the [Embed] metadata type... The only way around this is to use Flash Develop or Flex to create your app.

   http://www.actionscript.org/forums/showthread.php3?t=134499

   Glen

Jon Bradley wrote:

On Mar 24, 2008, at 8:30 AM, Cor wrote:


This throws an error:
TypeError: Error #1007: Instantiation attempted on a non-constructor.

What am I doing wrong?


You can't call new Background_mc() when it's an instance of Class - there's no constructor for it that the compiler recognizes.

My suggestion if you don't need to extend UIMovieClip is as follows.

In your Library.fla file, check your export for the Background_mc symbol.

Give it a class name (com.something.myBackground) and have it extend flash.display.MovieClip.

Export an SWC of the Library file and then set your compiler prefs to include that SWC into the project.

Then, in your class just do:

import com.something.myBackground

and the usage is:

private var myBG : MovieClip;
private var Background_mc:MovieClip;

myBG = MovieClip( new Background_mc() );

At least, that's one way of doing it. I do it that way for non-component UI elements that do not need to extend UIMovieClip. Also because I use the same SWC as an SWF file for CSS embedding of graphical elements.

good luck,

jon

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--

Glen Pike
01736 759321
www.glenpike.co.uk <http://www.glenpike.co.uk>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to