views:

317

answers:

2

I would like to know how can I install a library packages to a Flash project. I am using Adobe Flash CS4 and the library I'm trying to include is in AS3.

The library can be found on http://code.google.com/p/as3ansi/

+1  A: 

I can't see from the link you've given where the library files are; it seems more like that thing is a ready-built SWF or something. In general though, to 'install' a library (install is a misleading way to think about it), you put the line:

import folder.folder.*;

..and you put the folders which contain the library files into your project directory (and of course change 'folder' in the above code to whatever the folder names are). For example, if the code is located inside a folder called math > geometry, you'd do:

import math.geometry.*;

Once done, you'll be able to access all the classes and functions that come with your new library. Hope that all helps.

debu
Ok it seem easy but apparently I get compilation errors about classes even if I do the import property.package net.peternitsch.ansi.viewer{ import mx.core.*; public class MultiFontViewer_DefinitionPOTNODDLE extends BitmapAsset { //... }}The definition of the class BitmapAsset is in mx/core/BitmapAsset.asIt should be included but yet I get compilation error.5000: The class 'net.peternitsch.ansi.viewer.MultiFontViewer_Definition8050' must subclass 'flash.display.BitmapData' since it is linked to a library symbol of that type.
Steve Thomas
Message was too long:The compiler must suggest me to use flash.display.BitmapData instead because it can't see the class BitmapAsset in my mx/core/BitmapAsset.asThank you
Steve Thomas
Did you try to simply create an instance of the BitmapAsset class, without extending it, like: var newBA:BitmapAsset = new BitmapAsset(); ? If you get errors from that you'll know that you're not importing correctly. I can't see the place you downloaded the library from anywhere at the link you posted, so I can't really test it myself. Extending from stuff that's imported is entirely possible though, so I'd guess you've got the import name slightly wrong?
debu
A: 

Crap. I should have registered an user. I can't log to my account to reply to debu directly.

I did not try to create an instance of BitmapAsset directly because I'm at work.

About the library. I think the owner did not made the deployment very well.

Try this url http://code.google.com/p/as3ansi/source/browse/#svn/trunk/src

Thank you

Steve Thomas