Fever BitmapLib :: How to use BitmapData buffer
BitmapLib class allow user to load and cache image as BitmapData in application buffer.
But how it works exactly ?
BitmapLib class is a subclass of great Pixlib GraphicLib.
Thus, we keep all power features of GraphicLib ( anticache system, events support and more ).
Whereas GraphicLib loads an external image in a MovieClip target, BitmapLib tranform this loaded image into his BitmapData pixel representation.
No MovieClip is affected by this library.
The main goal ? store BitmapData data for multi-use.
You can load an image only one time and used it where you want, when you want and many time you want in your application.
BitmapLib has an internal system to store loaded image data named : BitmapLibLocator
BitmapLibLocator act like a repository for loaded image.
We can use the Fever default one, or create a specific one; it's your choice ;)
Memory leak with BitmapData ? sure... but you can organize your repository to allow a good and clean memory release.
How it works ? let's go !
First, we have to instanciate the BitmapLib class.
Constructor wait for only 1 parameter : the repository name !
If omitted, the BitmapData will be stored on the default BitmapLibLocator.
If BitmapLibLocator does not exist, it will be created.
var lib : BitmapLib = new BitmapLib();
// use custom "myDomain" repository
var lib : BitmapLib = new BitmapLib( "myDomain" );
As it is a GraphicLib subclass, we can use Pixlib methods to define event listeners and others lib properties, for example :
lib.prefixURL( "http://www.customprefixURL/" );
lib.addEventListener( BitmapLib.onLoadInitEVENT, this, _onDataLoaded );
Now an important point on registration ( store ) process.
As we want to store loaded image in a repository, we have to define a registration ID before storing it.
This ID will allow us to retreive data in repository later.
There is 2 way to define this ID in BitmapLib.
- Using #setName( id : String ) method
- Using BitmapLib automatic naming process
It takes the loading url of the loaded image as registration ID.
Clearly better to specify our proper ID for shorter and simpler ID name ;), but in some case we don't really need it that's why auto generation exist
lib.setName( "myImageID" );
lib.load( "assets/monImage.png" );
// use autonaming process
lib.load( "assets/monImage.png" );
As you see, we call #load( url : String ) method to start loading process.
Let's see how to retreive loaded image now.
BitmapData objects are stored in a BitmapLibLocator repository, so we have to :
- Retreives correct BitmapLibLocator ( default or your custom one ). Retreives BitmapData using registration ID.
- BitmapLibLocator#getLocator( repositoryName : String ) : BitmapLibLocator
- returns BitmapLibLocator defined by passed-in repositoryName name
- returns the default BitmapLibLocator if omitted
- creates new repository if not exist
- BitmapLibLocator#isRegistred( repositoryName : String ) : Boolean
- returns true if a BitmapLibLocator is defined with repositoryName name
- BitmapLibLocator#getFullQualifiedData( id : String ) : BitmapData
- shortcut method to retreive BitmapData without retreving BitmapLibLocator instance before
- id must be a string identification formatted as : registration_id@locator_name
- BitmapLibLocator#unregister( repositoryName : String ) : Boolean
- unregisters BitmapLibLocator registred with passed-in repositoryName
- all BitmapData stored in it will be diposed
If you use the BitmapLibLocator#getLocator( ) method to retreives the BitmapLibLocator first, you can manage your BitmapData with ( instance methods ):
- #push( id : String, bmp : BitmapData ) : Boolean
- stores a new bmp BitmapData object with id registration ID
- if id already exist bmp is not stored
- #getData( id : String ) : BitmapData
- returns BitmapData stored with passed-in id
- #exists( id : String ) : Boolean
- returns true if a BitmapData is registred with the passed-in id
- #remove( id : String ) : Boolean
- removes BitmapData stored with passed-in id
- BitmapData is disposed
- #dispose() : Void
- clears and dispose all BitmapData objects stored in current BitmapLibLocator
Some examples :
var locator : BitmapLibLocator = BitmapLibLocator.getLocator( "myDomain" );
var bmp : BitmapData = locator.getData( "myImageID" );
// use direct access with full qualified ID
var bmp : BitmapData = BitmapLibLocator.getFullQualifiedData( "myImageID@myDomain ");
// retreive data registred with "myOtherID" ID from default repository
var locator : BitmapLibLocator = BitmapLibLocator.getLocator();
var bmp : BitmapData = locator.getData( "myOtherID" );
Of course, we can use direct #getContent() method of BitmapLib instance if we keep a reference to it; typically in an event handler after loading process.
Take an example with our previous event listener declaration :
{
var bmp : BitmapData = event.getLib().getContent();
}
Last note about BitmapLib and BitmapData managment, all retreives data are cloned to avoid BitmapData modification !
That's all, hope that I was clearly during this explanation.
You can contact me if some points still dark. ^_^
Romain Ecarnot

<a href="http://www.feelingame.com">wow powerleveling</a>
<a href="http://www.feelingame.com/wow-power-leveling.asp">wow power leveling</a>
<a href="http://www.feelingame.com/wow-gold.asp">wow gold</a>
<a href="http://www.feelingame.com/wow-items.asp">wow items</a>
<a href="http://www.feelingame.com/about-us.asp" target="_blank">http://www.feelingame.com/about-us.asp">feelingame.com</a>
<a href="http://www.feelingame.com/wow-tips.asp" target="_blank">http://www.feelingame.com/wow-tips.asp">wow tips</a>
<a href="http://www.feelingame.com/most-valuable.asp" target="_blank">http://www.feelingame.com/most-valuable.asp">Most Valuable WOW Power Leveling Service</a>
<a href="http://www.feelingame.com/faq.asp">wow power leveling faq</a>
<a href="http://www.cheap-wow-power-leveling.com">cheap wow power leveling</a>
<a href="http://www.cheap-wow-power-leveling.com/">wow power leveling</a>
<a href="http://www.cheap-wow-power-leveling.com/">wow powerleveling</a>
<a href="http://www.cheap-wow-power-leveling.com/">wow power lvl</a>
<a href="http://www.smremont.com">smremont.com</a>
<a href="http://www.polostroy.org">polostroy.org</a>
<a href="http://www.willastroy.com">willastroy.com</a>
<a href="http://www.mngt.ru">mngt.ru</a>
<a href="http://www.ofbis.info">ofbis.info</a>
<a href="http://www.onbis.info">onbis.info</a>
<a href="http://www.mnfin.info">mnfin.info</a>
<a href="http://www.m-bis.info">m-bis.info</a>
<a href="http://www.finup.info">finup.info</a>
<a href="http://www.qbis.info">qbis.info</a>
<a href="http://www.ftrs.info">ftrs.info</a>
<a href="http://www.f-bis.info">f-bis.info</a>
<a href="http://www.bis-up.info">bis-up.info</a>
<a href="http://www.forexbis.info">forexbis.info</a>
<a href="http://www.fnbis.info">fnbis.info</a>
<a href="http://www.conbis.info">conbis.info</a>
<a href="http://www.bisoff.info">bisoff.info</a>
<a href="http://www.bisall.info">bisall.info</a>
<a href="http://www.orgstroy.com">orgstroy.com</a></u>
http://pipes.yahoo.com/pipes/pipe.info?_id=78364cb...
<a href="http://www.isovet.ru">isovet.ru</a>
<a href="http://www.mebelyaroslavl.ru">mebelyaroslavl.ru</a>
<a href="http://factor-tsp.ru">factor-tsp.ru</a>
<a href="http://spbgau.su">spbgau.su</a>
<a href="http://gru3.ru">gru3.ru</a></u>
http://www.datasos.org
http://www.filesos.com
http://www.cndatasos.com
http://www.raidlab.com
http://www.db-sos.com
http://www.oceanbackup.com
http://www.oilpainting.ws
http://www.paintinghere.com
http://www.netscape.com/member/jennyacomplia
http://www.cleat.bz
http://man3.jp
http://loan.saisoncard.co.jp
http://www.mvn.jp
http://www.2dou3.com
http://www.sugu-menkyo.jp/
http://www.tealla.com
http://www.valer.jp
http://www.ikyoku-jinji.com
http://www.wayzup.com
http://www.koushouki.com
http://www.bmbeauty.co.jp/
http://pc.m-friend.jp/index1.asp
http://www.rs-group.jp/mb/index.html
http://movamova.net/?n=deco_top
http://digi-comi.net/
http://www.e-chiken.com/shikkan/gekkeikonnann.htm
http://ihinseiri.jp
http://www.soushow.co.jp/car/
http://www.daishin.biz/DAN/DAN.html
http://www.kaigo-sora.co.jp
http://www.kaisha-seturitsu.com
http://www.sanyukk.com
http://kango.bunnabi.jp/m/
http://www.propaganda-web.com/design/gcom285/mens....
http://www.refonavi.com/
http://www.hide-clinic.com/
http://www.ec-engine.jp
http://lei.ne.jp/h/w-dress
http://lei.ne.jp/h
http://www.legal-agent.jp
http://www.za-hitonotsuma.com
http://wikifipau.org/
http://www.creationlife.co.jp/kenyu/atopy.html
http://www.good-stay.net
http://www.monthly-urban.com
http://www.koukokunavi.jp
http://www.gaikaex.net/
http://www.works-core.co.jp/
http://www.securestage.com/
http://www.dentouin.or.jp/
http://drprojet.com/
http://www.adultshop.co.jp/
http://zensyoji.or.jp/
http://www.chizai-job.com/
http://www.daichou-koumon.com/
http://www.legal-lab.com/
http://www7b.biglobe.ne.jp/~houjyu/
http://www.jinmyouji-nokotsudo.jp/
http://www.giftbank.co.jp/
http://www.sweepdesign.jp/wakaresase/
http://www.30upclub.com/items/muscle2.html
http://www.30upclub.com/items/shape_getia.html
http://www.miraiclub.jp/
http://www.adire.jp/cashing/index.html
http://www.le-poisson-japan.com/
http://www.icb-finishing.co.jp/
http://www.nipponsoft.co.jp/recovery
http://www.max.ac.jp/
http://www.chizai-job.com
http://www.green-f.biz
/http://www.icb-finishing.co.jp/image_consult/index.html" target="_blank">http://www.icb-finishing.co.jp/image_consult/index...
http://www.rs-holdings.net/
http://www.deli-spot.net
http://www.c-class.jp
http://www.beatitudevfx.com/
http://fuzokudx.com/deli/
http://fuzokudx.com/soap/
http://www.kajimitsuo.com/
http://www.omakasetai.com
http://www.cleat.bz
http://man3.jp
http://loan.saisoncard.co.jp
http://www.mvn.jp
http://www.2dou3.com
http://www.tealla.com
http://www.valer.jp
http://www.wayzup.com
http://www.koushouki.com
http://www.bmbeauty.co.jp/
http://pc.m-friend.jp/index1.asp
http://www.rs-group.jp/mb/index.html
http://movamova.net/?n=deco_top
http://digi-comi.net/
http://ihinseiri.jp
http://www.soushow.co.jp/car/
http://www.daishin.biz/DAN/DAN.html
http://www.kaigo-sora.co.jp
http://www.kaisha-seturitsu.com
http://www.sanyukk.com
http://kango.bunnabi.jp/m/
http://www.propaganda-web.com/design/gcom285/mens....
http://www.refonavi.com/
http://www.hide-clinic.com/
http://www.ec-engine.jp
http://lei.ne.jp/h/w-dress
http://lei.ne.jp/h
http://www.legal-agent.jp
http://www.za-hitonotsuma.com