Skip to main content
Inspiring
February 23, 2011
Answered

class linkage question

  • February 23, 2011
  • 3 replies
  • 909 views

Assume I know practically nothing about AS3!

I'm using Flash Pro CS5.

I'm trying to reassociate a flash file I've been given with its external assets and classes. In the library I have a movieclip with linkage to a class called 'StaticMap' using the base class 'flash.display.MovieClip'.

My question is this, am I missing a custom class file called 'StaticMap.as' that was originally located in the same folder as the fla, or is this a generic class accessible to all movieClips from within Flash?

Thanks

This topic has been closed for replies.
Correct answer Ned Murphy

When an object in the library is assigned a Class for its linkage, such as what you just described, Flash will automatically create a fairly generic class for that object if it is unable to find a class already defined for it by that name.

The class it creates will be equivalent to...

package
{
    import flash.display.MovieClip;
    
    public class ExampleMovieClip extends MovieClip
    {
        public function ExampleMovieClip()
        {
        }
    }
}


but it does not create a file that you can open/edit.  If you were to create such a class file yourself, then Flash would use it instead of creating its own for it.

So there may not be a separate class file that you can find for library objects that have linkages assigned.  They may be built into the swf when you compile the file.

3 replies

Ned Murphy
Ned MurphyCorrect answer
Legend
February 23, 2011

When an object in the library is assigned a Class for its linkage, such as what you just described, Flash will automatically create a fairly generic class for that object if it is unable to find a class already defined for it by that name.

The class it creates will be equivalent to...

package
{
    import flash.display.MovieClip;
    
    public class ExampleMovieClip extends MovieClip
    {
        public function ExampleMovieClip()
        {
        }
    }
}


but it does not create a file that you can open/edit.  If you were to create such a class file yourself, then Flash would use it instead of creating its own for it.

So there may not be a separate class file that you can find for library objects that have linkages assigned.  They may be built into the swf when you compile the file.

Inspiring
February 23, 2011

If you have StaticMap class in the same directory as fla - compiler will use it. If file is missing - compiler will create it.

graphterAuthor
Inspiring
February 23, 2011

OK. So are you saying StaticMap is a generic class with predefined atributes?

Kenneth Kawamoto
Community Expert
Community Expert
February 23, 2011

The Class "StaticMap" Flash creates for you would be pretty much identical to the Class "MovieClip" since StaticMap is MovieClip. If you really want to know you can do this (without StaticMap.as file):

import flash.utils.describeType;

trace(describeType(StaticMap));

The result is basically the same as describeType(MovieClip).

Kenneth Kawamoto
Community Expert
Community Expert
February 23, 2011

You can have a Class file "StaticMap.as", but you don't have to have one if you don't need it

graphterAuthor
Inspiring
February 23, 2011

Thanks for your reply but I don't understand your answer. How do you know I don't need it when you haven't seen the file? Can you explain your answer a bit more?

Cheers