Skip navigation
Currently Being Moderated

How to refer to a Class linkage set in Library from external code?

Jan 12, 2011 6:49 AM

If one uses [Embed] to refer to external graphic assets its easy to instantiate and use them.

However, I've got a png in an Fla, with the Class identifier set to "Symbols", Base class is BitmapData.

 

I need to instantiate it like this:

var symbols:BitmapData = new Symbols(1, 1);

 

addChild(new Bitmap(symbols));

 

Of course the compiler complains about a call to a possibly undefined method Symbols.

For a temporary fix I guess i'll put the graphic external to the swf, but for this project it needs to be in the library along with everything else.

 
Replies
  • Currently Being Moderated
    Jan 12, 2011 7:12 AM   in reply to Grime-P

    If you have a symbol in your library with a Class identity of "Symbols" then you should only need to use...

     

    var symbols:Symbols = new Symbols();

     

    addChild(symbols);

     

    As far as the 1,1 argumets go, are those not something you could assign when the instance is created?

     
    |
    Mark as:
  • kglad
    72,228 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 12, 2011 7:23 AM   in reply to Ned Murphy

    (if Symbols is extends the bitmapdata class, he'll need to create a bitmap to create a displayobject.)

     
    |
    Mark as:
  • kglad
    72,228 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 12, 2011 7:26 AM   in reply to Grime-P

    flash would compile that without problem.

     

    what compiler are you using?

     
    |
    Mark as:
  • kglad
    72,228 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 12, 2011 8:23 AM   in reply to Grime-P

    i can't help you with that compiler.  but i don't see why it would be a problem when flash wouldn't.

     

    is Symbols in a swf that's loaded by a main swf?

     
    |
    Mark as:
  • kglad
    72,228 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 13, 2011 12:14 PM   in reply to Grime-P

    check the applicationdomain class.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 13, 2011 4:40 PM   in reply to Grime-P

    You can embed symbol from external swf using syntax:

     

    [Embed(source = 'swfName.swf', symbol = 'Symbols')]

     

    Given swfName is in the same directory as your top level class.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points